/* Beaumont Bond Bot Styles */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #006341;
    --secondary-color: #008856;
    --accent-color: #f39c12;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --dark-gray: #6c757d;
    --text-color: #333;
    --border-radius: 8px;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --primary-light: #e8f5f0;
    --primary-hover: #004d33;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-gray);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    background: white;
    border-bottom: 3px solid var(--primary-color);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
}

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

.header-content h1 {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 600;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.new-chat-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    transition: background-color 0.2s;
}

.new-chat-button:hover {
    background: var(--primary-hover);
}

.new-chat-button svg {
    width: 16px;
    height: 16px;
}

.mode-indicator {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    height: 40px;
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-link, .logout-link, .nav-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

.admin-link:hover, .logout-link:hover, .nav-link:hover {
    text-decoration: underline;
}

/* Main Layout */
main {
    flex: 1;
    display: flex;
    gap: 1rem;
    padding: 1rem 2rem;
    overflow: hidden;
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.system-info-panel {
    background: var(--primary-light);
    padding: 1.5rem;
    border-bottom: 1px solid var(--medium-gray);
    border-left: 4px solid var(--primary-color);
}

.system-description h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.example-questions {
    margin-top: 0.5rem;
}

.example-questions ul {
    margin: 0.5rem 0 0 1rem;
    color: var(--dark-gray);
}

.example-questions li {
    margin: 0.25rem 0;
    font-style: italic;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    background: white;
    min-height: 500px;
}

.welcome-message {
    background: var(--primary-light);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    text-align: left;
    max-width: 85%;
}

.welcome-message p {
    margin: 0 0 0.5rem 0;
    color: var(--text-color);
}

.welcome-message p:last-child {
    margin-bottom: 0;
}

.welcome-message strong {
    color: var(--primary-color);
    font-weight: 600;
}

.message {
    margin: 1rem 0;
    padding: 1rem;
    border-radius: var(--border-radius);
    max-width: 85%;
    line-height: 1.6;
    word-wrap: break-word;
}

/* Markdown formatting in messages */
.message ul, .message ol {
    margin: 10px 0;
    padding-left: 20px;
}

.message li {
    margin: 5px 0;
}

.message p {
    margin: 10px 0;
}

.message p:first-child {
    margin-top: 0;
}

.message p:last-child {
    margin-bottom: 0;
}

.message h1, .message h2, .message h3, .message h4, .message h5, .message h6 {
    margin: 15px 0 10px 0;
    color: var(--primary-color);
    font-weight: 600;
}

.message h1 { font-size: 1.2em; }
.message h2 { font-size: 1.1em; }
.message h3 { font-size: 1.05em; }

.message blockquote {
    border-left: 4px solid var(--primary-color);
    margin: 10px 0;
    padding-left: 15px;
    color: #666;
    font-style: italic;
}

.message code {
    background-color: #f5f5f5;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #d14;
}

.message pre {
    background-color: #f5f5f5;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid #e1e1e1;
}

.message pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.message table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
}

.message th, .message td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

.message th {
    background-color: var(--primary-light);
    font-weight: bold;
    color: var(--primary-color);
}

.message strong {
    color: var(--primary-color);
    font-weight: 600;
}

.message em {
    font-style: italic;
    color: var(--dark-gray);
}

/* Footnote citation styling */
.message .citation {
    font-size: 0.75em;
    color: var(--secondary-color);
    font-weight: 500;
    vertical-align: super;
    text-decoration: none;
    padding: 0 1px;
}

.message .citation:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.message.user {
    background: var(--secondary-color);
    color: white;
    margin-left: auto;
}

.message.assistant {
    background: var(--light-gray);
    border: 1px solid var(--medium-gray);
    position: relative;
    padding-top: 3rem;
    padding-right: 5rem;
    padding-bottom: 1rem;
    padding-left: 1rem;
}

.copy-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--medium-gray);
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    font-size: 0.8em;
    color: var(--dark-gray);
    display: flex;
    align-items: center;
    gap: 4px;
}

