/* Global Styles */
:root {
    /* Light theme (default) - consistent blue palette */
    --primary-color: #0066cc;  /* Primary blue */
    --secondary-color: #0080ff;  /* Lighter blue */
    --tertiary-color: #004999;  /* Darker blue */
    --light-blue: #80b3ff;      /* Very light blue */
    --lighter-blue: #b3d1ff;    /* Extremely light blue */
    --accent-color: #0057b3;    /* Medium blue for accent */
    --text-color: #333;
    --background-color: #f5f5f7;
    --light-color: #f8f8f8;
    --card-background: #ffffff;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --modal-background: #ffffff;
    --modal-text: #333;
    --summary-background: #f0f8ff;
    --summary-border: var(--secondary-color);
    --heatmap-color-1: #ebedf0;
    --heatmap-color-2: #cce0ff;
    --heatmap-color-3: #99c2ff;
    --heatmap-color-4: #3385ff;
    --heatmap-color-5: #0066cc;
}

/* Dark theme - consistent blue palette for dark mode */
[data-theme="dark"] {
    --primary-color: #0066cc;  /* Primary blue */
    --secondary-color: #0080ff;  /* Lighter blue */
    --tertiary-color: #004999;  /* Darker blue */
    --light-blue: #4080e0;      /* Very light blue for dark mode */
    --lighter-blue: #5090f0;    /* Extremely light blue for dark mode */
    --accent-color: #0057b3;    /* Medium blue for accent */
    --text-color: #f5f5f7;
    --background-color: #1c1c1e;
    --light-color: #2c2c2e;
    --card-background: #242426;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.5);
    --modal-background: #242426;
    --modal-text: #f5f5f7;
    --summary-background: #1a2535;
    --summary-border: var(--secondary-color);
    --heatmap-color-1: #161b22;
    --heatmap-color-2: #002952;
    --heatmap-color-3: #003d80;
    --heatmap-color-4: #0057b3;
    --heatmap-color-5: #0066cc;
}

/* Dark theme body style removed - using background-color only */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    width: 98%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 10px;
}

