/* Proposal Generator Specific Styles */
/* Reuses existing styles from style.css and rfp-style.css */

/* ===========================
   ANALYTICS DASHBOARD STYLES
   =========================== */

.analytics-header {
    margin-bottom: 2rem;
    text-align: center;
}

.analytics-header h3 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.analytics-subtitle {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

.analytics-dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (min-width: 1200px) {
    .analytics-dashboard {
        grid-template-columns: 1fr 1fr;
    }
}

.analytics-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.analytics-card-header {
    margin-bottom: 1.5rem;
}

.analytics-card-header h4 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.analytics-card-header h4 i {
    color: #007bff;
}

.card-subtitle {
    color: #666;
    font-size: 0.85rem;
    margin: 0;
}

.analytics-card-body {
    position: relative;
    height: 300px;
}

.analytics-card-body canvas {
    max-width: 100%;
    height: 100%;
}

#analytics-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
}

/* Responsive adjustments for analytics */
@media (max-width: 768px) {
    .analytics-dashboard {
        grid-template-columns: 1fr;
    }
    
    .analytics-card {
        padding: 1rem;
    }
    
    .analytics-card-body {
        height: 250px;
    }
}

/* ===========================
   PROFESSIONAL REFINEMENT INTERFACE
   =========================== */

.refinement-interface {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 1rem 0;
    overflow: hidden;
}

.refinement-strategy-panel {
    background: #f8f9fa;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.refinement-strategy-panel h3 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.25rem;
}

.strategy-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.strategy-tab {
    padding: 0.75rem 1.5rem;
    border: 2px solid #e0e0e0;
    background: #fff;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.strategy-tab:hover {
    border-color: #005a9c;
    color: #005a9c;
}

.strategy-tab.active {
    background: #005a9c;
    border-color: #005a9c;
    color: #fff;
}

.refinement-panel {
    display: none;
    padding: 2rem;
}

.refinement-panel.active {
    display: block;
}

.panel-header {
    margin-bottom: 2rem;
}

.panel-header h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1.2rem;
}

.panel-header p {
    margin: 0;
    color: #666;
    font-size: 0.95rem;
}

/* Content Refinement Styles */
.section-selector {
    margin-bottom: 2rem;
}

.section-selector label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.refinement-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.refinement-option:hover {
    border-color: #005a9c;
    background: #f8feff;
}

.refinement-option.selected {
    border-color: #005a9c;
    background: #e3f2fd;
    color: #005a9c;
}

.refinement-option i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.refinement-option span {
    font-weight: 500;
    font-size: 0.9rem;
}

/* Custom instruction area */
.custom-instruction {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.custom-instruction label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.custom-instruction textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.custom-instruction textarea:focus {
    border-color: #005a9c;
    box-shadow: 0 0 0 0.2rem rgba(0, 90, 156, 0.25);
    outline: 0;
}

/* Brand Voice Styles */
.voice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.voice-option {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.voice-option:hover {
    border-color: #005a9c;
    background: #f8feff;
}

.voice-option.selected {
    border-color: #005a9c;
    background: #e3f2fd;
}

.voice-name {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
    margin-bottom: 0.5rem;
    display: block;
}

.voice-desc {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

.tone-sliders {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 1rem;
}

.slider-group {
    display: flex;
    flex-direction: column;
}

.slider-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.slider-group input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #666;
}

/* Personalization Styles */
.client-context {
    margin-bottom: 2rem;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* Compliance Styles */
.check-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.check-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.check-option:hover {
    border-color: #28a745;
    background: #f8fff9;
}

.check-option i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #28a745;
}

.check-option span {
    font-weight: 500;
    color: #333;
}

.compliance-results {
    margin-top: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #28a745;
}

/* Action Buttons */
.refinement-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding: 2rem;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.refinement-actions .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
}

/* Status and Progress */
.refinement-status {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.status-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-left-color: #005a9c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.status-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #333;
}

/* Responsive Design */
@media (max-width: 768px) {
    .option-grid,
    .voice-grid,
    .check-options {
        grid-template-columns: 1fr;
    }
    
    .tone-sliders {
        grid-template-columns: 1fr;
    }
    
    .refinement-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .strategy-tabs {
        flex-direction: column;
    }
}

/* Tab Container */
.proposal-tabs-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0;
}

.proposal-tab-button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    background: none;
    color: #666;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    top: 2px;
}

.proposal-tab-button:hover {
    color: #005a9c;
}

.proposal-tab-button.active {
    color: #005a9c;
    border-bottom-color: #005a9c;
    font-weight: 600;
}

.proposal-tab-content {
    display: none;
}

.proposal-tab-content.active {
    display: block;
}

/* Chat Modal Styles */
.chat-modal-content {
    width: 100vw;
    max-width: 1500px;
    margin: 0 auto;
    height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent the modal content itself from scrolling */
}

@media (max-width: 1500px) {
    .chat-modal-content {
        width: 100vw;
        max-width: 100vw;
        margin: 0;
    }
}

/* Remove or override the mobile media query that sets max-width: 95% */
@media (max-width: 768px) {
    .chat-modal-content {
        width: 100vw;
        max-width: 100vw;
        margin: 0;
    }
}

/* FIX: Make the modal body a flex container to control its children */
.modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 1rem 0 0 0;
    overflow-y: auto; /* This is the only scrollable area */
}

.chat-messages-container {
    flex: 1 1 auto;
    min-height: 0;
    max-height: unset;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    background: #f8f9fa;
    margin-bottom: 0.5rem;
    font-family: 'Calibri', 'Segoe UI', 'Arial', sans-serif !important;
}

/* ===========================
   PROPOSAL-SPECIFIC CHAT MESSAGE STYLES
   Resolves conflict with _chatbot.css
   =========================== */

/* Proposal refinement chat messages */
.proposal-chat-message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-family: 'Calibri', 'Segoe UI', 'Arial', sans-serif;
}

.proposal-chat-message.user {
    background: #e3f2fd;
    margin-left: 20%;
}

.proposal-chat-message.assistant {
    background: white;
    margin-right: 20%;
}

.proposal-chat-message.system {
    background: #f5f5f5;
    border-left: 4px solid #005a9c;
    margin: 0;
    font-size: 0.9em;
}

.proposal-chat-message .message-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.proposal-chat-message .message-content {
    color: #555;
    line-height: 1.6;
}

.proposal-chat-message .message-content.collapsed {
    max-height: 100px;
    overflow: hidden;
    position: relative;
}

.proposal-chat-message .message-content.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(transparent, white);
}

.proposal-chat-message pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    font-family: inherit;
}

.chat-input-form {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background: #fff;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.03);
    border-top: 1px solid #e0e0e0;
    padding: 0.5rem 0 0.5rem 0;
    font-family: 'Calibri', 'Segoe UI', 'Arial', sans-serif !important;
}

#proposal-chat-input {
    min-height: 3rem;
    max-height: 12rem;
    overflow-y: auto;
    resize: none;
    width: 100%;
    box-sizing: border-box;
    font-size: 1rem;
    line-height: 1.5;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    transition: border-color 0.2s;
    font-family: 'Calibri', 'Segoe UI', 'Arial', sans-serif !important;
}

#proposal-chat-input:focus {
    border-color: #007bff;
    outline: none;
}