.copy-button:hover {
    background: white;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.message.assistant:hover .copy-button {
    opacity: 1;
}

.copy-button.copied {
    color: var(--success-color);
    border-color: var(--success-color);
}

.message.error {
    background: #ffebee;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

.message-meta {
    font-size: 0.8rem;
    color: var(--dark-gray);
    margin-top: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Chat Input */
.chat-input {
    padding: 1rem;
    border-top: 1px solid var(--medium-gray);
    background: white;
}

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

#query-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

#query-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(0, 99, 65, 0.2);
}

#send-button {
    padding: 0.75rem 1.5rem;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
}

#send-button:hover {
    background: var(--primary-hover);
}

#send-button:disabled {
    background: var(--medium-gray);
    cursor: not-allowed;
}

.prompt-selector-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    justify-content: space-between; /* Add space between prompt selector and send button */
}

.prompt-selector-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1; /* Take up available space */
}

/* Hide prompt selector for council users */
body.council-user .prompt-selector-group {
    display: none !important;
}

/* Adjust prompt selector row layout for council users */
body.council-user .prompt-selector-row {
    justify-content: flex-end !important;
}

.prompt-selector-row label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary-color);
    white-space: nowrap;
}

.prompt-dropdown {
    flex: 1;
    max-width: 300px;
    padding: 0.5rem;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

.prompt-dropdown:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.input-status {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--dark-gray);
}

/* Sources Panel */
.sources-panel {
    width: 350px;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    height: 100%; /* Match the full height of the main container */
    gap: 0;
    overflow-y: auto;
}

.source-item {
    background: var(--light-gray);
    padding: 0.6rem;
    margin: 0.3rem 0;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.source-item:hover {
    background: var(--primary-light);
    transform: translateX(2px);
}

.source-number {
    font-weight: bold;
    color: var(--secondary-color);
    font-size: 0.9rem;
    min-width: 2em;
    text-align: center;
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--secondary-color);
    flex-shrink: 0;
    text-decoration: none;
    display: block;
}

.source-number.linked {
    cursor: pointer;
    transition: all 0.2s ease;
}

.source-number.linked:hover {
    background: var(--secondary-color);
    color: white;
    transform: scale(1.05);
}

.source-number:not(.linked) {
    cursor: default;
}

.source-content {
    flex: 1;
}

.source-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
}

.source-meta {
    font-size: 0.8rem;
    color: var(--dark-gray);
}

.no-sources {
    color: var(--dark-gray);
    font-style: italic;
    text-align: center;
    margin: 2rem 0;
}

/* Category Filter Styles */
.category-filter {
    border-bottom: 1px solid var(--medium-gray);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    flex-shrink: 0; /* Category filter doesn't shrink */
}

.category-filter h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.category-options {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.category-checkbox {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.2rem 0;
    transition: color 0.2s ease;
}

.category-checkbox:hover {
    color: var(--primary-color);
}

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

.category-checkbox input[type="checkbox"]:checked + .checkmark::after {
    display: block;
}

/* Sources section styling moved to unified section styling below */

/* Login Page */
.login-page {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-container {
    background: white;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 500px;
    border-top: 6px solid var(--primary-color);
    position: relative;
    margin-top: 100px;
}

.login-logo {
    position: absolute;
    top: -150px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.logo-image {
    max-width: 200px;
    width: 200px;
    height: auto;
    background: white;
    border: 2px solid black;
    padding: 12px;
    border-radius: 5px;
}

.login-form h1 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-form h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--dark-gray);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(0, 99, 65, 0.2);
}

.login-button, .submit-button, .action-button {
    width: 100%;
    padding: 0.75rem;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-button:hover, .submit-button:hover, .action-button:hover {
    background: var(--primary-hover);
}

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

.flash-message {
    padding: 0.75rem;
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
}

.flash-message.error {
    background: #ffebee;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.login-info {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--medium-gray);
    color: var(--dark-gray);
}

.login-info ul {
    margin: 0.5rem 0 0 1rem;
}

/* Admin Styles */
.admin-main {
    flex-direction: column;
    overflow-y: auto;
}

.admin-section {
    background: white;
    margin-bottom: 2rem;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary-color);
}

.admin-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--medium-gray);
}

/* Hide mobile toggle icon on desktop */
.toggle-icon {
    display: none;
}

/* Remove cursor pointer on desktop for upload header */
.upload-section .collapsible-header {
    cursor: default;
}

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

.section-header h2 {
    margin-bottom: 0;
    border-bottom: none;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.full-width {
    width: 100%;
}

.category-fields {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--primary-light);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.category-fields h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.status-message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    display: none;
}

