/* 
 * JFK Document Archive
 * Modern, responsive styling with subtle animations 
 */

:root {
    --primary-color: #1a3a5f;
    --secondary-color: #b7343a;
    --accent-color: #dcd7c9;
    --light-color: #f8f8f2;
    --dark-color: #2c3e50;
    --gray-color: #94a3b8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --radius: 8px;
}

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

body {
    font-family: 'Source Sans Pro', sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f9fafb;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header styles */
header {
    background-color: var(--primary-color);
    color: var(--light-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--box-shadow);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    flex-direction: column;
}

.logo h1 {
    font-size: 1.8rem;
    margin-bottom: 0;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: 300;
}

nav {
    display: flex;
    gap: 0.5rem;
}

.nav-button {
    background: none;
    border: none;
    color: var(--light-color);
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition);
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.nav-button.active {
    background-color: rgba(255, 255, 255, 0.2);
    opacity: 1;
}

/* Main content */
main {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    position: relative;
}

/* Main content layout */
.dashboard-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.dashboard-main {
    grid-column: 1;
}

.dashboard-sidebar {
    grid-column: 2;
}

/* Dashboard stats cards */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* Loading Screen */
#loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f9fafb;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--accent-color);
    border-radius: 50%;
    border-top-color: var(--secondary-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

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

/* View management */
.view {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.view.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Dashboard View */
.dashboard-header {
    margin-bottom: 2rem;
    text-align: center;
}

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

.stat-card {
    background-color: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center;
    transition: var(--transition);
}

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

.stat-icon {
    background-color: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.5rem;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--primary-color);
}

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

.chart-container {
    background-color: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
}

.horizontal-bar-chart {
    margin-top: 20px;
}

/* Decade bar chart styling */
.decades-chart {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
    height: 200px;
    width: 100%;
}

.decade-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    max-width: 60px;
    position: relative;
    margin: 0 3px;
}

.decade-bar {
    width: 30px;
    background-color: var(--primary-color);
    border-radius: 3px 3px 0 0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.decade-bar:hover {
    background-color: var(--accent-color);
    transform: scaleY(1.05);
}

.decade-label {
    margin-top: 5px;
    font-size: 0.8rem;
    color: var(--text-color);
    text-align: center;
}

.decade-count {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 5px;
    text-align: center;
}

.recent-documents {
    background-color: var(--white-color);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-left: 20px;
    padding: 1.25rem;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.document-cards {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

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

.document-card {
    background-color: white;
    border-radius: var(--radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--light-gray-color);
    cursor: pointer;
}

.document-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.document-header {
    padding: 15px;
    background-color: var(--dark-blue-color);
    color: white;
}

.document-title {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.4;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-info {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background-color: #f5f7fa;
    border-bottom: 1px solid var(--light-gray-color);
    font-size: 0.9rem;
}

.document-date, .document-pages {
    display: flex;
    align-items: center;
    color: var(--text-color);
}

.document-date i, .document-pages i {
    margin-right: 5px;
    color: var(--accent-color);
}

.document-excerpt {
    padding: 15px;
    flex-grow: 1;
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Timeline View Styling */
.timeline-container {
    margin: 2rem 0;
}

.timeline-year {
    margin-bottom: 2rem;
}

.timeline-year-header {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    display: inline-block;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.timeline-month {
    margin-left: 2rem;
    margin-bottom: 1.5rem;
}

.timeline-month-header {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0.3rem;
}

.timeline-document-list {
    list-style: none;
    padding-left: 1rem;
    margin: 0;
}

.timeline-document-item {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.timeline-document-item a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

.timeline-document-item a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.timeline-document-date {
    color: var(--gray-color);
    font-size: 0.85rem;
}

/* Timeline View */
.timeline-header {
    margin-bottom: 2rem;
    text-align: center;
}

.timeline-container {
    position: relative;
    margin: 40px 0;
}

.timeline-container::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background-color: var(--primary-color);
    transform: translateX(-50%);
}

.timeline-year {
    margin-bottom: 40px;
    position: relative;
}

.year-label {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    display: inline-block;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 20px;
    z-index: 2;
}

.timeline-items {
    position: relative;
}

.timeline-item {
    display: flex;
    margin-bottom: 30px;
    opacity: 0;
    animation: fadeInTimeline 0.5s forwards;
    animation-delay: calc(var(--index) * 0.1s);
}

@keyframes fadeInTimeline {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

.timeline-item:nth-child(odd) {
    justify-content: flex-end;
}

.timeline-content {
    width: 45%;
    background-color: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--box-shadow);
    position: relative;
    transition: var(--transition);
}

.timeline-content:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.timeline-item:nth-child(odd) .timeline-content::before {
    content: '';
    position: absolute;
    top: 20px;
    right: -10px;
    width: 20px;
    height: 20px;
    background-color: white;
    transform: rotate(45deg);
}

.timeline-item:nth-child(even) .timeline-content::before {
    content: '';
    position: absolute;
    top: 20px;
    left: -10px;
    width: 20px;
    height: 20px;
    background-color: white;
    transform: rotate(45deg);
}

.timeline-date {
    color: var(--gray-color);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.timeline-title {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.view-timeline-doc {
    margin-top: 1rem;
    display: inline-block;
    font-size: 0.9rem;
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
}

.view-timeline-doc:hover {
    color: var(--secondary-color);
}

/* About View */
.about-content {
    background-color: white;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
    max-width: 800px;
    margin: 0 auto;
}

.about-content h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.about-content h3 {
    margin: 1.5rem 0 0.5rem;
    color: var(--dark-color);
}

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

.about-content ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 5vh auto;
    width: 90%;
    max-width: 1200px;
    border-radius: var(--radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalFadeIn 0.3s;
}

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

.close-modal {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}

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

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--light-gray-color);
    background-color: #f8f9fa;
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-header h2 {
    margin: 0 0 10px 0;
    font-size: 1.6rem;
    color: var(--dark-color);
    padding-right: 30px;
    line-height: 1.3;
}

.modal-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 0.9rem;
}

.modal-date, .modal-filename, .modal-page-count {
    display: inline-flex;
    align-items: center;
    font-size: 0.9rem;
}

.modal-date::before {
    content: '\f073';
    font-family: 'Font Awesome 5 Free';
    margin-right: 5px;
    color: var(--accent-color);
}

.modal-filename::before {
    content: '\f15b';
    font-family: 'Font Awesome 5 Free';
    margin-right: 5px;
    color: var(--accent-color);
}

.modal-page-count::before {
    content: '\f15c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 5px;
    color: var(--accent-color);
}

.modal-tabs {
    display: flex;
    gap: 1px;
    background-color: #e9ecef;
    border-radius: 4px;
    padding: 2px;
    margin-top: 10px;
}

.modal-tab-btn {
    padding: 8px 15px;
    background-color: #f8f9fa;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    flex: 1;
    font-weight: 500;
    transition: all 0.2s;
    color: var(--text-color);
}

.modal-tab-btn.active {
    background-color: white;
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.modal-tab-btn:hover:not(.active) {
    background-color: #e2e6ea;
}

.modal-body {
    padding: 0;
    overflow: auto;
    flex: 1;
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

.modal-tab {
    display: none;
    padding: 1.5rem;
    height: 100%;
    overflow: auto;
}

.modal-tab.active {
    display: block;
}

#modal-summary, #modal-analysis, #modal-content {
    line-height: 1.6;
}

#document-actions {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.action-btn:hover, .action-btn:focus {
    background: linear-gradient(135deg, #005cbf, #004494);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
    color: white;
}

#document-content {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: var(--radius);
    white-space: pre-wrap;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-x: auto;
}

/* Responsive styles */
@media (max-width: 992px) {
    .header-content, .footer-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    nav {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .dashboard-charts {
        grid-template-columns: 1fr;
    }
    
    .documents-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-controls {
        width: 100%;
    }
    
    .search-bar {
        width: 100%;
    }
    
    .timeline-container::before {
        left: 20px;
    }
    
    .year-label {
        left: 20px;
        transform: none;
    }
    
    .timeline-item {
        justify-content: flex-start;
        margin-left: 40px;
    }
    
    .timeline-content {
        width: 100%;
    }
    
    .timeline-item:nth-child(odd) .timeline-content::before,
    .timeline-item:nth-child(even) .timeline-content::before {
        left: -10px;
        right: auto;
    }
}

@media (max-width: 576px) {
    .documents-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 0;
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
    }
    
    .document-metadata {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Document Collection View */
.filter-panel {
    background-color: var(--light-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2.5rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--light-gray-color);
}

.filter-section {
    margin-bottom: 2rem;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-group {
    margin-bottom: 1.5rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pagination button {
    background-color: white;
    border: 1px solid #e5e7eb;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination button:not(:disabled):hover {
    background-color: var(--primary-color);
    color: white;
}

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

#page-indicator {
    font-size: 0.9rem;
}

/* Documents View Styling */
.documents-view {
    padding: 2rem;
}

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

.search-controls {
    background-color: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.search-bar {
    position: relative;
    min-width: 300px;
    flex: 1;
}

.search-bar i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-color);
}

#document-search {
    width: 100%;
    padding: 0.5rem 0.5rem 0.5rem 2rem;
    border: 1px solid var(--gray-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
}

.date-filters {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: nowrap;
}

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

.date-filter label {
    font-weight: 500;
    color: var(--dark-color);
    white-space: nowrap;
}

.date-filter input {
    padding: 0.5rem;
    border: 1px solid var(--gray-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    width: 150px;
}

.filter-buttons {
    display: flex;
    gap: 0.75rem;
}

#apply-filters, #clear-filters {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
}

#apply-filters {
    background-color: var(--primary-color);
    color: white;
}

#clear-filters {
    background-color: #e5e7eb;
    color: var(--dark-color);
}

#apply-filters:hover {
    background-color: var(--dark-color);
}

#clear-filters:hover {
    background-color: #d1d5db;
}

/* Document Search and Filters */
.search-container {
    display: none; /* Hide old search styles if they exist */
}

.form-control {
    padding: 8px 12px;
    border: 1px solid var(--light-gray-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: all 0.3s;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.search-input-container {
    position: relative;
    margin-bottom: 15px;
    flex: 1;
}

.search-input-container input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 1px solid var(--light-gray-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: all 0.3s;
}

.search-input-container input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.search-input-container input::placeholder {
    color: #adb5bd;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-color);
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
}

.date-range {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.date-range label {
    font-weight: 500;
    color: var(--text-color);
    margin-right: 5px;
}

.date-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-separator {
    color: var(--text-color);
    font-weight: 500;
}

.date-range input[type="date"] {
    padding: 8px 12px;
    border: 1px solid var(--light-gray-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    width: 140px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
}

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

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

.secondary-btn {
    background-color: #e9ecef;
    color: var(--text-color);
}

.secondary-btn:hover {
    background-color: #dee2e6;
}

@media (max-width: 768px) {
    .filter-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-buttons {
        margin-left: 0;
        width: 100%;
    }
    
    .filter-btn {
        flex: 1;
    }
    
    .date-range {
        width: 100%;
    }
}