/* Settings Modal */
.settings-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.settings-tab-button {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    background: none;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.settings-tab-button:hover {
    color: #005a9c;
}

.settings-tab-button.active {
    color: #005a9c;
    border-bottom-color: #005a9c;
}

.settings-tab-content {
    display: none;
}
.settings-tab-content:not(.is-hidden) {
    display: block !important;
}

.settings-tab-content.active {
    display: block;
}

#default-instruction-textarea {
    width: 100%;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Status dots specific to proposals */
.rfp-status-dot.blue {
    background-color: #2196F3;
}

/* File selection enhancements */
.file-icon {
    margin-right: 8px;
}

.file-icon.fa-file-pdf {
    color: #dc3545;
}

.file-icon.fa-file-word {
    color: #0066cc;
}

.file-icon.fa-file-excel {
    color: #1d6f42;
}

/* Button group styling */
.btn-success {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* Export Actions Styles */
.export-actions {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.export-actions h4 {
    margin-bottom: 1rem;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
}

.export-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.export-buttons .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
    border: 1px solid #6c757d;
    background-color: #6c757d;
    color: white;
}

.export-buttons .btn:hover {
    background-color: #5a6268;
    border-color: #545b62;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.export-buttons .btn i {
    font-size: 1rem;
}

/* Stage Edit/Delete/Add Button Styles - Minimal Icon Style */
.edit-btn {
    background: transparent;
    color: #6c757d;
    border: none;
    padding: 0.25rem;
    font-size: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 0.25rem;
    opacity: 0.7;
}

.edit-btn:hover {
    background: rgba(108, 117, 125, 0.1);
    color: #495057;
    opacity: 1;
    transform: scale(1.1);
}

.delete-btn {
    background: transparent;
    color: #6c757d;
    border: none;
    padding: 0.25rem;
    font-size: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 0.25rem;
    opacity: 0.7;
}

.delete-btn:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    opacity: 1;
    transform: scale(1.1);
}

/* Icon sizing for edit and delete buttons */
.edit-btn i,
.delete-btn i {
    font-size: 0.7rem;
}

.add-item-btn {
    background: transparent;
    color: #6c757d;
    border: 1px solid transparent;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0.5rem;
    opacity: 0.8;
    font-weight: 500;
}

.add-item-btn:hover {
    background: rgba(40, 167, 69, 0.05);
    border-color: rgba(40, 167, 69, 0.2);
    color: #28a745;
    opacity: 1;
    transform: translateY(-1px);
}

.add-item-btn i {
    font-size: 0.7rem;
}

/* Drag and Drop Styling for Stage 2 */
.sortable-sections {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
}

.sortable-item {
    position: relative;
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    cursor: move;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sortable-item:hover {
    border-color: #007bff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.sortable-item.dragging {
    opacity: 0.9;
    transform: scale(1.03);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #007bff;
    z-index: 1000;
    transition: all 0.2s ease;
}

.drag-handle {
    position: absolute;
    left: -1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 1rem;
    cursor: grab;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    z-index: 2;
    width: 1.2rem;
    height: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drag-handle:hover {
    background: #f8f9fa;
    color: #007bff;
    transform: translateY(-50%) scale(1.05);
}

.drag-handle:active {
    cursor: grabbing;
    color: #0056b3;
}

.section-plan-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-left: 1rem;
    position: relative;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    position: relative;
}

.section-number {
    background: #007bff;
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.section-title-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
}

.section-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Drop zone indicators */
.sortable-sections.drag-over {
    background: #f8f9fa;
    border: 2px dashed #007bff;
    border-radius: 8px;
    padding: 1rem;
    position: relative;
}

.sortable-sections.drag-over::before {
    content: "Drop here to reorder sections";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #007bff;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1;
    opacity: 0.9;
}

/* Instructions for drag and drop */
.sortable-sections::after {
    content: "💡 Tip: Drag the grip icon (⋮⋮) to reorder sections";
    display: block;
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
    margin-top: 1rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
}

/* Smooth professional drag and drop animations */
.sortable-ghost {
    opacity: 0.6;
    background: #f8f9fa !important;
    transform: scale(0.98);
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sortable-chosen {
    cursor: grabbing !important;
    transform: scale(1.02);
    transition: all 0.2s ease;
}

.sortable-drag {
    cursor: grabbing !important;
    transform: scale(1.03);
    opacity: 0.9;
    z-index: 1000;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Smooth transitions for section items */
.section-plan-item {
    transition: all 0.3s ease;
}

.section-plan-item:hover {
    background: #fdfdfd;
}

/* Drop zone indication */
.sortable-fallback {
    display: none;
}

/* Better spacing for sortable container */
.sortable-sections {
    min-height: 4rem;
    transition: all 0.3s ease;
}

/* Improved visual feedback during drag */
.section-plan-item.sortable-chosen .drag-handle {
    color: #007bff;
    background: #e7f3ff;
}

.section-plan-item.sortable-ghost .drag-handle {
    opacity: 0.5;
}

/* Visual feedback for other items during drag */
.drag-fade {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.sortable-sections:not(:empty)::after {
    display: none;
}

.sortable-item.drag-over {
    border-color: #007bff;
    background: #e3f2fd;
}

/* Visual feedback for draggable items */
.sortable-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: transparent;
    border-radius: 4px 0 0 4px;
    transition: background-color 0.2s ease;
}

.sortable-item:hover::before {
    background: #007bff;
}

.sortable-item.dragging::before {
    background: #007bff;
}

/* Field editor styling for inline editing */
.field-editor {
    min-width: 300px;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #007bff;
    border-radius: 6px;
    font-size: 1.1rem;
    font-family: inherit;
    background: #fff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
    line-height: 1.4;
    min-height: 44px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.field-editor:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.3rem rgba(0, 123, 255, 0.25);
    transform: scale(1.01);
}

/* Textarea field editor styling */
textarea.field-editor {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

/* Proposal viewer modal content styling */
.proposal-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.proposal-section .section-title {
    color: #0056b3;
    margin: 0 0 1rem 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.proposal-section .section-content {
    line-height: 1.6;
    color: #333;
}

.proposal-section .section-content h1,
.proposal-section .section-content h2,
.proposal-section .section-content h3,
.proposal-section .section-content h4 {
    color: #0056b3;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.proposal-section .section-content p {
    margin-bottom: 1rem;
}

.proposal-section .section-content strong {
    color: #0056b3;
}

.proposal-section .section-sources {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
    color: #6c757d;
    font-style: italic;
}

/* Draft Editor Modal Styling */
#draft-editor-modal {
    z-index: 10000;
}

#draft-editor-modal .fullscreen-header {
    background: #0056b3;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#draft-editor-modal .fullscreen-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

#draft-editor-modal .header-actions {
    display: flex;
    gap: 0.5rem;
}

#draft-editor-modal .header-actions .btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

#draft-editor-modal .header-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#draft-editor-modal .fullscreen-body {
    padding: 2rem;
    background: #f8f9fa;
    height: calc(100vh - 80px);
    overflow-y: auto;
}

#draft-editor-modal .editor-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Compliance Check Options Styling */
.check-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.check-option {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: #495057;
}

.check-option:hover {
    border-color: #007bff;
    background: #e3f2fd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,123,255,0.2);
}

.check-option.selected {
    background: #007bff !important;
    color: white !important;
    border-color: #007bff !important;
}

.check-option i {
    font-size: 1.5rem;
    margin-right: 0.75rem;
    min-width: 24px;
}

.check-option span {
    font-weight: 500;
    font-size: 0.95rem;
}

/* Compliance Results Styling */
.compliance-results {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.compliance-results h5 {
    color: #0056b3;
    margin-bottom: 1rem;
}

.compliance-results.is-hidden {
    display: none;
}

/* Stage form input styling */
.stage-edit-form {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    margin: 0.5rem 0;
}

.stage-edit-form input[type="text"],
.stage-edit-form input[type="email"],
.stage-edit-form input[type="date"],
.stage-edit-form textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.stage-edit-form input[type="text"]:focus,
.stage-edit-form input[type="email"]:focus,
.stage-edit-form input[type="date"]:focus,
.stage-edit-form textarea:focus {
    outline: 0;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.stage-edit-form .form-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.stage-edit-form .form-actions .btn {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .proposal-tabs-container {
        flex-wrap: wrap;
    }
    
    .proposal-tab-button {
        flex: 1 1 auto;
        text-align: center;
    }
    
    .chat-modal-content {
        width: 100vw;
        max-width: 100vw;
        margin: 0;
    }
    
    .proposal-chat-message.user,
    .proposal-chat-message.assistant {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Loading states */
.proposal-generating {
    opacity: 0.6;
    pointer-events: none;
}

/* Print styles for proposal viewing */
@media print {
    .modal-overlay,
    .btn,
    .action-icon,
    button {
        display: none !important;
    }
    
    #proposal-content-viewer {
        max-height: none !important;
        border: none !important;
        box-shadow: none !important;
    }
}

#company-logo-proposal {
    height: 48px;
    width: auto;
    max-width: 180px;
    display: block;
}

/* 1. Header background slightly darker than #f8f9fa */
header {
    background: #edeff1; /* 2% darker than #f8f9fa */
}

/* 2. Make only the column headers bold */
#unanalyzed-rfps-header-proposal .sortable-header,
#unanalyzed-rfps-header-proposal .rfp-col-actions,
#generated-proposals-header .sortable-header,
#generated-proposals-header .rfp-col-status,
#generated-proposals-header .rfp-col-actions {
    font-weight: bold;
}

.container.nav-container {
    background: #edeff1;
}

/* Generation Progress Styles */
/* Updated generation progress - reduced height and fixed z-index */
.generation-progress {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stage-indicators {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin-bottom: 10px;
    width: 100%;
    flex-direction: row;
}

.stage-indicators::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 40px;
    right: 40px;
    height: 2px;
    background-color: #e0e0e0;
    z-index: 0; /* FIXED: Changed from z-index: 1 to z-index: 0 */
}

.stage-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2; /* Higher than the line */
    flex: 1;
    max-width: 120px;
}

.stage-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--color-gray-300);
    color: var(--color-gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative; /* ADDED */
    z-index: 3; /* ADDED: Ensure numbers are on top */
}

.stage-label {
    font-size: 12px;
    color: #666;
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
}

/* Stage states */
.stage-indicator.active .stage-number {
    background-color: var(--color-primary);
    color: white;
}

.stage-indicator.completed .stage-number {
    background-color: var(--color-success);
    color: white;
}

.stage-indicator.loading .stage-number {
    background-color: var(--color-gray-300);
    color: var(--color-gray-600);
    animation: pulse 1.5s infinite;
}

.stage-indicators.progress-1::before {
    background: linear-gradient(to right, var(--color-success) 0%, var(--color-success) 20%, var(--color-gray-300) 20%, var(--color-gray-300) 100%);
}

.stage-indicators.progress-2::before {
    background: linear-gradient(to right, var(--color-success) 0%, var(--color-success) 40%, var(--color-gray-300) 40%, var(--color-gray-300) 100%);
}

.stage-indicators.progress-3::before {
    background: linear-gradient(to right, var(--color-success) 0%, var(--color-success) 60%, var(--color-gray-300) 60%, var(--color-gray-300) 100%);
}

.stage-indicators.progress-4::before {
    background: linear-gradient(to right, var(--color-success) 0%, var(--color-success) 80%, var(--color-gray-300) 80%, var(--color-gray-300) 100%);
}

.stage-indicators.progress-5::before {
    background: linear-gradient(to right, var(--color-success) 0%, var(--color-success) 100%);
}

.stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    background: #f8f9fa;
    padding: 0.5rem;
    border-radius: 8px;
}

.stage-number {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.stage.active .stage-number {
    background: #007bff;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0,123,255,0.3);
}

.stage.completed .stage-number {
    background: #28a745;
    color: white;
    box-shadow: 0 2px 8px rgba(40,167,69,0.3);
}

.stage.completed .stage-number::before {
    content: '✓';
    font-size: 1.2rem;
}

.stage-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    text-align: center;
    min-width: 60px;
}

.stage.active .stage-label {
    color: #007bff;
}

.stage.completed .stage-label {
    color: #28a745;
}

/* Stage Content */
.formatted-content {
    padding: 1.5rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: #fff;
    font-family: 'Calibri', 'Segoe UI', 'Arial', sans-serif;
    line-height: 1.6;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.formatted-content h1, 
.formatted-content h2, 
.formatted-content h3, 
.formatted-content h4 {
    color: #2c3e50;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.formatted-content h1 { 
    font-size: 1.6rem; 
    border-bottom: 2px solid #005a9c;
    padding-bottom: 0.5rem;
}

.formatted-content h2 { 
    font-size: 1.4rem; 
    color: #005a9c;
}

.formatted-content h3 { 
    font-size: 1.2rem; 
}

.formatted-content h4 { 
    font-size: 1.1rem; 
}

.formatted-content p {
    margin-bottom: 1rem;
    text-align: justify;
}

.formatted-content ul, 
.formatted-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.formatted-content li {
    margin-bottom: 0.5rem;
}

.formatted-content strong {
    color: #2c3e50;
    font-weight: 600;
}

.formatted-content em {
    color: #495057;
}

/* Refinement Presets */
#refinement-presets {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

#refinement-presets label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.75rem;
}

.preset-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #495057;
}