.status-message.success {
    background: #d4edda;
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.status-message.error {
    background: #f8d7da;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.documents-summary {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.documents-summary .summary-stat {
    font-size: 0.95rem;
    white-space: nowrap;
}

.documents-summary .summary-stat:not(:last-child)::after {
    content: " •";
    margin-left: 1rem;
    color: #999;
}

/* Table wrapper for horizontal scrolling */
.documents-table-wrapper {
    overflow-x: auto;
    margin-top: 1rem;
}

.documents-table {
    width: 100%;
    min-width: 700px; /* Ensure minimum width for all columns */
    border-collapse: collapse;
}

.documents-table th,
.documents-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--medium-gray);
}

/* Column width constraints */
.documents-table th:nth-child(1), /* Checkbox column */
.documents-table td:nth-child(1) {
    width: 40px;
}

.documents-table th:nth-child(2), /* Title column */
.documents-table td:nth-child(2) {
    width: 35%;
    max-width: 300px;
    word-wrap: break-word;
}

.documents-table th:nth-child(3), /* Category column */
.documents-table td:nth-child(3) {
    width: 120px;
}

.documents-table th:nth-child(4), /* Date column */
.documents-table td:nth-child(4) {
    width: 100px;
}

.documents-table th:nth-child(5), /* Topics column */
.documents-table td:nth-child(5) {
    width: 200px;
}

.documents-table th:nth-child(6), /* Actions column */
.documents-table td:nth-child(6) {
    width: 200px;
}

.documents-table th {
    background: var(--light-gray);
    font-weight: 600;
    color: var(--primary-color);
}

.documents-table tr:hover {
    background: var(--light-gray);
}