.document-page-content .container {
    width: 100%;
    max-width: none;
    padding: 0;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Ensure headings are readable in dark mode */
[data-theme="dark"] h1, 
[data-theme="dark"] h2, 
[data-theme="dark"] h3 {
    color: var(--text-color);
}

/* Header */
header {
    background: linear-gradient(135deg, #0066cc, #0080ff); /* Primary blue gradient */
    color: white;
    padding: 20px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] header {
    background: linear-gradient(135deg, #0066cc, #0080ff); /* Dark theme blue */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

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

header h1 {
    font-size: 1.8rem;
    color: white;
    margin-bottom: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

header i {
    margin-right: 10px;
}

.search-container {
    display: flex;
    width: 200px;
    transition: width 0.3s ease;
    position: relative;
}

.search-container.expanded {
    width: 400px;
}

.search-container.with-active-search input {
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.3);
}

.clear-search-btn {
    background-color: transparent !important;
    margin-right: -5px;
}

.search-active-indicator {
    position: absolute;
    right: 105px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
    white-space: nowrap;
}

.search-container input {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 4px 0 0 4px;
    background-color: var(--card-background);
    color: var(--text-color);
    transition: all 0.3s ease;
    width: 100%;
}

.search-container input:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--secondary-color);
}

.search-actions {
    display: flex;
}

.search-container button {
    padding: 10px 15px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-container button:hover {
    background-color: var(--secondary-color);
}

.search-container #search-button {
    border-radius: 0 4px 4px 0;
}

.theme-toggle-btn {
    margin-left: 10px;
    border-radius: 4px !important;
    background-color: var(--secondary-color) !important;
    transition: background-color 0.3s ease;
}

.filter-indicator {
    position: absolute;
    right: -35px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--secondary-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.search-container.expanded .filter-indicator {
    opacity: 1;
    pointer-events: auto;
}

.filter-indicator.active {
    background-color: var(--accent-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(255, 59, 48, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
    }
}

@media (max-width: 768px) {
    .search-container.expanded {
        width: 100%;
        position: absolute;
        right: 20px;
        top: 60px;
        z-index: 100;
    }
    
    .filter-indicator {
        display: none;
    }
    
    .publishing-soon-popup {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .publishing-soon-popup::before,
    .publishing-soon-popup::after {
        display: none;
    }
}

/* Filter Drawer */
.filter-drawer {
    background-color: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    box-shadow: 0 2px 4px var(--shadow-color);
    transition: all 0.3s ease;
    overflow: hidden;
    max-height: 0;
}

.filter-content {
    padding: 15px 0;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.filter-content.open {
    opacity: 1;
}

.filter-drawer .filter-content.open {
    opacity: 1;
}

.filter-drawer .filter-content.open + .filter-drawer {
    max-height: 500px; /* Adjust based on your filter's height */
}

.filters {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    gap: 15px;
}

.filters li {
    display: flex;
    align-items: center;
}

.filters label {
    margin-right: 8px;
    font-size: 0.9rem;
}

.filters select {
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--card-background);
    color: var(--text-color);
}

/* Main Content */
main {
    padding: 30px 0;
}

.stats-section, .documents-section, .document-stats-section {
    margin-bottom: 30px;
}

/* Document Type Breakdown Styles */
.document-type-breakdown {
    background-color: var(--card-background);
    border-radius: 10px;
    box-shadow: 0 2px 8px var(--shadow-color);
    padding: 1rem;
    margin-bottom: 1rem;
}

.compact-stats {
    padding: 0;
    margin: 0;
    box-shadow: none;
    background-color: transparent;
}

.document-type-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 0.85rem;
}

.document-type-table th, .document-type-table td {
    text-align: left;
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.document-type-table th {
    font-weight: 600;
    color: var(--text-color-emphasis);
}

.document-type-table tr:last-child td {
    border-bottom: none;
}

.document-type-table tr.total-row {
    font-weight: 700;
    color: var(--primary-color);
}

.document-type-count {
    text-align: right;
}

.loading-stats {
    text-align: center;
    color: var(--text-color);
    opacity: 0.7;
    padding: 0.5rem 0;
    font-size: 0.85rem;
}

/* Heatmap Calendar */
.heatmap-calendar {
    background-color: var(--card-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
    margin-bottom: 20px;
}

.error-message {
    color: var(--accent-color);
    padding: 15px;
    text-align: center;
    font-style: italic;
}

.loading-chart {
    color: var(--text-color);
    margin-top: 10px;
    text-align: center;
    font-style: italic;
}

.heatmap-legend {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
    gap: 5px;
}

.chart-legend {
    text-align: center;
    padding: 10px;
}

.legend-title {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 5px;
}

.legend-subtitle {
    font-size: 0.8rem;
    color: var(--secondary-color);
    font-style: italic;
}

/* Latest Documents Section */
.latest-section {
    background-color: var(--card-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
}

/* Grayed out section for when there are no new documents */
.stats-section.grayed-out .latest-section {
    opacity: 0.6;
    background-color: var(--light-color);
    border: 1px solid var(--border-color);
    box-shadow: none;
}

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

.title-with-pill {
    display: flex;
    align-items: center;
    gap: 15px;
}

.publishing-soon-pill {
    background-color: var(--primary-color);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    display: flex; /* Make visible by default */
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.publishing-soon-pill:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.publishing-soon-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 10px;
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 10px rgba(0, 102, 204, 0.2);
    width: 920px;
    max-width: calc(100vw - 40px);
    z-index: 100;
    border: 2px solid var(--primary-color);
    text-align: left;
}

/* Add a little arrow/pointer to the top of the popup */
.publishing-soon-popup::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 20px;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid var(--card-background);
    z-index: 101;
}

/* Border for the arrow */
.publishing-soon-popup::after {
    content: '';
    position: absolute;
    top: -12px;
    left: 19px;
    border-left: 11px solid transparent;
    border-right: 11px solid transparent;
    border-bottom: 11px solid var(--primary-color);
    z-index: 100;
}

/* Fix positioning of the popup relative to the pill */
.title-with-pill {
    position: relative;
}

/* This approach often doesn't work reliably for complex popups */
/* We'll use JavaScript to control the visibility instead */

.popup-content {
    padding: 15px;
    max-height: 350px;
    overflow-y: auto;
    background-color: rgba(0, 102, 204, 0.03);
}

.popup-content h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: var(--primary-color);
    border-bottom: 1px solid var(--primary-color);
    padding-bottom: 8px;
    text-align: center;
    font-weight: 600;
}

.popup-document-item {
    border-bottom: 1px solid var(--border-color);
    padding: 10px;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    border-radius: 4px;
    word-break: break-word;
}

.popup-document-item:hover {
    background-color: rgba(0, 102, 204, 0.1);
    transform: translateX(3px);
}

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

.popup-document-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 5px;
    line-height: 1.4;
    word-wrap: break-word;
}

.popup-document-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 0.75rem;
    margin-top: 4px;
}

.popup-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.pi-badge {
    background-color: var(--primary-color);
    color: white;
    font-size: 0.65rem;
    padding: 3px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pending-badge {
    background-color: var(--accent-color);
    color: white;
    font-size: 0.65rem;
    padding: 3px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Counter badge on pill */
.publishing-soon-pill .count-badge {
    display: inline-flex;
    background-color: white;
    color: var(--primary-color);
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    font-size: 0.7rem;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    font-weight: bold;
}

.popup-doc-type {
    color: var(--text-color);
    opacity: 0.8;
}

.popup-date {
    color: var(--text-color);
    opacity: 0.7;
    margin-left: auto;
}

.total-documents-count {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
}

.toggle-new-btn {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

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

.toggle-new-btn.active {
    background-color: var(--accent-color);
}

.todays-documents, .new-documents {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.new-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--accent-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    z-index: 1;
}

/* Mark as read button */
.mark-read-btn {
    background-color: transparent;
    color: var(--secondary-color);
    border: none;
    padding: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.mark-read-btn:hover {
    color: var(--accent-color);
    transform: scale(1.1);
}

.stats-section.grayed-out .mark-read-btn {
    display: none;
}

.stats-card h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
}

/* Document Cards */
#documents-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.document-card {
    background-color: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
    overflow: hidden;
    transition: transform 0.2s, background-color 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
    position: relative;
}

/* Upcoming document styles */
.document-card.upcoming {
    opacity: 0.75;
    border: 1px dashed var(--border-color);
    background-color: var(--light-color);
}

.document-card.upcoming .document-card-header {
    opacity: 0.85;
}

.document-card.upcoming:hover {
    opacity: 0.95;
    border: 1px dashed var(--primary-color);
}

.upcoming-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--primary-color);
    color: white;
    padding: 3px 7px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 1;
    opacity: 0.9;
}

.public-inspection-badge {
    background-color: var(--accent-color);
}

/* Separator between upcoming and published documents */
.documents-separator {
    grid-column: 1 / -1; /* Make it span all columns */
    margin: 30px 0 25px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.separator-line {
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
}

.separator-text {
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0.7;
    white-space: nowrap;
}

.document-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow-color);
}

/* Glowing effect for new documents */
.document-card.new-document {
    box-shadow: 0 0 10px var(--primary-color), 0 0 20px rgba(0, 113, 227, 0.2);
    border: 1px solid var(--primary-color);
    animation: pulse 2s infinite alternate;
}

.document-card.new-document:hover {
    animation: none;
    box-shadow: 0 8px 25px var(--shadow-color), 0 0 15px var(--primary-color);
}

/* Glowing effect for unclicked documents */
.document-card.unclicked-document {
    box-shadow: 0 0 8px var(--accent-color), 0 0 16px rgba(0, 87, 179, 0.15);
    border: 1px solid var(--accent-color);
    animation: unclicked-pulse 3s infinite alternate;
}

.document-card.unclicked-document:hover {
    animation: none;
    box-shadow: 0 8px 25px var(--shadow-color), 0 0 12px var(--accent-color);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 10px var(--primary-color), 0 0 20px rgba(0, 113, 227, 0.2);
    }
    100% {
        box-shadow: 0 0 15px var(--primary-color), 0 0 30px rgba(0, 113, 227, 0.4);
    }
}

@keyframes unclicked-pulse {
    0% {
        box-shadow: 0 0 8px var(--accent-color), 0 0 16px rgba(0, 87, 179, 0.15);
    }
    100% {
        box-shadow: 0 0 12px var(--accent-color), 0 0 24px rgba(0, 87, 179, 0.25);
    }
}

.document-card-header {
    background: linear-gradient(145deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 15px;
    min-height: 100px; /* Give enough height for the title */
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Document type specific header colors - Using a more consistent blue color palette */
.document-card-header.executive-order {
    background: linear-gradient(145deg, #0066cc, #0080ff); /* Primary blue */
}

.document-card-header.presidential-determination {
    background: linear-gradient(145deg, #0057b3, #0071e3); /* Slightly darker blue */
}

.document-card-header.presidential-memorandum {
    background: linear-gradient(145deg, #004999, #0063cc); /* Even darker blue */
}

.document-card-header.presidential-notice {
    background: linear-gradient(145deg, #80b3ff, #99c2ff); /* Lighter blue - less important */
    opacity: 0.8;
}

.document-card-header.presidential-proclamation {
    background: linear-gradient(145deg, #b3d1ff, #cce0ff); /* Very light blue - least important */
    opacity: 0.8;
}

/* Dark theme version of the colors */
[data-theme="dark"] .document-card-header.executive-order {
    background: linear-gradient(145deg, rgba(0, 102, 204, 0.9), rgba(0, 128, 255, 0.9));
}

[data-theme="dark"] .document-card-header.presidential-determination {
    background: linear-gradient(145deg, rgba(0, 87, 179, 0.9), rgba(0, 113, 227, 0.9));
}

[data-theme="dark"] .document-card-header.presidential-memorandum {
    background: linear-gradient(145deg, rgba(0, 73, 153, 0.9), rgba(0, 99, 204, 0.9));
}

[data-theme="dark"] .document-card-header.presidential-notice {
    background: linear-gradient(145deg, rgba(128, 179, 255, 0.7), rgba(153, 194, 255, 0.7));
}

[data-theme="dark"] .document-card-header.presidential-proclamation {
    background: linear-gradient(145deg, rgba(179, 209, 255, 0.7), rgba(204, 224, 255, 0.7));
}

.document-title {
    font-size: 1.1rem;
    margin: 0;
    color: white;
    font-weight: bold;
    line-height: 1.4;
    max-height: 4.2em; /* Allow for 3 lines of text */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.document-card-body {
    padding: 15px;
}

.document-type {
    display: inline-block;
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 10px;
}

.document-eo-number {
    display: inline-block;
    background-color: rgba(255, 59, 48, 0.8);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-bottom: 10px;
    margin-left: 5px;
    /* Glass effect removed for better performance */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.document-date, .document-type {
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.document-date i, .document-type i {
    margin-right: 8px;
    color: var(--primary-color);
    min-width: 16px;
    text-align: center;
}

.document-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.loading-tags, .loading-definitions {
    font-style: italic;
    color: #888;
    font-size: 0.9rem;
}

.tag-section {
    margin-bottom: 20px;
}

.tag-section + .tag-section {
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.tag-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-tag {
    background-color: var(--light-color);
    border-radius: 6px;
    padding: 12px 15px;
    margin-bottom: 15px;
    border-left: 4px solid var(--primary-color);
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.modal-tag:hover {
    transform: translateY(-2px);
    background-color: var(--card-background);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.modal-tag.entity {
    border-left-color: rgba(0, 102, 204, 0.9); /* Primary blue - same as executive orders */
}

.modal-tag.theme {
    border-left-color: rgba(0, 73, 153, 0.9); /* Darker blue - same as memorandums */
}

.tag-name {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
    font-size: 1.05rem;
}

.tag-description {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.9;
    display: block;
    line-height: 1.4;
}

.keyword-container {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.tag {
    display: inline-block;
    font-size: 0.8rem;
    padding: 4px 10px;
    margin: 3px;
    border-radius: 12px;
    background-color: var(--secondary-color);
    color: white;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.tag:hover {
    transform: translateY(-2px);
    background-color: var(--primary-color);
}

.tag.entity {
    background-color: rgba(0, 102, 204, 0.9); /* Primary blue - same as executive orders */
}

.tag.theme {
    background-color: rgba(0, 73, 153, 0.9); /* Darker blue - same as memorandums */
}

.tag.keyword {
    background-color: rgba(0, 87, 179, 0.9); /* Medium blue - same as determinations */
}

.document-card a {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.9rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    gap: 10px;
}

.pagination button {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.pagination button:hover {
    background-color: var(--light-color);
}

.pagination button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Load More Button */
#load-more-btn {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

#load-more-btn:hover {
    background-color: var(--primary-color);
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 20px;
    grid-column: 1 / -1;
    color: var(--primary-color);
    font-style: italic;
}

/* Modal */
.modal {
    display: none; /* Initial state is hidden */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.6);
}

.modal-content {
    display: flex;
    flex-direction: column;
    background-color: var(--modal-background);
    color: var(--modal-text);
    margin: 1.5% auto; /* Equal margin on top and bottom */
    padding: 0;
    border-radius: 16px;
    width: 90%; /* Larger modal for the 50/50 split */
    height: 94vh; /* Almost full height */
    max-height: 97vh; /* Ensure it doesn't overflow */
    transition: background-color 0.3s ease, color 0.3s ease;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    position: relative; /* For absolute positioning of close button */
}

.modal-header-container {
    width: 100%;
    background-color: var(--light-color);
    padding: 20px 25px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-body-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* New 50/50 split layout */
.modal-left-half {
    width: 50%;
    padding: 0;
    overflow: hidden;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background-color: var(--light-color);
    position: relative;
}

.modal-tab-content {
    flex: 1;
    overflow: auto;
    background-color: var(--card-background);
    position: relative;
}

.modal-right-half {
    width: 50%;
    overflow-y: auto;
    padding: 25px 30px;
    background-color: var(--modal-background);
    display: flex;
    flex-direction: column;
}

/* Old styles removed to prevent conflicts */

.modal-main-content {
    width: 75%;
    overflow-y: auto;
    padding: 25px 30px;
    background-color: var(--modal-background);
    display: flex;
    flex-direction: column;
}

/* Desktop/Mobile visibility */
.desktop-only {
    display: flex;
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: var(--text-color);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 50; /* Higher z-index to ensure it's always on top */
    background-color: rgba(255,255,255,0.2); /* Slight background for visibility */
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close:hover {
    color: var(--accent-color);
}

.document-meta {
    margin-bottom: 15px;
    order: 2;
}

.document-meta table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 6px;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.02);
    margin-bottom: 10px;
}

.document-meta table tr {
    border-bottom: 1px solid var(--border-color);
}

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

.document-meta table td {
    padding: 8px 10px;
    vertical-align: top;
    font-size: 0.9rem;
}

.document-meta table td:first-child {
    font-weight: bold;
    width: 35%;
    border-right: 1px solid var(--border-color);
}

.document-links {
    margin: 15px 0;
    order: 3;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.document-links a {
    display: flex;
    align-items: center;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
    padding: 6px 0;
}

.document-links a:hover {
    color: var(--accent-color);
}

.document-links a i {
    margin-right: 8px;
}

.sidebar-tags, .sidebar-definitions {
    margin: 0;
    padding: 0;
    order: 1;
}

/* Removed redundant styles */

.modal-left-half .chat-section {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    height: 100%;
    width: 100%;
}

.modal-left-half .chat-messages {
    flex: 1;
    min-height: 250px;
    max-height: calc(100% - 100px); /* Leave space for input field */
    overflow-y: auto; /* Ensure scrolling works */
}

.modal-left-half h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 1.2rem;
    padding-left: 5px;
}

.document-content {
    transition: background-color 0.3s ease;
}

#modal-summary, .summary-content {
    margin-bottom: 0;
    padding: 0;
    font-size: 1rem;
    line-height: 1.4;
    transition: background-color 0.3s ease;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Control spacing in summary content */
#modal-summary p, .summary-content p {
    margin-bottom: 0.5rem;
    margin-top: 0;
}

#modal-summary h1, #modal-summary h2, #modal-summary h3, #modal-summary h4, #modal-summary h5, #modal-summary h6,
.summary-content h1, .summary-content h2, .summary-content h3, .summary-content h4, .summary-content h5, .summary-content h6 {
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
}

/* Fix excessive whitespace in summary sections */
#modal-summary > h1:first-child, #modal-summary > h2:first-child, 
.summary-content > h1:first-child, .summary-content > h2:first-child {
    margin-top: 0;
}

/* Ensure all headers in summary have correct color */
#modal-summary h1, #modal-summary h2, #modal-summary h3, #modal-summary h4, #modal-summary h5, #modal-summary h6,
.summary-content h1, .summary-content h2, .summary-content h3, .summary-content h4, .summary-content h5, .summary-content h6 {
    color: var(--primary-color);
}

/* Tighten spacing between lists and paragraphs */
#modal-summary ul, #modal-summary ol,
.summary-content ul, .summary-content ol {
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
    padding-left: 1.2rem;
}

/* Adjust spacing within lists */
#modal-summary li,
.summary-content li {
    margin-bottom: 0.15rem;
    padding-left: 0;
}

/* Remove excess padding from nested lists */
#modal-summary ul ul, #modal-summary ol ol, #modal-summary ul ol, #modal-summary ol ul,
.summary-content ul ul, .summary-content ol ol, .summary-content ul ol, .summary-content ol ul {
    margin-top: 0.1rem;
    margin-bottom: 0.1rem;
}

/* Add space between document content and summary */
.modal-main-content {
    padding-top: 20px;
}

.document-content {
    margin-top: 20px;
}

.modal-header {
    position: relative;
    margin-bottom: 15px;
    z-index: 5;
    width: 100%;
}

.modal-header h2 {
    margin: 0 0 15px 0;
    padding-right: 40px; /* Make space for close button */
    font-size: 1.6rem;
    color: var(--primary-color);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.modal-header-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    margin-right: 30px; /* Make room for close button */
}

.modal-header-meta span {
    display: inline-block;
    padding: 4px 10px;
    background-color: rgba(0, 102, 204, 0.15);
    border-radius: 4px;
    /* Glass effect removed for better performance */
}

.modal-header-links {
    margin-left: auto;
    display: flex;
    gap: 12px;
}

.modal-header-links a {
    display: inline-flex;
    align-items: center;
    font-size: 0.85rem;
    color: white;
    background-color: var(--primary-color);
    padding: 6px 12px;
    border-radius: 4px;
    transition: background-color 0.2s, transform 0.2s;
    /* Glass effect removed for better performance */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header-links a:hover {
    background-color: var(--accent-color);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.modal-header-links a i {
    margin-right: 5px;
}

/* Summary styling is handled by the rules above */

#modal-summary blockquote, .summary-content blockquote {
    border-left: 3px solid var(--primary-color);
    padding-left: 1rem;
    margin-left: 0;
    font-style: italic;
    color: var(--text-color);
    opacity: 0.9;
}

.loading-summary {
    color: #666;
    font-style: italic;
}

.error-summary {
    color: var(--accent-color);
    font-weight: bold;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    margin-top: 10px;
}

.toggle-btn {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

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

/* Document Page View */
.document-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background-color: var(--background-color);
    overflow: hidden;
}

.document-page-container {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    height: 100vh;
    overflow: hidden;
}

.document-page-header {
    background: linear-gradient(135deg, #0066cc, #0080ff);
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

.definition-popup {
    display: none;
    position: absolute;
    top: 100%;
    right: 20px;
    z-index: 100;
    width: 350px;
    background-color: var(--card-background);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 0;
    border-left: 4px solid var(--primary-color);
    margin-top: 10px;
}

.back-button {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    transition: background-color 0.2s;
    align-self: flex-start;
}

.back-button:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.document-page-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Desktop styles for document page header - maintain horizontal layout */
@media (min-width: 769px) {
    .document-page-meta {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
    
    .document-page-meta h2 {
        width: 100%;
    }
    
    .document-page-details {
        margin-right: auto;
    }
}

.document-page-meta h2 {
    font-size: 1.6rem;
    margin: 0;
    color: white;
}

.document-page-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.document-page-details span {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
}

#document-page-type {
    cursor: help;
    text-decoration: underline dotted;
    transition: background-color 0.2s ease;
}

#document-page-type:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.document-page-links {
    margin-left: auto;
    display: flex;
    gap: 10px;
}

.document-page-links a {
    color: white;
    background-color: var(--accent-color);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s;
}

.document-page-links a:hover {
    background-color: var(--secondary-color);
    text-decoration: none;
}

.document-page-body {
    display: flex;
    flex: 1;
    padding: 0 20px 20px 20px;
    gap: 20px;
    overflow: hidden;
}

.document-page-left {
    width: 50%;
    background-color: var(--card-background);
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 2px 10px var(--shadow-color);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    max-height: calc(100vh - 180px);
}

.right-panels-container, .left-panels-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.document-page-right {
    width: 50%;
    display: flex;
    flex-direction: column;
    gap: 0;
    height: calc(100vh - 180px);
    max-height: calc(100vh - 180px);
    background-color: var(--card-background);
    box-shadow: 0 2px 10px var(--shadow-color);
    border-radius: 4px;
    overflow: hidden;
}

.document-page-chat {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    border-radius: 0;
    background-color: var(--card-background);
}

.document-page-tags, #document-page-tags-desktop {
    display: none;
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    border-radius: 0;
    background-color: var(--card-background);
}

#document-page-tags-desktop-content {
    overflow-y: auto;
    height: 100%;
}

.document-page-panel.active {
    display: flex !important;
}

.document-page-chat h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--primary-color);
}

/* Content tabs on the right side */
.document-content-tabs {
    display: flex;
    background-color: var(--light-color);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    overflow: hidden;
}

.document-content-tab {
    padding: 12px 20px;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    transition: all 0.2s ease;
    font-size: 0.95rem;
    border: none;
    background-color: transparent;
    border-bottom: 3px solid transparent;
    flex: 1;
}

.document-content-tab:hover {
    background-color: rgba(0, 102, 204, 0.1);
}

.document-content-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: var(--card-background);
}

.document-content-section {
    background-color: var(--card-background);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px var(--shadow-color);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.document-content-pane {
    display: none;
    padding: 25px;
    overflow-y: auto;
    max-height: 600px;
}

.document-content-pane.active {
    display: block;
}

#document-summary {
    display: none;
    background-color: var(--summary-background);
    border-radius: 0;
    padding: 25px;
    border-left: 4px solid var(--summary-border);
    font-size: 1.05rem;
    line-height: 1.6;
    overflow-y: auto;
    height: 100%;
}

#document-full-text {
    display: none;
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    border-radius: 0;
}

.document-right-panel, .document-left-panel {
    overflow-y: auto;
    flex: 1;
    display: none;
}

.document-right-panel.active, .document-left-panel.active {
    display: block !important;
}

.document-content-section {
    background-color: var(--card-background);
    border-radius: 0 0 0 0;
    overflow: hidden;
    box-shadow: 0 2px 10px var(--shadow-color);
    height: 100%;
    display: flex;
    flex-direction: column;
    border-top: none;
    margin: 0;
}

#document-content {
    white-space: pre-wrap;
    font-family: monospace;
    line-height: 1.6;
    font-size: 1rem;
    padding: 20px;
}

.document-tabs {
    display: flex;
    background-color: var(--light-color);
    border-radius: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
}

.document-tab {
    padding: 12px 20px;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    transition: all 0.2s ease;
    font-size: 0.95rem;
    border: none;
    background-color: transparent;
    border-bottom: 3px solid transparent;
    flex: 1;
}

.document-tab:hover {
    background-color: rgba(0, 102, 204, 0.1);
}

.document-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: var(--card-background);
    margin-bottom: -1px; /* Overlap the border */
}

.document-tag {
    background-color: var(--light-color);
    border-radius: 8px;
    padding: 15px 18px;
    margin-bottom: 18px;
    border-left: 4px solid var(--primary-color);
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: block;
    width: 100%;
}

.document-tag:hover {
    transform: translateY(-2px);
    background-color: var(--card-background);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.document-tag.entity {
    border-left-color: #4a7fc1;
}

.document-tag.theme {
    border-left-color: #bf0a30;
}

@media (max-width: 768px) {
    .document-page-body {
        flex-direction: column;
        padding: 5px;
    }
    
    .document-page-left {
        width: 100%;
        height: calc(100vh - 130px);
        max-height: calc(100vh - 130px);
    }
    
    .document-page-right {
        display: none !important;
    }
    
    /* Regular tabs on desktop */
    .document-page-left .document-tabs,
    .document-page-right .document-tabs {
        display: none;
    }
    
    /* Single mobile tab bar */
    .mobile-tabs-container {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 100;
        width: 100%;
        background-color: var(--light-color);
        border-bottom: 1px solid var(--border-color);
    }
    
    .mobile-tab-item {
        flex: 1;
        white-space: nowrap;
        text-align: center;
        padding: 6px 4px;
        font-size: 0.75rem;
        font-weight: 500;
        color: var(--text-color);
        border-bottom: 2px solid transparent;
        transition: all 0.2s ease;
        cursor: pointer;
    }
    
    .mobile-tab-item.active {
        color: var(--primary-color);
        border-bottom-color: var(--primary-color);
        background-color: var(--card-background);
    }
    
    .document-page-header {
        padding: 8px;
        gap: 3px;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
    
    .back-button {
        padding: 4px 8px;
        font-size: 0.8rem;
        margin-bottom: 0;
        margin-right: 8px;
        order: -1;
    }
    
    .document-page-meta h2 {
        font-size: 1.05rem;
        margin-bottom: 4px;
        line-height: 1.2;
    }
    
    .document-page-meta {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
    }
    
    .document-page-meta h2 {
        width: 100%;
        font-size: 1.05rem;
        margin-bottom: 5px;
        line-height: 1.2;
    }
    
    .document-page-meta:after {
        content: '';
        display: block;
        width: 100%;
        order: 1;
    }
    
    .document-page-details {
        width: auto;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        margin-bottom: 0;
        display: inline-flex;
        order: 2;
    }
    
    .document-page-details span {
        padding: 5px 8px;
        font-size: 0.85rem;
    }
    
    .document-page-links {
        display: inline-flex;
        gap: 6px;
        justify-content: flex-start;
        margin: 0;
        width: auto;
        order: 3;
        margin-left: auto;
    }
    
    .document-page-links a {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    
    .document-content-pane {
        max-height: 400px;
        padding: 15px;
    }
}

/* Chat Styles */
.chat-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0;
    margin: 0;
    height: 100%;
}

/* Regular chat section (in tab content) */
.desktop-tab-content .chat-section {
    border-top: none;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: var(--card-background);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 15px;
    min-height: 250px; /* Slightly smaller to fit in split view */
}

/* Make chat messages area taller in the document page tab view */
.document-tab-content .chat-messages {
    min-height: 450px;
    max-height: calc(100vh - 300px); /* Allow it to grow but not too much */
}

.chat-message {
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 8px;
    max-width: 85%;
    position: relative;
}

.user-message {
    background-color: var(--secondary-color);
    color: white;
    margin-left: auto;
    border-radius: 18px 18px 0 18px;
}

.ai-message {
    background-color: var(--light-color);
    border-left: 3px solid var(--primary-color);
    margin-right: auto;
    border-radius: 18px 18px 18px 0;
}

.chat-input {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 0; /* Remove bottom margin */
}

.modal-left-half .chat-input {
    margin-top: 5px;
    margin-bottom: 5px; /* Add small bottom margin for spacing */
}

.chat-input input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    background-color: var(--card-background);
    color: var(--text-color);
    font-size: 1rem;
}

.document-tab-content .chat-input input {
    padding: 12px 16px;
    font-size: 1rem;
    border-width: 2px;
}

.modal-left-half .chat-input input {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.chat-input button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: bold;
    margin-right: 5px; /* Add right margin to avoid sticking to edge */
}

.document-tab-content .chat-input button {
    padding: 12px 22px;
    font-size: 1rem;
}

.modal-left-half .chat-input button {
    padding: 8px 15px;
    font-size: 0.9rem;
}

.chat-input button:hover {
    background-color: var(--secondary-color);
}

.chat-timestamp {
    font-size: 0.75rem;
    color: var(--text-color);
    opacity: 0.7;
    text-align: right;
    margin-top: 5px;
}

.chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    font-style: italic;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 15px;
}

.chat-loading::after {
    content: '...';
    animation: loading-dots 1.5s infinite;
    width: 20px;
    text-align: left;
}

@keyframes loading-dots {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

.ai-message p {
    margin: 0 0 10px 0;
}

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

/* Notifications */
.summary-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--primary-color);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 300px;
    animation: slideIn 0.3s ease-out forwards;
    z-index: 1000;
    transition: all 0.3s ease;
}

.summary-notification button {
    background: transparent;
    border: 1px solid white;
    color: white;
    padding: 4px 8px;
    margin-left: 10px;
    border-radius: 3px;
    cursor: pointer;
}

.summary-notification button:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

/* Footer */
footer {
    background: linear-gradient(135deg, #0066cc, #0080ff); /* Primary blue gradient - matches header */
    color: white;
    padding: 30px 0 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] footer {
    background: linear-gradient(135deg, #0066cc, #0080ff); /* Dark theme blue */
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-top {
    margin-bottom: 30px;
}

.stats-section-title {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 15px;
    text-align: center;
}

.stats-flex-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-bottom {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

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

.data-processing-info {
    font-size: 0.85rem;
    opacity: 0.8;
    max-width: 600px;
    margin: 0.5rem auto 0;
}

/* Signing Patterns Section in Footer */
footer .signing-patterns-section {
    background: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 0;
}

footer .section-header h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: white;
}

/* Day of Week Heatmap in Footer */
footer .day-of-week-heatmap {
    margin: 0 auto;
    max-width: 800px;
}

footer .dow-title {
    color: white;
    text-align: center;
}

footer .legend-title,
footer .legend-subtitle {
    color: white;
}

footer .day-cell {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

footer .level-1 { background-color: rgba(255, 255, 255, 0.1); }
footer .level-2 { background-color: rgba(255, 255, 255, 0.2); }
footer .level-3 { background-color: rgba(255, 255, 255, 0.3); }
footer .level-4 { background-color: rgba(255, 255, 255, 0.4); }
footer .level-5 { background-color: rgba(255, 255, 255, 0.6); }

footer .color-sample.level-1 { background-color: rgba(255, 255, 255, 0.1); }
footer .color-sample.level-2 { background-color: rgba(255, 255, 255, 0.2); }
footer .color-sample.level-3 { background-color: rgba(255, 255, 255, 0.3); }
footer .color-sample.level-4 { background-color: rgba(255, 255, 255, 0.4); }
footer .color-sample.level-5 { background-color: rgba(255, 255, 255, 0.6); }

.document-stats {
    flex: 0 1 300px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.day-of-week-heatmap {
    flex: 0 1 650px;
}

[data-theme="dark"] .document-stats {
    background-color: rgba(0, 0, 0, 0.2);
}

/* Adjust for mobile */
@media (max-width: 768px) {
    .stats-flex-container {
        flex-direction: column;
    }

    .document-stats, .day-of-week-heatmap {
        width: 100%;
    }
    
    .document-stats {
        margin-top: 20px;
    }
}

/* Chat in Modal */
.chat-container {
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

/* Modal Tags */
.modal-tag {
    display: block;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
    cursor: pointer;
    font-size: 0.9rem;
}

[data-theme="dark"] .modal-tag {
    background-color: rgba(255, 255, 255, 0.05);
}

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

.modal-tag.entity {
    border-left: 3px solid #4a7fc1;
}

.modal-tag.theme {
    border-left: 3px solid #bf0a30;
}

.tag-section {
    margin-bottom: 20px;
}

.tag-section h4 {
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: var(--text-color);
    opacity: 0.85;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .filters {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filters li {
        width: 100%;
    }
    
    .filters select {
        width: 100%;
    }
    
    .document-meta {
        grid-template-columns: 1fr;
    }
    
    /* Desktop tabs styling */
.desktop-tabs {
    display: flex;
    flex-direction: row;
    background-color: var(--light-color);
    width: 100%;
    border-bottom: 1px solid var(--border-color);
}

.desktop-tab {
    padding: 10px 20px;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    transition: all 0.2s ease;
    font-size: 0.95rem;
    border: none;
    background-color: transparent;
    border-bottom: 3px solid transparent;
    margin: 0;
    flex: 1;
}

.desktop-tab:hover {
    background-color: rgba(0, 102, 204, 0.1);
}

.desktop-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: var(--card-background);
}

.desktop-tab-content {
    display: none;
    height: calc(100% - 45px); /* Adjust based on tab height */
    overflow-y: auto;
    padding: 15px 20px;
    background-color: var(--card-background);
    width: 100%;
}

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

/* Modal changes for mobile */
    .modal-content {
        flex-direction: column;
        width: 95%;
        margin: 2% auto;
        height: 80vh;
        overflow-y: hidden;
    }
    
    .modal-header-container {
        padding: 12px 15px;
    }
    
    .modal-header h2 {
        font-size: 1.2rem;
        line-height: 1.3;
        margin-bottom: 8px;
    }
    
    .modal-header-meta {
        flex-wrap: wrap;
        gap: 6px;
        font-size: 0.8rem;
    }
    
    .modal-header-meta span {
        padding: 3px 8px;
    }
    
    .modal-header-links {
        margin-left: 0;
        margin-top: 8px;
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    
    .modal-header-links a {
        font-size: 0.75rem;
        padding: 5px 8px;
        width: 100%;
        justify-content: center;
    }
    
    /* Create tabs for mobile view */
    .modal-body-container {
        display: block;
        overflow-y: hidden;
        height: calc(100% - 120px);
        flex-direction: column;
    }
    
    /* Hide desktop split layout on mobile */
    .modal-left-half, .modal-right-half {
        display: none;
    }
    
    .mobile-tabs {
        display: flex;
        background-color: var(--light-color);
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 0;
        z-index: 10;
        width: 100%;
    }
    
    .mobile-tab {
        padding: 10px 15px;
        flex: 1;
        text-align: center;
        cursor: pointer;
        font-weight: 500;
        color: var(--text-color);
        border-bottom: 3px solid transparent;
        transition: all 0.2s ease;
    }
    
    .mobile-tab.active {
        color: var(--primary-color);
        border-bottom-color: var(--primary-color);
        background-color: var(--modal-background);
    }
    
    .tab-content {
        display: none;
        height: calc(100% - 45px);
        overflow-y: auto;
        padding: 15px 15px 5px 15px; /* Add padding with reduced bottom padding */
    }
    
    .tab-content.active {
        display: block;
    }
    
    .modal-sidebar {
        width: 100%;
        padding: 12px 15px;
        border-right: none;
        border-bottom: none;
        max-height: none;
    }
    
    /* Show tags horizontally on mobile */
    .sidebar-tags {
        margin: 0;
        padding: 0;
    }
    
    .tag-container {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .modal-tag {
        display: inline-block;
        padding: 6px 10px;
        margin-right: 6px;
        margin-bottom: 6px;
    }
    
    .document-meta table {
        font-size: 0.8rem;
    }
    
    .document-meta table td {
        padding: 6px 8px;
    }
    
    .document-links {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin: 10px 0;
    }
    
    .document-links a {
        padding: 6px 8px;
        font-size: 0.8rem;
        margin: 0;
    }
    
    .modal-main-content {
        width: 100%;
        padding: 12px 15px;
    }
    
    /* Adjust chat section for mobile */
    .chat-section {
        padding-top: 0;
        margin-top: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .chat-messages {
        flex: 1;
        max-height: none;
        min-height: 200px;
        padding: 10px;
    }
    
    .chat-input {
        margin-top: 10px;
    }
    
    .chat-input input {
        padding: 8px 10px;
    }
    
    .chat-input button {
        padding: 8px 15px;
    }
}

/* Signing Patterns Section */
.signing-patterns-section {
    margin-bottom: 30px;
    background-color: var(--card-background);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 5px var(--shadow-color);
}

/* Day of Week Heatmap */
.day-of-week-heatmap {
    margin-top: 20px;
}

.dow-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

.day-heatmap {
    display: flex;
    justify-content: center;
    margin: 15px 0;
    gap: 10px;
}

.day-cell {
    flex: 1;
    padding: 15px 5px;
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 1px 3px var(--shadow-color);
}

.day-cell:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.day-label {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.day-count {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Level colors */
.level-1 { background-color: var(--heatmap-color-1); }
.level-2 { background-color: var(--heatmap-color-2); }
.level-3 { background-color: var(--heatmap-color-3); }
.level-4 { background-color: var(--heatmap-color-4); }
.level-5 { background-color: var(--heatmap-color-5); color: white; }

.heatmap-legend {
    display: flex;
    justify-content: center;
    margin-top: 15px;
}

.chart-legend {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.legend-title {
    font-size: 0.8rem;
    color: var(--text-color);
    margin-bottom: 5px;
}

.legend-colors {
    display: flex;
    gap: 3px;
    margin: 5px 0;
    justify-content: center;
}

.color-sample {
    width: 15px;
    height: 15px;
    border-radius: 2px;
}

.color-sample.level-1 { background-color: var(--heatmap-color-1); }
.color-sample.level-2 { background-color: var(--heatmap-color-2); }
.color-sample.level-3 { background-color: var(--heatmap-color-3); }
.color-sample.level-4 { background-color: var(--heatmap-color-4); }
.color-sample.level-5 { background-color: var(--heatmap-color-5); }

.legend-subtitle {
    font-size: 0.7rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-top: 5px;
}

/* Responsive for Day Heatmap */
@media (max-width: 768px) {
    .day-cell {
        padding: 10px 3px;
    }
    
    .day-label {
        font-size: 0.7rem;
    }
    
    .day-count {
        font-size: 1rem;
    }
}

.coming-soon-section {
    margin-bottom: 30px;
    background-color: rgba(0, 102, 204, 0.05);
    border-radius: 10px;
    padding: 20px;
    border-left: 4px solid var(--primary-color);
}

.coming-soon-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

/* Tabs for public inspection/pending documents */
.pending-tabs {
    display: flex;
    background-color: var(--light-color);
    border-radius: 8px 8px 0 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

.pending-tab {
    padding: 12px 20px;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    transition: all 0.2s ease;
    font-size: 0.95rem;
    border: none;
    background-color: transparent;
    border-bottom: 3px solid transparent;
    flex: 1;
}

.pending-tab:hover {
    background-color: rgba(0, 102, 204, 0.1);
}

.pending-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: var(--card-background);
}

.pending-content {
    display: none;
}

.pending-content.active {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.coming-soon-card {
    background-color: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 2px 10px var(--shadow-color);
    overflow: hidden;
    transition: transform 0.2s;
    border: 1px solid var(--border-color);
    position: relative;
}

.coming-soon-card:hover {
    transform: translateY(-5px);
}

.coming-soon-badge, .special-filing-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    z-index: 1;
}

.special-filing-badge {
    top: 40px;
    background-color: var(--accent-color);
}

.coming-soon-date {
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-top: 5px;
}

.coming-soon-card-header {
    background: linear-gradient(145deg, #e6e6e6, #f0f0f0);
    color: var(--text-color);
    padding: 15px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .coming-soon-card-header {
    background: linear-gradient(145deg, #2a2a2e, #323236);
}

.coming-soon-title {
    font-size: 1.1rem;
    margin: 0;
    font-weight: bold;
    line-height: 1.4;
    max-height: 4.2em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.coming-soon-card-body {
    padding: 15px;
}

.coming-soon-eo-number {
    display: inline-block;
    background-color: rgba(0, 102, 204, 0.8);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
</style>