.preset-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.preset-btn:active {
    transform: translateY(0);
}

/* Legacy knowledge base styles removed - now using unified design system */

/* Knowledge Selection Modal - styles moved to modals.css */

/* Stage Actions */
#stage-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-top: 1px solid #e9ecef;
    position: relative;
    z-index: 10;
    margin-top: 3rem;
    clear: both;
}

#stage-actions .btn {
    min-width: 140px;
    font-weight: 500;
}

.btn-stage-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}

.btn-stage-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.4);
}

.btn-stage-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(40,167,69,0.3);
}

.btn-stage-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40,167,69,0.4);
}

/* Loading Animation for Stages */
.stage-loading {
    position: relative;
    overflow: hidden;
}

.stage-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .stage-indicator {
        padding: 0 10px;
    }
    
    .stage-indicator::before {
        left: 30px;
        right: 30px;
    }
    
    .stage-number {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .stage-label {
        font-size: 0.75rem;
        min-width: 50px;
    }
    
    .preset-buttons {
        justify-content: center;
    }
    
    #stage-actions {
        flex-direction: column;
    }
    
    #stage-actions .btn {
        min-width: auto;
        width: 100%;
    }
    
    .formatted-content {
        max-height: 300px;
        padding: 1rem;
    }
}

/* Spinner and Utility Classes for Loading States */
.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

.text-center { text-align: center; }
.text-info { color: #17a2b8; }

/* Modal Display and Styling Fix */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

/* Ensure visible modals override the base display: none */
.modal.is-visible {
    display: block !important;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: none;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h2 {
    margin: 0;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 15px;
    right: 20px;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
}

/* Auth Modal Styles - Removed duplicate styles, using _auth.css instead */

/* Knowledge Base Styles */
.knowledge-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border-bottom: 1px solid #e9ecef;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: #6c757d;
    font-size: 0.9rem;
}

.stat-value {
    font-weight: 600;
    color: #495057;
}

.knowledge-memory {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.knowledge-memory h5 {
    margin: 0 0 0.5rem 0;
    color: #495057;
}

.memory-content {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #6c757d;
}

.knowledge-doc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    background: white;
}

.doc-name {
    font-weight: 500;
    color: #495057;
}

.doc-details {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #6c757d;
}

.doc-type {
    text-transform: uppercase;
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.empty-state p {
    margin: 0.5rem 0;
}

/* Modal scroll lock */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

.content-hidden {
    display: none;
}

/* Status Message Styles */
.status-message {
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.status-message.loading {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

.status-message.success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.status-message.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* Loading Container */
.loading-container {
    text-align: center;
    padding: 1rem;
}

/* RFP Item Styles */
.rfp-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.rfp-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.rfp-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rfp-main-info {
    flex: 1;
}

.rfp-name-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rfp-name {
    font-weight: 500;
    color: #333;
}

.rfp-details {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
}

.rfp-actions {
    display: flex;
    gap: 0.5rem;
}

.action-icon {
    padding: 0.5rem;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
}

/*
 * Scoped override for "Analyze" and "Generate" buttons in the main RFP list.
 * This uses a more specific selector and !important to ensure it overrides base styles.
 */

/* 1. Fix the layout of the container column */
#unanalyzed-tab .rfp-col-actions {
    justify-content: flex-start !important; /* Align buttons to the left */
    gap: 0.75rem !important;                /* Add a consistent space between them */
}

/* 2. Style the buttons as text links */
#unanalyzed-tab .rfp-col-actions .btn-sm {
    background: none !important;
    border: none !important;
    padding: 0 !important; /* Remove all padding */
    font-weight: 500 !important;
    letter-spacing: normal !important;
}

#unanalyzed-tab .rfp-col-actions .btn-secondary {
    color: #6c757d !important;
}

#unanalyzed-tab .rfp-col-actions .btn-primary {
    color: #007bff !important;
}

#unanalyzed-tab .rfp-col-actions .btn-sm:hover {
    background-color: transparent !important;
    text-decoration: underline !important;
}
 

 

.action-icon:hover {
    background: transparent;
    color: #333;
}

/* Proposal Item Styles */
.proposal-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.proposal-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.proposal-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.proposal-main-info {
    flex: 1;
}

.proposal-name-container {
    display: flex;
    flex-direction: column;
}

.proposal-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.25rem;
}

.proposal-details {
    font-size: 0.85rem;
    color: #666;
}

.proposal-actions {
    display: flex;
    gap: 0.5rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.85rem;
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* Actions Container */
.actions-container {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 1rem;
}

/* Fix Modal Z-Index Issues */
#settings-modal-proposal {
    z-index: 1000;
}

/* Knowledge modal z-index moved to modals.css */

#file-selection-modal-dynamic {
    z-index: 2000 !important; /* Above everything */
}

/* Fix Close Button */
.modal .close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    z-index: 10;
}

.modal .close:hover,
.modal .close:focus {
    color: #000;
    text-decoration: none;
}

/* Folder Group Styling */
.folder-group {
    margin-bottom: 1rem;
}

.folder-header {
    font-weight: bold;
    color: #005a9c;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0.25rem;
}

.folder-files {
    margin-left: 1rem;
}

.file-item {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-item:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
}

.file-item input[type="checkbox"]:checked + i + span {
    font-weight: bold;
    color: #007bff;
}

.knowledge-folder-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

#file-selection-modal-dynamic .folder-item:hover {
    background-color: #e9ecef !important;
}

/* Knowledge modal sizing moved to modals.css */

/* Knowledge modal sizing and items moved to modals.css */

.knowledge-file-item:hover,
.knowledge-folder-item:hover {
    background-color: #f8f9fa !important;
    border-color: #007bff !important;
}

/* Fix selected files summary */
#knowledge-selected-files-summary {
    flex-shrink: 0;
    max-height: 100px;
    overflow-y: auto;
}

/* ===========================
   PROPOSAL-SPECIFIC BUTTON STYLES
   Using proper specificity instead of !important
   =========================== */

/* Proposal generator specific button overrides */
#proposal-generator-main-content .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    min-width: auto;
    height: auto;
    line-height: 1.4;
    border-radius: 6px;
    transition: all 0.2s ease;
}

/* Stage action buttons */
#stage-actions .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    min-width: 120px;
    margin: 0.25rem;
    font-weight: 500;
}

/* Modal-specific button styles */
#settings-modal-proposal .btn,
#chat-modal-proposal .btn,
/* Knowledge modal buttons moved to modals.css */
#file-selection-modal-dynamic .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    min-width: auto;
}

/* These styles are now handled in the consolidated section above */

/* Generate proposal button specific styling */
#generate-proposal-ai-button {
    padding: 0.75rem 1.5rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    min-width: auto !important;
    max-width: 100% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Duplicate rule removed - handled in consolidated section */

/* Preset buttons in refinement section */
.preset-btn {
    padding: 0.4rem 0.8rem !important;
    font-size: 0.85rem !important;
    min-width: auto !important;
    white-space: nowrap !important;
}

/* Knowledge modal button styling moved to modals.css */

/* File selection modal buttons (these should stay compact) */
#file-selection-modal-dynamic .btn {
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
    min-width: auto !important;
}

#confirm-files-btn {
    min-width: 140px !important;
    padding: 0.6rem 1rem !important;
}

/* Tab buttons */
.proposal-tab-button {
    padding: 0.6rem 1.2rem !important;
    font-size: 0.95rem !important;
    min-width: auto !important;
}

.settings-tab-button {
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
    min-width: auto !important;
}

/* Action icon buttons */
.action-icon {
    padding: 0.5rem !important;
    font-size: 0.9rem !important;
    min-width: auto !important;
    width: auto !important;
    height: auto !important;
    border-radius: 4px !important;
}

/* Form buttons */
.form-group .btn {
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
    min-width: auto !important;
}

/* Auth modal buttons */
.auth-modal-content .btn {
    padding: 0.6rem 1.5rem !important;
    font-size: 0.95rem !important;
    min-width: auto !important;
    width: 100% !important;
}

/* Override any inherited large button styles from style.css */
button:not(.action-icon):not(.close):not(.chat-toggle-btn) {
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
    min-width: auto !important;
    max-width: 100% !important;
}

/* Responsive button adjustments */
/* ===========================
   RESPONSIVE BUTTON STYLES
   Consolidated mobile overrides
   =========================== */
@media (max-width: 768px) {
    #proposal-generator-main-content .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    #generate-proposal-ai-button {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    #stage-actions .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        min-width: 100px;
        width: 100%;
        margin: 0.2rem 0;
    }
    
    .preset-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
}

/* ===========================
   ADDITIONAL BUTTON CONTAINER STYLES
   =========================== */

/* Button container and group styles */
.btn-group .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.actions-container .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
}

/* Stage indicator buttons */
.stage-indicator .btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

/* Loading and status buttons */
.loading-container .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* ===========================
   BUTTON INTERACTION STATES
   =========================== */

/* Hover states for specific containers */
#proposal-generator-main-content .btn:hover,
#stage-actions .btn:hover,
.modal .btn:hover,
.btn-group .btn:hover,
.actions-container .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Active states */
#proposal-generator-main-content .btn:active,
#stage-actions .btn:active,
.modal .btn:active,
.btn-group .btn:active,
.actions-container .btn:active {
    transform: translateY(0);
}

/* Disabled states */
#proposal-generator-main-content .btn:disabled,
#stage-actions .btn:disabled,
.modal .btn:disabled,
.btn-group .btn:disabled,
.actions-container .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}