.relevance-high {
    background: var(--success-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.relevance-medium {
    background: var(--warning-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.relevance-low {
    background: var(--dark-gray);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

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

.category-media { background: #e3f2fd; color: #1976d2; }
.category-city { background: #f3e5f5; color: #7b1fa2; }
.category-interview { background: #e8f5e8; color: #388e3c; }
.category-supporting { background: #fff3e0; color: #f57c00; }

/* Prompt Management Styles */
.default-badge {
    background: var(--success-color);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.status-active {
    color: var(--success-color);
    font-weight: 500;
}

.status-inactive {
    color: var(--dark-gray);
}

.prompts-table-container {
    overflow-x: auto;
}

.flash-message {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

.flash-message.success {
    background: #d4edda;
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.flash-message.error {
    background: #f8d7da;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

/* Council Member Notice Styles */
.council-notice {
    background: #fff3cd;
    color: #856404;
    border: 2px solid var(--warning-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.council-notice-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.council-notice-content {
    flex: 1;
}

.council-notice strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #664d03;
}

/* Header version of council notice - compact design */
.header-council-notice {
    background: #fff3cd !important; /* Original yellow background */
    color: #856404 !important;
    border: 2px solid var(--warning-color) !important; /* Restore border */
    padding: 0.5rem 0.75rem !important;
    margin: 0 0 0 1rem !important;
    border-radius: 6px !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    height: 36px !important; /* Match button height */
    align-items: center !important;
    gap: 0.25rem !important;
    flex-shrink: 0 !important;
    width: auto !important; /* Only as wide as content */
    display: inline-flex !important; /* Inline flex to fit content */
}

.header-council-notice .council-notice-icon {
    font-size: 1rem !important;
}

.header-council-notice .council-notice-content {
    margin: 0 !important;
}

.header-council-notice strong {
    display: inline !important;
    margin: 0 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        height: 100vh;
    }
    
    main {
        flex-direction: column;
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .sources-panel {
        width: 100%;
        order: -1;
        max-height: 50vh; /* Reasonable height for mobile */
        overflow-y: auto;
    }
    
    .filter-card-content {
        max-height: 225px; /* 50% larger on mobile too */
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .header-controls {
        justify-content: space-between;
        gap: 1rem;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .documents-table {
        font-size: 0.8rem;
    }
    
    .chat-messages {
        /* Removed max-height to allow flex growth */
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    border: 2px solid var(--medium-gray);
    border-top: 2px solid var(--secondary-color);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

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

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay {
    display: none;
    position: fixed;
    z-index: 999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    padding: 0;
    max-width: 800px;
    width: 90vw;
}

.modal-content.small {
    max-width: 400px;
    width: 400px;
}

.modal-content.large {
    max-width: 900px;
    width: 95vw;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--medium-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-light);
}

.modal-header h3, .modal-header h4 {
    margin: 0;
    color: var(--primary-color);
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark-gray);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background: rgba(0,0,0,0.1);
    color: var(--primary-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--medium-gray);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.modal-actions {
    display: flex;
    flex-direction: row-reverse;
    gap: 1rem;
    padding: 1rem 0 0 0;
    border-top: 1px solid var(--medium-gray);
    margin-top: 1.5rem;
    align-items: center;
}

.modal-footer {
    align-items: center;
}

/* Consistent button sizing inside modal action bars */
.modal-actions .action-button,
.modal-actions .submit-button,
.modal-actions .danger-button,
.modal-actions .delete-button,
.modal-footer .action-button,
.modal-footer .submit-button,
.modal-footer .danger-button,
.modal-footer .delete-button {
    flex: 2;
    width: auto;
    min-height: 44px;
    margin-top: 0;
}

.modal-actions .cancel-button,
.modal-footer .cancel-button {
    flex: 1;
    min-height: 44px;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal form {
    padding: 1.5rem;
}

.modal .form-group h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.cancel-button {
    background: var(--medium-gray);
    color: var(--dark-gray);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
}

.cancel-button:hover {
    background: var(--dark-gray);
    color: white;
}

/* User Management Styles */
.users-table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 400px; /* Add vertical scroll limit */
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    margin-top: 1rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--medium-gray);
}

.admin-table thead {
    background: var(--primary-color);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
    padding-bottom: 1rem; /* Add space after last row */
}

/* Space between action buttons in table */
.admin-table td button {
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
}

.admin-table td button:last-child {
    margin-right: 0;
}

/* Collapsible section styling */
.collapsible-section .collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    transition: color 0.2s ease;
}

.collapsible-section .collapsible-header:hover {
    color: var(--primary-color);
}

.collapsible-section .toggle-icon {
    font-size: 0.8em;
    transition: transform 0.3s ease;
    color: var(--primary-color);
}

.collapsible-section.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.collapsible-section .collapsible-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    opacity: 1;
}

.collapsible-section.collapsed .collapsible-content {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}

/* Inline checkbox styling for forms */
.form-group.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-group.checkbox-inline label {
    margin: 0;
    font-weight: 500;
    white-space: nowrap;
}

.form-group.checkbox-inline input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Protected label styling */
.protected-label {
    color: #999;
    font-size: 0.85em;
    font-weight: normal;
}

.admin-badge {
    background: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    margin-left: 0.5rem;
    font-weight: 500;
}

/* Danger button - matches action button but red */
.danger-button {
    padding: 0.75rem;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.danger-button:hover {
    background: #c0392b; /* Darker red on hover */
    transform: translateY(-1px);
}

.action-button.small,
.danger-button.small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    min-width: 120px; /* Fixed width for consistency */
    width: auto; /* Override full width */
}

.user-delete-info {
    background: var(--light-gray);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    border-left: 4px solid var(--danger-color);
}

.warning-text {
    color: var(--danger-color);
    font-weight: 500;
    margin-bottom: 1rem;
}

.help-text {
    font-size: 0.8rem;
    color: var(--dark-gray);
    margin-top: 0.3rem;
    display: block;
}

.form-value {
    font-weight: 600;
    color: var(--primary-color);
}

.no-data {
    text-align: center;
    font-style: italic;
    color: var(--dark-gray);
    padding: 2rem;
}

.loading-row {
    text-align: center;
    font-style: italic;
    color: var(--dark-gray);
}

.flash-message.success {
    background: #d4edda;
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.delete-button {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
}

.delete-button:hover {
    background: #c0392b;
}

.text-danger {
    color: var(--danger-color);
    font-size: 0.9rem;
}

/* Action buttons for document table */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.edit-btn, .delete-btn, .refresh-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    font-weight: 500;
}

.edit-btn {
    background: var(--secondary-color);
    color: white;
}

.edit-btn:hover {
    background: var(--primary-color);
}

.delete-btn {
    background: var(--danger-color);
    color: white;
}

.delete-btn:hover {
    background: #c0392b;
}

/* Professional Enhancements */
.message {
    transition: all 0.2s ease;
}

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

.admin-section {
    transition: all 0.2s ease;
}

.admin-section:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

/* Improved Form Styling */
.form-group input, .form-group select, .form-group textarea {
    transition: all 0.2s ease;
}

.form-group input:hover, .form-group select:hover, .form-group textarea:hover {
    border-color: var(--primary-color);
}

/* Enhanced Table Styling */
.documents-table {
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.documents-table thead tr {
    background: var(--primary-color);
}

.documents-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.documents-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.documents-table th.sortable:hover {
    background: var(--primary-hover);
}

.documents-table th.sortable.active {
    background: var(--secondary-color);
}

.documents-table th .sort-indicator {
    margin-left: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.7;
}

.documents-table tbody tr:hover {
    background: var(--primary-light);
    transform: scale(1.01);
    transition: all 0.2s ease;
}

/* Professional Badge Styling */
.category-badge, .relevance-high, .relevance-medium, .relevance-low {
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Upload Media Styles */
.upload-main {
    flex: 1;
    padding: 2rem 0;
    overflow-y: auto;
}

.upload-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary-color);
}

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

.file-info {
    margin-top: 0.5rem;
    padding: 1rem;
    background-color: var(--light-gray);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    color: var(--dark-gray);
    border: 1px solid var(--medium-gray);
}

.progress-container {
    margin: 1rem 0;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: var(--medium-gray);
    border-radius: 10px;
    overflow: hidden;
    display: none;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--dark-gray);
    display: none;
}

.chunk-info {
    background-color: var(--primary-light);
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--primary-color);
    display: none;
}

/* Removed duplicate/conflicting .message rule that was hiding messages */

.message.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.message.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Sortable Table Headers */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: all 0.2s ease;
}

.sortable:hover {
    background-color: var(--primary-light);
}

.sortable.sorted-asc,
.sortable.sorted-desc {
    background-color: white;
    color: var(--primary-color);
    font-weight: 600;
}

.sort-icon {
    font-size: 0.8em;
    margin-left: 0.25rem;
    color: var(--dark-gray);
}

.sort-icon.active {
    color: var(--primary-color);
    font-weight: bold;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-muted { color: var(--dark-gray); }
.mt-1 { margin-top: 0.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.p-1 { padding: 0.5rem; }
.hidden { display: none; }
.visible { display: block; }
/* User dropdown menu */
.user-menu {
    position: relative;
}

.user-menu-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(61, 90, 254, 0.1);
    border: 1px solid rgba(61, 90, 254, 0.2);
    border-radius: 8px;
    color: var(--primary-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    height: 40px;
}

.user-menu-button:hover {
    background: rgba(61, 90, 254, 0.15);
    border-color: rgba(61, 90, 254, 0.3);
}

.user-menu-button svg {
    transition: transform 0.2s ease;
}

.user-menu-button.active svg {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 200px;
    background: white;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.user-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.menu-item:hover {
    background: #f8f9fa;
    color: var(--primary-color);
}

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

.menu-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.menu-item:hover svg {
    opacity: 1;
}

.menu-item.logout {
    color: #dc3545;
}

.menu-item.logout:hover {
    background: #fee;
    color: #dc3545;
}

.menu-divider {
    height: 1px;
    background: #e9ecef;
    margin: 0.25rem 0;
}

/* Simple Collapsible Cards */
.filter-card {
    background: white;
    border-radius: 6px;
    margin-bottom: 0.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.filter-card-header {
    padding: 0.5rem 0.75rem;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background-color 0.2s ease;
}

.filter-card-header:hover {
    background: var(--primary-hover);
}

.filter-card-header h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.toggle-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    font-weight: bold;
    color: white;
    display: inline-block;
}

/* When collapsed, show right arrow (▶) - no rotation needed */
.filter-card.collapsed .toggle-icon::before {
    content: "▶";
}

/* When expanded, show down arrow (▼) */
.filter-card:not(.collapsed) .toggle-icon::before {
    content: "▼";
}

.filter-card-content {
    max-height: 300px;
    overflow-y: auto;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
    padding: 0.5rem;
}

.filter-card.collapsed .filter-card-content {
    max-height: 0;
    opacity: 0;
    padding: 0 0.5rem;
    overflow: hidden;
}

/* Date Filter Styles - Consistent with existing filter sections */
.date-filter-wrapper {
    padding: 0;
}

.date-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
}

.date-filter-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--medium-gray);
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 10px;
    background-color: white;
    color: var(--text-color);
    font-family: inherit;
}

.date-filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 99, 65, 0.1);
}

.clear-date-btn {
    width: 100%;
    margin-top: 5px;
    background: var(--dark-gray);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.clear-date-btn:hover {
    background: #495057;
}

.filter-hint {
    margin-top: 10px;
    color: var(--dark-gray);
    font-size: 0.8rem;
    line-height: 1.3;
}

/* Dark mode support - consistent with existing sections */
body.dark-mode .date-filter-input {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
    color-scheme: dark;
}

body.dark-mode .date-label {
    color: #e2e8f0;
}

body.dark-mode .filter-hint {
    color: #a0aec0;
}

/* Topic Filter specific styling (inherits from section styles above) */

.topic-mode-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.toggle-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
}

.toggle-switch {
    display: flex;
    background: white;
    border: 1px solid #ddd;
    border-radius: 20px;
    overflow: hidden;
}

.toggle-switch input[type="radio"] {
    display: none;
}

.toggle-switch label {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-switch input[type="radio"]:checked + label {
    background: #0066cc;
    color: white;
}

/* Topic Search */
.topic-search {
    margin-bottom: 1rem;
}

.topic-search input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.topic-search input:focus {
    outline: none;
    border-color: #0066cc;
}

/* Selected Topics */
.selected-topics {
    margin-bottom: 1rem;
    min-height: 40px;
}

.selected-topics .no-selection {
    color: #999;
    font-size: 0.85rem;
    font-style: italic;
}

.topic-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
    padding: 0.125rem 0.375rem;
    margin: 0.125rem;
    background: #e3f2fd;
    color: #0066cc;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.2;
}

.topic-tag .remove-topic {
    background: none;
    border: none;
    color: #0066cc;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0;
    margin-left: 0.125rem;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topic-tag .remove-topic:hover {
    color: #ff4444;
}

/* Topic List */
.topic-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 6px;
}

.topic-list .no-topics {
    padding: 1rem;
    text-align: center;
    color: #999;
    font-style: italic;
}

.topic-group {
    border-bottom: 1px solid #f0f0f0;
}

.topic-group:last-child {
    border-bottom: none;
}

.topic-group-header {
    padding: 0.25rem 0.5rem;
    background: #f8f9fa;
    font-weight: bold;
    font-size: 0.85rem;
    color: #666;
    position: sticky;
    top: 0;
}

.topic-group-items {
    padding: 0.25rem 0;
}

.topic-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}

.topic-item:hover {
    background: #f8f9fa;
}

.topic-item.selected {
    background: #e3f2fd;
}

.topic-item .topic-name {
    font-size: 0.9rem;
    color: #333;
}

.topic-item .topic-count {
    font-size: 0.8rem;
    color: #999;
}

/* Active Filters Summary */
.active-filters {
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.filter-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-summary .no-filters {
    color: #999;
    font-size: 0.85rem;
    font-style: italic;
}

.filter-tag {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #666;
}

/* Index Status Indicator */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.index-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.index-status .status-icon {
    font-size: 1rem;
}

.index-status.up-to-date {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.index-status.out-of-date {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    animation: pulse 2s infinite;
}

.index-status.never-built,
.index-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.index-status.rebuilding {
    background: #fef7e0;
    color: #856404;
    border: 1px solid #f5c842;
}

.index-status.rebuilding .status-icon {
    animation: spin 1s linear infinite;
}

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

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

/* Suggested rebuild button */
#rebuild-index.suggested {
    animation: glow 2s infinite;
    border-color: var(--accent-color);
    background: linear-gradient(45deg, var(--accent-color), #e67e22);
}

/* Rebuilding state - orange glow and disabled */
#rebuild-index.rebuilding {
    animation: orangeGlow 2s infinite;
    background: linear-gradient(45deg, #ff7f00, #ff9500);
    border-color: #ff7f00;
    cursor: not-allowed;
    opacity: 0.8;
}

#rebuild-index.rebuilding:hover {
    background: linear-gradient(45deg, #ff7f00, #ff9500);
    transform: none;
}

@keyframes orangeGlow {
    0%, 100% { 
        box-shadow: 0 0 8px rgba(255, 127, 0, 0.6), 0 0 16px rgba(255, 127, 0, 0.4); 
    }
    50% { 
        box-shadow: 0 0 16px rgba(255, 127, 0, 0.8), 0 0 24px rgba(255, 127, 0, 0.6); 
    }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(243, 156, 18, 0.5); }
    50% { box-shadow: 0 0 20px rgba(243, 156, 18, 0.8); }
}

/* Document Filters */
.document-filters {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    margin-top: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

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

.filter-group label {
    font-weight: 500;
    color: #495057;
}

.filter-select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 150px;
    background: white;
    cursor: pointer;
}

.filter-select:hover {
    border-color: #007bff;
}

.filter-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.filter-count {
    color: #6c757d;
    font-size: 0.9rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.action-button.secondary {
    background: #6c757d;
    padding: 0.5rem 1rem;
}

.action-button.secondary:hover {
    background: #5a6268;
}

/* Bulk Operations */
.select-header, .select-cell {
    width: 40px;
    text-align: center;
    padding: 0.5rem;
}

.select-header input[type="checkbox"],
.select-cell input[type="checkbox"] {
    cursor: pointer;
    transform: scale(1.2);
}

.document-row.selected {
    background: #f0f8ff;
}

/* Bulk topic modal styles */
.bulk-action-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.bulk-action-section h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: #333;
}

.help-text {
    color: #6c757d;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.selected-count {
    font-size: 1.1rem;
    padding: 0.75rem;
    background: #e3f2fd;
    border-radius: 4px;
    margin-bottom: 1rem;
    text-align: center;
}

#bulk-add-topics {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.topics-preview {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.topics-checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.topic-checkbox-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    cursor: pointer;
}

.topic-checkbox-item:hover {
    background: #f5f5f5;
}

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

.no-topics {
    color: #6c757d;
    text-align: center;
    padding: 1rem;
}

#bulk-topic-btn {
    background: #28a745;
}

#bulk-topic-btn:hover {
    background: #218838;
}

/* Mobile responsive styles for Date Filter */
@media (max-width: 768px) {
    .date-filter-wrapper {
        padding: 0;
    }
    
    .date-filter-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 10px 12px; /* Slightly larger touch target */
        min-height: 44px; /* iOS touch target recommendation */
    }
    
    .clear-date-btn {
        padding: 10px 16px; /* Match mobile button sizing */
        min-height: 44px;
    }
}

/* Responsive filters */
@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-select {
        width: 100%;
    }
}

/* =================================
   Web Scraper Styles
   ================================= */

/* Source type toggle */
.source-type-toggle {
    display: flex;
    gap: 1rem;
    margin: 0.5rem 0;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border: 2px solid var(--medium-gray, #e9ecef);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.radio-option:hover {
    border-color: var(--primary-color, #006341);
    background: var(--primary-light, #f0f7f4);
}

.radio-option input[type="radio"] {
    cursor: pointer;
}

.radio-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--primary-color, #006341);
}

/* URL input styling */
#source_url {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--medium-gray, #e9ecef);
    border-radius: var(--border-radius, 4px);
    font-size: 1rem;
}

#source_url:focus {
    outline: none;
    border-color: var(--primary-color, #006341);
    box-shadow: 0 0 0 2px rgba(0, 99, 65, 0.1);
}

/* Disabled file input styling */
#file:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f8f9fa;
    color: #6c757d;
}

#file:disabled + label,
label[for="file"]:has(+ #file:disabled) {
    opacity: 0.5;
    color: #6c757d;
}

/* Disabled file input container */
.form-group:has(#file:disabled) label {
    opacity: 0.5;
    color: #6c757d;
}

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 12px;
    color: var(--dark-gray, #6c757d);
}

/* Refresh button styling */
.refresh-btn {
    background: var(--primary-color);
    color: white;
}

.refresh-btn:hover {
    background: var(--primary-hover);
}

.refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Refresh button animation */
.refresh-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 14px;
}

.refresh-icon.spinning {
    animation: spin 1s linear infinite;
}

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

/* Web source badge */
.web-source-badge {
    font-size: 14px;
    margin-left: 0.5rem;
    opacity: 0.7;
}

/* Mobile responsive */
@media screen and (max-width: 480px) {
    .source-type-toggle {
        flex-direction: column;
    }
    
    .radio-option {
        justify-content: center;
    }
}