.knowledge-doc-item {
    display: flex;
    justify-content: space-between; /* Pushes name to the left and button to the right */
    align-items: center;          /* Vertically aligns them */
    gap: 1rem;                    /* Adds some space between the items */
}

/* Allow the document name to take available space and truncate if it's too long */
.knowledge-doc-item span {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0; /* Important for flexbox to allow shrinking */
}

/* Make the delete button smaller and prevent it from shrinking or growing */
.knowledge-doc-item .btn.btn-danger {
    flex-shrink: 0; /* Prevents the button from shrinking */
    padding: 0.25rem 0.6rem; /* Make the button more compact */
    font-size: 0.8rem;     /* Smaller text on the button */
    line-height: 1.2;    /* Adjust line height for the smaller font */
}


/* ===========================
   DYNAMIC COMPONENT STYLES
   Styles for JavaScript-generated content
   =========================== */

/* Stage loading components */
.stage-loading {
    text-align: center;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 1rem 0;
}

.stage-loading h3 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.spinner-border {
    width: 2rem;
    height: 2rem;
    border: 0.25rem solid #f3f3f3;
    border-top: 0.25rem solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    text-align: left;
}

.current-message {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.loading-subtext {
    color: #666;
    font-size: 0.9rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #28a745);
    transition: width 0.3s ease;
}

/* Stage result components */
.stage-result {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stage-result h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.result-summary {
    margin-bottom: 1.5rem;
}

.result-summary h4 {
    color: #555;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.summary-content {
    color: #666;
    line-height: 1.6;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
}

/* Analysis result specific styles */
.analysis-result {
    border-left: 4px solid #007bff;
}

/* Generation success components */
.generation-success,
.stage-success {
    text-align: center;
    padding: 2rem;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    color: #155724;
    margin: 1rem 0;
}

.generation-success .success-icon,
.stage-success .success-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.generation-success h3,
.stage-success h3 {
    color: #155724;
    margin-bottom: 1rem;
}

.success-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* Error components */
.stage-error {
    text-align: center;
    padding: 2rem;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
    margin: 1rem 0;
}

.stage-error .error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.stage-error h3 {
    color: #721c24;
    margin-bottom: 1rem;
}

.error-message {
    color: #721c24;
    margin-bottom: 1rem;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* File tree components */
.file-tree-item {
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.25rem;
    transition: background-color 0.2s ease;
}

.file-tree-item:hover {
    background-color: #f8f9fa;
}

.file-tree-item.selected {
    background-color: #e3f2fd;
    border: 1px solid #2196f3;
}

.loading-indicator-small {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
}

.error-message-small {
    color: #dc3545;
    font-size: 0.9rem;
    padding: 0.5rem;
    background: #f8d7da;
    border-radius: 4px;
}

/* ===========================
   UTILITY CLASSES FOR STATE MANAGEMENT
   Replaces inline styles with proper CSS classes
   =========================== */

/* Display state classes */
.is-hidden {
    display: none !important;
}

.is-visible {
    display: block !important;
}

.is-flex {
    display: flex;
}

.is-inline-block {
    display: inline-block;
}

/* Layout utility classes */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.text-center {
    text-align: center;
}

.text-italic {
    font-style: italic;
}

.text-right {
    text-align: right;
}

.margin-right-half {
    margin-right: 0.5rem;
}

.margin-top-1 {
    margin-top: 1rem;
}

.margin-bottom-1 {
    margin-bottom: 1rem;
}

.margin-top-half {
    margin-top: 0.5rem;
}

.margin-bottom-half {
    margin-bottom: 0.5rem;
}

.margin-bottom-1-half {
    margin-bottom: 1.5rem;
}

.margin-top-1-half {
    margin-top: 1.5rem;
}

.border-top-gray {
    border-top: 1px solid #e0e0e0;
}

.padding-top-1 {
    padding-top: 1rem;
}

.padding-right-small {
    padding-right: 10px;
}

.max-height-200 {
    max-height: 200px;
}

.overflow-y-auto {
    overflow-y: auto;
}

.padding-1 {
    padding: 1rem;
}

.color-red {
    color: red;
}

.color-green {
    color: green;
}

.text-muted {
    color: #666;
}

.small-text {
    font-size: 0.9rem;
}

.width-full {
    width: 100%;
}

.height-full {
    height: 100%;
}

/* Content state classes */
.content-hidden {
    display: none;
}

.content-visible {
    display: block;
}

/* Authentication modal */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-bg-overlay);
    z-index: var(--z-modal-high);
    padding: var(--space-md);
}

.auth-modal-overlay.is-hidden {
    display: none !important;
}

.auth-modal-overlay.is-visible,
.auth-modal-overlay.active {
    display: flex !important;
}

.auth-modal-content {
    background-color: var(--color-bg-surface);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 1px solid var(--color-border-accent);
    transform: translateY(-10px);
    opacity: 0;
    transition: all var(--transition-smooth);
}

.auth-modal-overlay.is-visible .auth-modal-content,
.auth-modal-overlay.active .auth-modal-content {
    transform: translateY(0);
    opacity: 1;
}

.auth-modal-content h2 {
    color: var(--color-brand-navy);
    margin-bottom: var(--space-md);
    font-size: var(--text-xl);
}

.auth-modal-content .auth-content p {
    margin-bottom: var(--space-md);
    color: var(--color-text-secondary);
}

/* Loading states */
.loading-container.is-hidden {
    display: none;
}

.loading-container.is-visible {
    display: block;
    margin-top: 1rem;
}

/* ===========================
   PROPOSAL-SPECIFIC MODAL STYLES
   Resolves conflicts with base modal styles
   =========================== */

/* Proposal-specific modal content sizing */
.proposal-modal-content {
    width: 90%;
    max-width: 1200px;
}

/* Chat modal content for proposal refinement */
.proposal-chat-modal-content {
    max-width: 1500px;
}

/* Settings modal content for proposal system */
#settings-modal-proposal .modal-content {
    max-width: 1000px;
}
/* Knowledge modal content moved to modals.css */

/* Requirements and compliance modal content */
.requirements-modal,
.compliance-results-modal {
    max-width: var(--modal-size-lg); /* Use unified modal sizing */
    width: 90%;
}

/* Knowledge modal content - using unified modal system */
.knowledge-modal-content {
    max-width: var(--modal-size-lg); /* Use large size like unified system */
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Knowledge summary card */
.knowledge-summary-card {
    margin: 1rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
}

/* File selection modal */
.file-selection-modal {
    z-index: 2000;
}

.file-selection-modal-content {
    max-width: var(--modal-size-md); /* Use unified modal sizing */
    width: 85%;
    max-height: 80vh;
    overflow-y: hidden; /* Remove outer scroll - let inner file list handle scrolling */
}

.file-selection-list {
    flex: 1; /* Take available space but not more than needed */
    min-height: 200px; /* Minimum height for usability */
    max-height: calc(60vh - 120px); /* Constrain height to leave room for buttons */
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem; /* Space before buttons */
}

/* Button container should stay at bottom */
#file-selection-modal-dynamic .margin-top-1.text-right {
    flex-shrink: 0; /* Don't shrink buttons */
    margin-top: 0; /* Remove top margin since we have margin-bottom on list */
    margin-bottom: 1rem; /* Add margin at bottom of modal */
    padding: 1rem 0; /* Vertical padding for button area */
    border-top: 1px solid #e9ecef; /* Visual separator */
    min-height: 60px; /* Reserve minimum space for buttons */
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Feedback modal */
.feedback-modal {
    z-index: 2000;
}

.feedback-modal-content {
    max-width: 500px;
}

/* This rule specifically targets the new delete icon button inside the
   knowledge base list. On hover, it gives it a light red background
   and makes the trash can icon itself turn a strong red color. */
.knowledge-doc-item .action-icon:hover {
    background-color: #ffebee; /* A very light red */
    color: #dc3545;            /* Standard danger/delete red color */
}

/* Full-screen overlay styles */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #f8f9fa;
    z-index: var(--z-fullscreen);
    overflow: hidden; /* Restored - this is needed for proper fullscreen containment */
}

.fullscreen-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.fullscreen-header {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.back-button {
    background: none;
    border: none;
    font-size: 16px;
    color: #0066cc;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-button:hover {
    background-color: #f0f8ff;
}

.proposal-info-header {
    background-color: #f8f9fa;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 14px;
    color: #666;
    border: 1px solid #e0e0e0;
    flex: 1;
}

.fullscreen-body {
    flex: 1;
    overflow-y: auto; /* Provides necessary scrolling */
    padding: 20px;
    background-color: #f8f9fa;
    min-height: 0; /* Important for flex child to shrink */
}

/* Stage output area */
.stage-output {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    min-height: 200px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    /* Ensure content can expand fully */
    height: auto;
    overflow: visible;
}

/* Chat interface styles for full-screen */
.chat-conversation {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chat-form {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.refinement-presets {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.chat-form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 15px;
}

/* Loading animation */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .fullscreen-header {
        padding: 10px 15px;
    }
    
    .fullscreen-body {
        padding: 15px;
    }
    
    .refinement-presets {
        justify-content: center;
    }
}

body.modal-open {
    overflow: hidden;
    height: 100vh;
}

/* Responsive adjustments - updated */
@media (max-width: 768px) {
    .fullscreen-header {
        padding: 10px 15px;
    }
    
    .fullscreen-body {
        padding: 15px;
    }
    
    .stage-indicators {
        flex-direction: row; /* Keep horizontal even on mobile */
        justify-content: space-around;
        gap: 5px;
    }
    
    .stage-indicators::before {
        left: 20px;
        right: 20px;
    }
    
    .stage-number {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .stage-label {
        font-size: 10px;
    }
    
    .refinement-presets {
        justify-content: center;
    }
}


/* =================================================================== */
/* == STYLES FOR NEW PROPOSAL GENERATOR FEATURES (APPEND TO FILE)   == */
/* =================================================================== */


/* --- 1. Knowledge Base Document List & Action Icon Fixes --- */

/* Uses Flexbox to properly align items on the same line */
.knowledge-doc-item {
    display: flex;
    justify-content: space-between; /* Pushes items to opposite ends */
    align-items: center;          /* Vertically aligns them */
    gap: 1rem;                    /* Adds space between name and button */
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0; /* Adds a subtle separator */
}

.knowledge-doc-item:last-child {
    border-bottom: none;
}

/* Allows the document name to take available space and truncate if too long */
.knowledge-doc-item span {
    flex-grow: 1;                 /* Allows the span to grow and fill space */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;                 /* Critical for flexbox to allow shrinking */
    font-size: 0.9rem;
    color: #333;
}

/* Keeps the delete button compact and prevents it from stretching */
.knowledge-doc-item .action-icon {
    flex-shrink: 0;               /* Prevents the button from shrinking */
    padding: 0.4rem 0.6rem;       /* Makes the button more compact */
    font-size: 0.85rem;
    line-height: 1;
}

/* Adds a specific, intuitive hover effect for the delete action */
.knowledge-doc-item .action-icon:hover {
    background-color: #ffebee;    /* A very light red */
    color: #dc3545;               /* Standard danger/delete red color */
}


/* --- 2. Compliance Matrix & Structured Analysis Table Styling --- */

.compliance-matrix-container {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.compliance-matrix-container h3,
.compliance-matrix-container h4 {
    color: #005a9c;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.5rem;
    margin-top: 0;
    margin-bottom: 1rem;
}

.compliance-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.compliance-table th,
.compliance-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.compliance-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.category-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.category-badge.technical { background-color: #e3f2fd; color: #1976d2; }
.category-badge.security { background-color: #fff3e0; color: #f57c00; }
.category-badge.functional { background-color: #e8f5e8; color: #388e3c; }
.category-badge.legal { background-color: #fce4ec; color: #c2185b; }

.criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.criteria-item {
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
}

.criteria-weight {
    font-size: 1.2rem;
    font-weight: bold;
    color: #1976d2;
    margin: 0.5rem 0;
}

.criteria-desc {
    font-size: 0.9rem;
    color: #666;
}

/* Knowledge document list styles */
.knowledge-doc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.knowledge-doc-item:last-child {
    border-bottom: none;
}

.knowledge-doc-item span {
    flex-grow: 1;
    margin-right: 1rem;
}


/* --- 3. Feedback Modal Button & Form Control Styling --- */

/* Ensure form controls in the new feedback modal are styled correctly */
#feedback-modal .form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

#feedback-modal .form-control:focus {
    outline: none;
    border-color: #007bff;
}

/* Style the action buttons at the bottom of the feedback modal */
#feedback-modal .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}
/* R
equirements Modal Styles */
.requirements-modal {
    background: white;
    border-radius: 8px;
    max-width: 900px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.requirements-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.requirements-modal .modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.25rem;
}

.requirements-modal .close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.requirements-modal .close-modal:hover {
    color: #333;
}

.requirements-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.requirements-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.requirement-item-full {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.requirement-item-full:hover {
    background: #f0f8ff;
    border-color: #005a9c;
}

.requirement-item-full .req-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.requirement-item-full .req-id {
    font-weight: bold;
    color: #005a9c;
    font-size: 0.9rem;
    background: #e3f2fd;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.requirement-item-full .req-category {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.requirement-item-full .req-category.general {
    background: #e9ecef;
    color: #495057;
}

.requirement-item-full .req-category.technical {
    background: #e3f2fd;
    color: #1565c0;
}

.requirement-item-full .req-category.compliance {
    background: #fff3e0;
    color: #ef6c00;
}

.requirement-item-full .req-category.legal {
    background: #fce4ec;
    color: #c2185b;
}

.requirement-item-full .req-text {
    color: #333;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.requirement-item-full .req-notes {
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
    background: #fff;
    padding: 0.5rem;
    border-radius: 4px;
    border-left: 3px solid #005a9c;
}

/* Responsive design for requirements modal */
@media (max-width: 768px) {
    .requirements-modal {
        max-width: 95vw;
        max-height: 90vh;
    }
    
    .requirement-item-full .req-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .requirements-modal .modal-header {
        padding: 1rem;
    }
    
    .requirements-modal .modal-body {
        padding: 0.75rem;
    }
}

/* No data message styling */
.no-data-message {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.no-data-message p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.no-data-message ul {
    text-align: left;
    max-width: 400px;
    margin: 1rem auto;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #007bff;
}

.no-data-message li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* Enhanced error message styling */
.stage-error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    margin: 1rem 0;
}

.stage-error .error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.stage-error h3 {
    color: #c53030;
    margin-bottom: 1rem;
}

.stage-error .error-details {
    color: #744d47;
    font-style: italic;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #fed7d7;
    border-radius: 4px;
    font-size: 0.9rem;
}

.stage-error .error-guidance {
    color: #2d3748;
    background: #e2e8f0;
    padding: 1rem;
    border-radius: 4px;
    border-left: 4px solid #4299e1;
    margin-bottom: 1rem;
    text-align: left;
}

.stage-error .error-guidance strong {
    color: #2b6cb0;
}

/* Success message styling */
.stage-success {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    margin: 1rem 0;
}

.stage-success .success-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.stage-success h3 {
    color: #276749;
    margin-bottom: 1rem;
}

.stage-success p {
    color: #2f855a;
}

/* Compliance Results Modal Styling */
.compliance-results-modal,
.compliance-mapping-modal {
    background: var(--color-bg-surface);
    border-radius: var(--radius-lg);
    max-width: var(--modal-size-lg);
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: var(--z-modal-over-fullscreen); /* Z-index to appear above fullscreen modals */
    position: fixed;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-gray-200);
}

.compliance-results-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xl);
    border-bottom: 1px solid var(--color-gray-200);
    background: var(--color-gray-50);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.compliance-results-modal .modal-header h3 {
    margin: 0;
    color: var(--color-brand-navy);
    font-size: var(--text-xl);
    font-weight: var(--font-weight-semibold);
}

.compliance-results-modal .close-modal {
    background: none;
    border: none;
    font-size: var(--text-xl);
    color: var(--color-gray-500);
    cursor: pointer;
    padding: var(--space-xs);
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compliance-results-modal .close-modal:hover {
    color: var(--color-gray-900);
    background-color: var(--color-gray-200);
    transform: scale(1.1);
}

.compliance-results-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-xl);
    background: var(--color-bg-surface);
    color: var(--color-text-primary);
    line-height: var(--line-height-normal);
}

.compliance-score {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    margin: 0 auto;
}

.score-circle.good {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
}

.score-circle.warning {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    color: white;
}

.score-circle.poor {
    background: linear-gradient(135deg, #f56565, #e53e3e);
    color: white;
}

.score-number {
    font-size: 2rem;
    font-weight: bold;
    line-height: 1;
}

.score-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.compliance-checks {
    margin-bottom: 2rem;
}

.compliance-checks h4 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.1rem;
}

.check-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.check-item.pass {
    background: #f0fff4;
    border-color: #9ae6b4;
}

.check-item.warning {
    background: #fffbf0;
    border-color: #fbd38d;
}

.check-item.fail {
    background: #fff5f5;
    border-color: #fed7d7;
}

.check-icon {
    font-size: 1.2rem;
    margin-right: 0.75rem;
    margin-top: 0.1rem;
    min-width: 1.5rem;
}

.check-item.pass .check-icon {
    color: #38a169;
}

.check-item.warning .check-icon {
    color: #dd6b20;
}

.check-item.fail .check-icon {
    color: #e53e3e;
}

.check-details {
    flex: 1;
}

.check-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.check-description {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
}

.compliance-recommendations {
    border-top: 1px solid #e0e0e0;
    padding-top: 1.5rem;
}

.compliance-recommendations h4 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.1rem;
}

.compliance-recommendations ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.compliance-recommendations li {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #007bff;
    color: #333;
    line-height: 1.4;
}

.compliance-recommendations li:before {
    content: "💡";
    margin-right: 0.5rem;
}

/* Responsive design for compliance modal */
@media (max-width: 768px) {
    .compliance-results-modal {
        max-width: 95vw;
        max-height: 90vh;
    }
    
    .compliance-results-modal .modal-body {
        padding: 1rem;
    }
    
    .score-circle {
        width: 100px;
        height: 100px;
    }
    
    .score-number {
        font-size: 1.5rem;
    }
    
    .check-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .check-icon {
        margin-bottom: 0.5rem;
    }
}

/* ===========================
   ACCESSIBILITY IMPROVEMENTS
   =========================== */

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Accessible focus trap styling */
.modal-content[tabindex="-1"]:focus {
    outline: none;
}

/* Enhanced modal animations */
.modal.is-hidden {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal:not(.is-hidden) {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal .modal-content {
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal:not(.is-hidden) .modal-content {
    transform: scale(1);
}

/* Enhanced close button accessibility */
.modal .close {
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

.modal .close:hover {
    background-color: #f5f5f5;
}

.modal .close:focus {
    outline: 2px solid #005a9c;
    outline-offset: 2px;
    background-color: #f5f5f5;
}

/* ===========================
   MICRO-INTERACTIONS & ANIMATIONS
   =========================== */

/* Enhanced button animations */
#proposal-generator-main-content .btn {
    transition: all 0.3s ease;
    transform: translateY(0);
}

#proposal-generator-main-content .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#proposal-generator-main-content .btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Stage indicator animations */
.stage-indicator {
    transition: all 0.3s ease;
}

.stage-indicator:hover {
    transform: scale(1.05);
}

.stage-indicator.active .stage-number {
    animation: pulseGlow 2s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 5px rgba(0, 90, 156, 0.5);
    }
    100% {
        box-shadow: 0 0 20px rgba(0, 90, 156, 0.8);
    }
}

/* Loading spinner animation */
.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fade in animations for dynamic content */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Slide in animations for modals */
.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Hover effects for interactive elements */
.sortable-header:hover {
    background-color: #f8f9fa;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.analyzed-rfp-item:hover {
    background-color: #f8f9fa;
    transition: background-color 0.2s ease;
}

/* Focus indicators for accessibility */
.btn:focus,
.form-control:focus,
.refinement-option:focus,
.strategy-tab:focus {
    outline: 2px solid #005a9c;
    outline-offset: 2px;
}

/* Smooth transitions for all interactive elements */
.refinement-option,
.strategy-tab,
.voice-option,
.check-option {
    transition: all 0.2s ease;
}

.refinement-option:hover,
.strategy-tab:hover,
.voice-option:hover,
.check-option:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Pulse animation for processing states */
.processing-indicator {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Smooth show/hide transitions */
.fade-out {
    animation: fadeOut 0.3s ease-in-out;
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* Interactive element scaling */
.interactive-scale:hover {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}

.interactive-scale:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Tab navigation improvements */
.proposal-tab-button {
    transition: all 0.2s ease;
}

.proposal-tab-button:hover {
    background-color: #f8f9fa;
    transform: translateY(-1px);
}

.proposal-tab-button.active {
    transform: translateY(0);
}

/* Form Control Base Styles */
.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    border-color: #005a9c;
    box-shadow: 0 0 0 0.2rem rgba(0, 90, 156, 0.25);
    outline: 0;
}

.form-control:disabled,
.form-control[readonly] {
    background-color: #e9ecef;
    opacity: 1;
}

/* Improved loading states */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #005a9c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Enhanced success and error states */
.success-message {
    animation: slideInSuccess 0.5s ease-out;
}

.error-message {
    animation: slideInError 0.5s ease-out;
}

@keyframes slideInSuccess {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInError {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}/* Comp
liance Check Results Styles */
.compliance-loading {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    color: #666;
}

.compliance-loading .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-left-color: #005a9c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.compliance-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 6px;
    color: #c62828;
}

.compliance-result {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.compliance-result.success {
    border-left: 4px solid #28a745;
}

.compliance-result.warning {
    border-left: 4px solid #ffc107;
}

.compliance-result.error {
    border-left: 4px solid #dc3545;
}

.compliance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.compliance-header h5 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
}

.compliance-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.score-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #005a9c;
}

.score-label {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.compliance-summary {
    padding: 1rem;
}

.compliance-summary p {
    margin: 0;
    color: #555;
    line-height: 1.5;
}

.compliance-issues {
    padding: 0 1rem 1rem 1rem;
}

.compliance-issues h6 {
    margin: 0 0 0.5rem 0;
    color: #dc3545;
    font-size: 0.9rem;
    font-weight: 600;
}

.compliance-issues ul {
    margin: 0;
    padding-left: 1.5rem;
    color: #666;
}

.compliance-issues li {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

/* Success state colors */
.compliance-result.success .score-value {
    color: #28a745;
}

.compliance-result.success .compliance-header {
    background: #f8fff9;
}

/* Warning state colors */
.compliance-result.warning .score-value {
    color: #ffc107;
}

.compliance-result.warning .compliance-header {
    background: #fffbf0;
}

/* Error state colors */
.compliance-result.error .score-value {
    color: #dc3545;
}

.compliance-result.error .compliance-header {
    background: #fff5f5;
}

/* ===========================
   STAGE 4 QUALITY ASSURANCE STYLES
   =========================== */

/* Quality Result Component - Unified with other stages */
.quality-result {
    border-left: 4px solid #007bff;
}

.quality-result.success {
    border-left-color: #28a745;
}

.quality-result.warning {
    border-left-color: #ffc107;
}

.quality-result.danger {
    border-left-color: #dc3545;
}

/* Quality Summary Section */
.quality-summary {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.quality-stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1rem;
}

.quality-stat {
    text-align: center;
    padding: 1rem;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex: 1;
    min-width: 120px;
}

.quality-stat .stat-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quality-stat .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

/* Status-specific colors */
.quality-stat.status-success .stat-value {
    color: #28a745;
}

.quality-stat.status-warning .stat-value {
    color: #ffc107;
}

.quality-stat.status-danger .stat-value {
    color: #dc3545;
}

/* Scores Grid Layout */
.scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.score-item {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.score-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-value {
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
    color: #007bff;
}

/* Reviewer Brief Section */
.reviewer-brief {
    margin-bottom: 1.5rem;
}

.reviewer-brief h4 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.brief-content {
    color: #666;
    line-height: 1.6;
}

/* Quality Alerts */
.quality-alert {
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid;
    margin-top: 1.5rem;
}

.quality-alert.alert-warning {
    background: #fff3cd;
    border-left-color: #ffc107;
    color: #856404;
}

.quality-alert.alert-success {
    background: #d4edda;
    border-left-color: #28a745;
    color: #155724;
}

/* Quality Detailed Scores */
.detailed-scores {
    margin-top: 1.5rem;
}

.detailed-scores .score-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 1rem;
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.detailed-scores .score-label {
    min-width: 120px;
    font-weight: 500;
    color: #333;
    font-size: 0.95rem;
}

.score-bar {
    flex: 1;
    background: #e9ecef;
    height: 20px;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #ffc107 50%, #dc3545 100%);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.score-text {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    font-size: 0.85rem;
    font-weight: 500;
    color: #333;
}

/* Reviewer Brief - Enhanced */
.reviewer-brief {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.reviewer-brief h4 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.brief-content {
    color: #212021;
    line-height: 1.5;
    font-size: 1rem;
}

.brief-content h3 {
    color: #333;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.brief-content h4 {
    color: #666;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

/* Responsive Design for Stage 4 Quality Components */
@media (max-width: 768px) {
    .quality-stats {
        flex-direction: column;
        align-items: stretch;
    }
    
    .quality-stat {
        min-width: auto;
        margin-bottom: 1rem;
    }
    
    .scores-grid {
        grid-template-columns: 1fr;
    }
    
    .detailed-scores .score-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .detailed-scores .score-label {
        min-width: auto;
        margin-bottom: 0.5rem;
    }
    
    .score-bar {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .quality-summary {
        padding: 1rem;
    }
    
    .reviewer-brief {
        padding: 1rem;
    }
    
    .quality-stat .stat-value {
        font-size: 1.25rem;
    }
}

.brief-content h5 {
    color: #777;
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
}

.action-required {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}

.action-required h4 {
    color: #856404;
    margin-bottom: 0.5rem;
}

.ready-to-finalize {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}

.ready-to-finalize h4 {
    color: #155724;
    margin-bottom: 0.5rem;
}

/* ===========================
   STAGE 5 HITL INTERFACE STYLES
   =========================== */

.hitl-interface {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.hitl-header-title {
    flex: 1;
    text-align: center;
}

.hitl-header-title h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.hitl-subtitle {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.25rem;
}

.hitl-header-actions {
    display: flex;
    gap: 0.5rem;
}

.hitl-body {
    display: flex;
    flex: 1;
    overflow: visible;
}

.hitl-sidebar {
    width: 350px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    overflow: hidden;
}

.hitl-sidebar.collapsed {
    width: 50px;
}

.hitl-sidebar.collapsed .sidebar-header h3,
.hitl-sidebar.collapsed .qa-checklist,
.hitl-sidebar.collapsed .sidebar-footer {
    display: none;
}

.hitl-sidebar.collapsed .sidebar-header {
    padding: 0.5rem;
    justify-content: center;
}

.hitl-sidebar.collapsed #toggle-sidebar {
    margin: 0;
}

.sidebar-header {
    padding: 1rem;
    background: white;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
}

.qa-checklist {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.qa-scores {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.qa-scores h5 {
    margin: 0 0 0.75rem 0;
    color: #495057;
    font-size: 0.9rem;
    font-weight: 600;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.85rem;
}

.score-item:last-child {
    margin-bottom: 0;
}

.score-value {
    font-weight: 600;
    color: #007bff;
}

.qa-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.qa-item.compliant {
    border-left: 4px solid #28a745;
    background: #f8fff9;
}

.qa-item.non-compliant {
    border-left: 4px solid #dc3545;
    background: #fff8f8;
}

.qa-item label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0;
    cursor: pointer;
    font-size: 0.9rem;
}

.qa-item input[type="checkbox"] {
    margin-top: 0.1rem;
    cursor: pointer;
}

.qa-item-text {
    flex: 1;
    line-height: 1.4;
}

.qa-suggestion {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #856404;
    font-style: italic;
}

.checklist-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checklist-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0,123,255,0.1);
}

.checklist-item.completed {
    background: #f8fff9;
    border-color: #28a745;
}

.checklist-item.completed .item-title {
    text-decoration: line-through;
    color: #6c757d;
}

.item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.item-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.item-title {
    font-weight: 500;
    flex: 1;
}

.item-priority {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    background: #e9ecef;
    color: #6c757d;
}

.item-priority.high {
    background: #f8d7da;
    color: #721c24;
}

.item-priority.medium {
    background: #fff3cd;
    color: #856404;
}

.item-description {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

.sidebar-footer {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e9ecef;
}

.progress-summary {
    text-align: center;
}

.progress-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #28a745;
    transition: width 0.3s ease;
}

.hitl-editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.editor-toolbar {
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.toolbar-group {
    display: flex;
    gap: 0.5rem;
}

#proposal-editor {
    flex: 1;
    min-height: 500px;
}

.editor-status {
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: #6c757d;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* HITL Modal Fixes - Remove transforms that break TinyMCE positioning */
#hitl-interface-modal.fullscreen-overlay {
    overflow: visible !important;
}

#hitl-interface-modal .fullscreen-content {
    transform: none !important;
}

/* TinyMCE Customizations - Scoped to HITL interface */
#hitl-interface-modal .tox-tinymce {
    border: 2px solid #0066cc !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 10px rgba(0, 102, 204, 0.1) !important;
}

#hitl-interface-modal .tox-editor-header {
    background-color: #f8f9fa !important;
    border-bottom: 1px solid #dee2e6 !important;
}

#hitl-interface-modal .tox-toolbar {
    background-color: #ffffff !important;
    border-bottom: 1px solid #dee2e6 !important;
    padding: 8px !important;
}

#hitl-interface-modal .tox-toolbar__group:not(:last-child) {
    border-right: 1px solid #dee2e6 !important;
}

#hitl-interface-modal .tox-tbtn {
    margin: 2px !important;
    border-radius: 4px !important;
}

#hitl-interface-modal .tox-tbtn:hover {
    background-color: #f8f9fa !important;
}

#hitl-interface-modal .tox-tbtn--enabled {
    background-color: #0066cc !important;
    color: white !important;
}

#hitl-interface-modal .tox-statusbar {
    background-color: #f8f9fa !important;
    border-top: 1px solid #dee2e6 !important;
    padding: 8px 16px !important;
    font-size: 12px !important;
    color: #6c757d !important;
}

#hitl-interface-modal .tox-edit-area {
    background-color: white !important;
}

#hitl-interface-modal .tox-edit-area__iframe {
    background-color: white !important;
}

/* Fix TinyMCE dropdown z-index to appear above modal elements */
.tox-silver-sink,
.tox-silver-sink .tox-menu {
    z-index: 10000 !important;
}

/* TinyMCE Menu Customizations */
#hitl-interface-modal .tox-menu {
    border: 1px solid #dee2e6 !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

#hitl-interface-modal .tox-collection__item {
    color: #333 !important;
}

#hitl-interface-modal .tox-collection__item--active {
    background-color: #0066cc !important;
    color: white !important;
}

/* TinyMCE Button Customizations */
#hitl-interface-modal .tox-split-button:hover {
    background-color: #f8f9fa !important;
}

#hitl-interface-modal .tox-split-button--active {
    background-color: #0066cc !important;
    color: white !important;
}

/* Knowledge Explorer Dashboard - using unified design system */

.dashboard-header {
    margin-bottom: 1rem;
}

/* Dashboard tabs now use unified button system */

.dashboard-tab-content {
    display: none;
}

.dashboard-tab-content.active {
    display: block;
}

/* Topic Cloud Styles */
.topic-cloud {
    min-height: 80px;
    padding: 1rem;
    background-color: white;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
}

.topic-tag {
    padding: 0.25rem 0.75rem;
    background-color: #e9ecef;
    border-radius: 20px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.topic-tag:hover {
    background-color: #0066cc;
    color: white;
    transform: translateY(-1px);
}

.topic-tag.high-frequency {
    font-size: 1rem;
    font-weight: 600;
    background-color: #0066cc;
    color: white;
}

.topic-tag.medium-frequency {
    font-size: 0.95rem;
    font-weight: 500;
    background-color: #17a2b8;
    color: white;
}

/* Recently Added Feed */
.recent-documents-feed {
    background-color: white;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    max-height: 150px;
    overflow-y: auto;
}

.recent-document-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.recent-document-item:hover {
    background-color: #f8f9fa;
}

.recent-document-item:last-child {
    border-bottom: none;
}

.recent-document-info {
    flex: 1;
}

.recent-document-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: #333;
}

.recent-document-date {
    font-size: 0.75rem;
    color: #6c757d;
}

/* Knowledge Stats Grid */
.knowledge-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.stat-card {
    background-color: white;
    border-radius: 4px;
    padding: 1rem;
    text-align: center;
    border: 1px solid #dee2e6;
}

/* Stat card styles moved to unified design system */

/* Status Badge Styles for Generated Proposals */
.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.draft {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-badge.generated {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.status-badge.downloaded {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Enhanced Document Table */
.document-table-controls {
    background-color: white;
    border-radius: 4px;
    padding: 1rem;
    border: 1px solid #dee2e6;
}

.search-filter-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.enhanced-documents-table {
    background-color: white;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    overflow: hidden;
}

.document-table-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 100px;
    gap: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    font-size: 0.875rem;
    color: #495057;
}

.document-table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 100px;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.document-table-row:hover {
    background-color: #f8f9fa;
}

.document-table-row:last-child {
    border-bottom: none;
}

.document-name {
    font-weight: 500;
    color: #333;
}

.document-source {
    font-size: 0.875rem;
    color: #6c757d;
}

.document-date {
    font-size: 0.875rem;
    color: #6c757d;
}

.document-chunks {
    font-size: 0.875rem;
    color: #0066cc;
    font-weight: 500;
}

.document-health {
    display: flex;
    align-items: center;
    justify-content: center;
}

.health-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #28a745;
}

.health-indicator.warning {
    background-color: #ffc107;
}

.health-indicator.error {
    background-color: #dc3545;
}

/* Topics List */
.topics-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.topic-card {
    background-color: white;
    border-radius: 4px;
    padding: 1rem;
    border: 1px solid #dee2e6;
    cursor: pointer;
    transition: all 0.2s ease;
}

.topic-card:hover {
    border-color: #0066cc;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.1);
}

.topic-card-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.topic-card-count {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dashboard-tabs {
        flex-direction: column;
    }
    
    .knowledge-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .document-table-header,
    .document-table-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .topics-list {
        grid-template-columns: 1fr;
    }
}

/* Original responsive adjustments */
@media (max-width: 768px) {
    .hitl-sidebar {
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .hitl-sidebar.show {
        transform: translateX(0);
    }
    
    .hitl-editor-container {
        width: 100%;
    }
    
    .hitl-header-actions {
        flex-direction: column;
    }
}

/* ===========================
   KNOWLEDGE EXPLORER DASHBOARD STYLES
   =========================== */

/* Header Section */
.knowledge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    padding: var(--space-2xl);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-2xl);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.knowledge-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.1; }
    50% { transform: scale(1.05); opacity: 0.2; }
}

.header-content h3 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-content h3 i {
    font-size: 1.5rem;
    color: #ffd700;
}

.header-subtitle {
    margin: 0.5rem 0 0 0;
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 300;
}

.header-actions {
    display: flex;
    gap: var(--space-md);
    z-index: 2;
    position: relative;
}

.header-actions .btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    backdrop-filter: blur(10px);
    transition: all var(--transition-smooth);
    padding: var(--btn-padding-md);
    border-radius: var(--radius-md);
    font-weight: var(--font-weight-medium);
    font-size: var(--text-base);
}

.header-actions .btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Navigation Tabs */
.knowledge-nav-tabs {
    display: flex;
    background: var(--color-gray-50);
    border-radius: var(--radius-xl);
    padding: var(--space-sm);
    margin-bottom: var(--space-2xl);
    box-shadow: var(--shadow-md);
}

.knowledge-tab {
    flex: 1;
    padding: var(--space-md);
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-smooth);
    font-weight: var(--font-weight-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-size: var(--text-base);
}

.knowledge-tab:hover {
    background: var(--color-primary-alpha);
    color: var(--color-primary);
}

.knowledge-tab.active {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 12px var(--color-primary-alpha);
}

.knowledge-tab i {
    font-size: 1.1rem;
}

/* Panel Content */
.knowledge-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.knowledge-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Stats Overview */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.stat-label {
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Topic Cloud Section */
.topic-cloud-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.topic-cloud-section h4 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-subtitle {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.topic-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.topic-tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.topic-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Recent Activity Section */
.recent-activity-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.recent-activity-section h4 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recent-docs-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recent-doc-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.recent-doc-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.doc-icon {
    font-size: 1.5rem;
    color: #667eea;
}

.doc-info {
    flex: 1;
}

.doc-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.doc-meta {
    color: #6c757d;
    font-size: 0.85rem;
}

/* Memory Section */
.memory-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.memory-section h4 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.memory-content {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    color: #495057;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Document Controls */
.document-controls {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.search-section {
    margin-bottom: 1.5rem;
}

.search-bar {
    display: flex;
    gap: 0.5rem;
}

.search-bar input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.search-bar input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.search-btn {
    padding: 0.75rem 1.5rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.filter-section {
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Document Table */
.document-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
}

.documents-table-wrapper {
    overflow-x: auto;
}

.documents-table {
    width: 100%;
    border-collapse: collapse;
}

.documents-table th,
.documents-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.documents-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.3s ease;
}

.documents-table th:hover {
    background: #e9ecef;
}

.documents-table tr:hover {
    background: #f8f9fa;
}

.doc-type-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #667eea;
    color: white;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    margin: 0 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: #f8f9fa;
}

.preview-btn {
    color: #667eea;
}

.delete-btn {
    color: #dc3545;
}

/* Topics Grid */
.topics-header {
    text-align: center;
    margin-bottom: 2rem;
}

.topics-header h4 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    font-size: 1.5rem;
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.topic-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.topic-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.topic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.topic-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.topic-count {
    background: #667eea;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.topic-description {
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.topic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: #f8f9fa;
    color: #495057;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid #e9ecef;
}

/* Search Interface */
.search-interface {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.search-header {
    text-align: center;
    margin-bottom: 2rem;
}

.search-header h4 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.search-form {
    margin-bottom: 2rem;
}

.search-form .form-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-form input {
    flex: 1;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-form input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.search-form .btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    border-radius: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .knowledge-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .stats-overview {
        grid-template-columns: 1fr;
    }
    
    .knowledge-nav-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .filter-buttons {
        justify-content: center;
    }
    
    .search-form .form-group {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Knowledge base query styles moved to unified form system */

/* Ask KB form button styles moved to unified button system */

/* KB results area and query styles moved to unified design system */

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.result-title {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.result-score {
    font-size: 0.8rem;
    color: #666;
    background: #e9ecef;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
}

.result-content {
    margin: 0.5rem 0;
}

.result-content p {
    margin: 0;
    color: #555;
    font-size: 0.9rem;
    line-height: 1.4;
}

.result-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e8e8e8;
}

.result-source {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
}

.suggest-correction-btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid #6c757d;
    background: #fff;
    color: #6c757d;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggest-correction-btn:hover {
    background: #6c757d;
    color: #fff;
}

.no-results, .error-message {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.no-results i, .error-message i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.loading-spinner {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.loading-spinner i {
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

/* Mobile responsiveness for KB query */
@media (max-width: 768px) {
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .result-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .kb-results-area {
        max-height: 300px;
    }
}

/* ===========================
   KNOWLEDGE CORRECTION MODAL STYLES
   =========================== */

#knowledge-correction-modal {
    z-index: 1001; /* Higher than other modals */
}

#knowledge-correction-modal .modal-content {
    max-width: 600px;
    margin: 2rem auto;
}

.correction-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.correction-info p {
    margin: 0;
    font-size: 0.9rem;
}

.correction-info strong {
    color: #495057;
}

#correction-form .form-group {
    margin-bottom: 1rem;
}

#correction-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
}

#correction-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
}

#correction-form textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

#correction-form textarea[readonly] {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

#correction-form .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

#correction-form .btn {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

#correction-form .btn-secondary {
    background: #6c757d;
    color: white;
    border: 1px solid #6c757d;
}

#correction-form .btn-secondary:hover {
    background: #5a6268;
    border-color: #5a6268;
}

#correction-form .btn-primary {
    background: #007bff;
    color: white;
    border: 1px solid #007bff;
}

#correction-form .btn-primary:hover {
    background: #0056b3;
    border-color: #0056b3;
}

#correction-form .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mobile responsiveness for correction modal */
@media (max-width: 768px) {
    #knowledge-correction-modal .modal-content {
        margin: 1rem;
        max-width: none;
    }
    
    #correction-form .modal-actions {
        flex-direction: column;
    }
    
    #correction-form .btn {
        width: 100%;
    }
}

/* ===========================
   STAGE 3 MARPIT SVG CONTENT FIX
   =========================== */

/* Fix for Marpit SVG content rendering issue
   The cendien-proposal-theme.css sets section height to 11in which causes
   rendering issues when displayed inside SVG foreignObject in browsers.
   This override ensures proper display in the content preview. */
.content-preview .marpit section {
    height: 100% !important;
    width: 100% !important;
}

/* Ensure SVG content displays properly */
.content-preview .marpit svg {
    max-width: 100%;
    height: auto;
    display: block;
    min-height: 600px; /* Ensure minimum visible height */
}

/* Ensure foreignObject content is visible */
.content-preview .marpit svg foreignObject {
    display: block;
    overflow: visible; /* Allow content to extend beyond initial bounds */
}

/* Responsive content preview container */
.content-preview {
    position: relative;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Improve web display of print-oriented sections */
.content-preview .marpit section {
    height: auto !important; /* Override fixed 11in height for web display */
    min-height: 600px; /* Minimum readable height */
    max-width: 100%; /* Ensure responsive width */
    padding: 2rem !important; /* Convert from print padding */
    box-sizing: border-box;
}

/* ===========================
   SIMPLIFIED STAGE 3 CONTENT DISPLAY
   =========================== */

/* Simple content preview container - no complex SVG handling */
.content-preview-simple {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 2rem;
    margin-top: 1rem;
    min-height: 400px !important;
    height: auto !important;
    /* Removed max-height: 800px that was cutting off content */
    /* Removed overflow-y: auto to fix fixed scrolling behavior */
    width: 100% !important;
    font-family: 'Calibri', 'Segoe UI', 'Arial', sans-serif;
    font-size: 15px !important;
    line-height: 1.6;
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Force all child elements to inherit fixed font size */
.content-preview-simple * {
    font-size: inherit !important;
}

/* Handle Marpit content within simplified container */
.content-preview-simple .marpit {
    width: 100% !important;
    height: auto !important;
}

/* Force SVG content to be responsive and readable */
.content-preview-simple .marpit svg {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
}

/* Ensure sections display properly without fixed dimensions */
.content-preview-simple section {
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    max-width: 100% !important;
    padding: 1.5rem !important;
    margin-bottom: 2rem !important;
    border-bottom: 1px solid #eee;
    box-sizing: border-box !important;
    page-break-inside: avoid;
}

/* Typography improvements for readable content */
.content-preview-simple h1 {
    font-size: 2rem;
    color: #0066cc;
    margin-bottom: 1rem;
    font-weight: bold;
}

.content-preview-simple h2 {
    font-size: 1.5rem;
    color: #333;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #0066cc;
    padding-bottom: 0.5rem;
}

.content-preview-simple h3 {
    font-size: 1.25rem;
    color: #C00000;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.content-preview-simple p {
    margin-bottom: 1rem;
    text-align: justify;
}

.content-preview-simple table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.content-preview-simple th,
.content-preview-simple td {
    border: 1px solid #ddd;
    padding: 0.75rem;
    text-align: left;
    vertical-align: top;
}

.content-preview-simple th {
    background-color: #f8f9fa;
    font-weight: bold;
}

/* Additional specificity rules to prevent overrides */
.stage-result .content-preview-simple {
    max-height: none !important;
    height: auto !important;
    min-height: 400px !important;
    overflow: visible !important;
    display: block !important;
}

/* Force Stage 3 content to display completely */
#stage3-content-preview {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    display: block !important;
    position: relative !important;
}

/* Ensure all child elements in Stage 3 content are visible (except table and inline elements) */
#stage3-content-preview *:not(table):not(thead):not(tbody):not(tfoot):not(tr):not(th):not(td):not(span):not(strong):not(em):not(b):not(i):not(a):not(code):not(small):not(sub):not(sup) {
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
}

/* Preserve table structure and display properties */
#stage3-content-preview table {
    display: table !important;
}

#stage3-content-preview thead {
    display: table-header-group !important;
}

#stage3-content-preview tbody {
    display: table-row-group !important;
}

#stage3-content-preview tfoot {
    display: table-footer-group !important;
}

#stage3-content-preview tr {
    display: table-row !important;
}

#stage3-content-preview th,
#stage3-content-preview td {
    display: table-cell !important;
}

/* Ensure parent containers don't restrict Stage 3 content */
.stage-result.content-result {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
}

/* Override any inherited height constraints specifically for Stage 3 */
.content-result #stage3-content-preview {
    height: auto !important;
    max-height: none !important;
    min-height: auto !important;
    overflow: visible !important;
    margin-bottom: 4rem !important; /* Extra space before buttons */
    padding-bottom: 2rem !important;
}

/* Ensure Stage 3 content displays properly within scroll container */
.content-result {
    position: relative;
}

#current-stage-output .content-preview-simple {
    max-height: none !important; /* Remove height restrictions */
    height: auto !important;
    overflow: visible !important; /* Ensure content isn't clipped */
    min-height: auto !important;
}

/* Ensure content sections within simple preview display fully (except table and inline elements) */
.content-preview-simple > *:not(table):not(thead):not(tbody):not(tfoot):not(tr):not(th):not(td):not(span):not(strong):not(em):not(b):not(i):not(a):not(code):not(small):not(sub):not(sup) {
    display: block !important;
    visibility: visible !important;
}

/* Preserve table display properties for direct children */
.content-preview-simple > table {
    display: table !important;
    visibility: visible !important;
}

/* Force proper scroll behavior for Stage 3 content */
#current-stage-output {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Ensure Stage 3 container allows full content expansion */
#current-stage-output .stage-result {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Override any inherited height restrictions */
#stage3-content-preview {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
}

/* Ensure proper scrolling for very long content - removed height restriction */
.content-preview-simple {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
}

/* ===========================
   SEARCH FUNCTIONALITY
   =========================== */

.search-container {
    margin: 1rem 0 0.5rem 0;
    display: flex;
    justify-content: center;
}

.search-input {
    width: 100%;
    max-width: 400px;
    padding: 0.5rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #666;
    background: #fafafa;
    transition: all 0.3s ease;
    outline: none;
}

.search-input:focus {
    border-color: #005a9c;
    background: #fff;
    box-shadow: 0 0 0 0.15rem rgba(0, 90, 156, 0.1);
}

.search-input::placeholder {
    color: #999;
    font-style: italic;
}

/* Analysis Detail Modal Sidebar Layout */
.analysis-detail-body {
    flex: 1;
    display: flex;
    flex-direction: row; /* Changed to row for sidebar layout */
    overflow: hidden;
    padding: 0; /* Remove padding for sidebar layout */
    background-color: #fff; /* Clean background */
}

/* Audio mode selector styling (restored after rfp-style.css removal) */
#audio-mode-selector {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    font-size: var(--text-sm);
    color: var(--color-text-primary);
    margin-left: var(--space-sm);
    min-width: 140px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: border-color var(--transition-normal);
    align-self: center;
}

#audio-mode-selector:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: var(--shadow-focus);
}

/* Analysis Sidebar */
.analysis-sidebar {
    width: 250px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    overflow-y: auto;
    flex-shrink: 0;
}

.analysis-nav {
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
}

.analysis-nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: #6c757d;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 400;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.analysis-nav-link:hover {
    background-color: #e9ecef;
    color: #495057;
    text-decoration: none;
}

.analysis-nav-link.active {
    background-color: #fff;
    color: #007bff;
    border-left-color: #007bff;
    font-weight: 500;
}

.analysis-nav-link i {
    width: 1.2rem;
    margin-right: 0.75rem;
    font-size: 0.9rem;
    text-align: center;
}

.analysis-nav-link span {
    font-size: 0.9rem;
}

/* Analysis Content Area */
.analysis-detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background-color: #fff;
}

.analysis-section {
    min-height: 100%;
}

/* Modal focus management */
body.modal-open {
    overflow: hidden;
}

.fullscreen-overlay.is-visible {
    display: block;
}

.fullscreen-overlay.is-hidden {
    display: none;
}

/* RFP Analysis Progress Modal */
.progress-modal-content {
    width: 600px;
    max-width: 90vw;
}

.progress-status-area {
    min-height: 200px;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.analysis-progress-container {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.analysis-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.analysis-progress-header h4 {
    margin: 0;
    color: var(--color-text-primary);
}

.analysis-stage {
    color: var(--color-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

.analysis-progress-bar {
    width: 100%;
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-info));
    border-radius: 6px;
    transition: width 0.3s ease;
}

.analysis-progress-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.progress-text {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.progress-percentage {
    color: var(--color-primary);
    font-weight: 600;
    font-size: 1.1rem;
}

/* Removed duplicate stage-indicator styles - using main generation-progress styles instead */

.stage-number {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.stage-name {
    font-size: 0.75rem;
    line-height: 1.2;
}

.progress-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    align-items: center;
}

.analysis-info {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}