/* Global Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #fafafa;
    color: #1a1a1a;
    line-height: 1.6;
}

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

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header Section */
.header-section {
    width: 100%;
    padding: 4rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-bottom: 3rem;
}

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

.main-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin: 0 auto 2rem auto;
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

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

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5a6fd8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Neutralize the primary button within report item cards only */
.card-footer .btn-primary {
    background-color: #e5e7eb;
    color: #374151;
    border: 1px solid #d1d5db;
    box-shadow: none;
}

.card-footer .btn-primary:hover {
    background-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Filter Section */
.filter-section {
    padding: 2rem 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 0 auto 2rem auto;
    max-width: 1200px;
}

.filter-content {
    max-width: 800px;
    margin: 0 auto;
}

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

.filter-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.result-count {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Search and Year Row */
.search-year-row {
    display: flex;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 300px;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.year-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 150px;
}

.year-selector label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
}

.year-dropdown {
    padding: 0.75rem 0.75rem;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    font-size: 1rem;
    background-color: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.year-dropdown:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.year-dropdown:hover {
    border-color: #d1d5db;
}

.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Mobile collapsible tags */
.tag-toggle-btn {
    display: block;
    margin: 0.75rem auto 1rem auto;
    background: #e5e7eb;
    color: #374151;
    border: none;
    padding: 0.5rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.tag-toggle-btn:hover {
    background: #d1d5db;
}

/* Collapsed state (mobile) */
.tags-collapsed {
    position: relative;
    /* roughly 3 rows of pill tags including gaps */
    max-height: 130px;
    overflow: hidden;
}

.tags-collapsed::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 44px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255,255,255,0), #ffffff);
}

.tag-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.tag-badge-primary {
    background-color: #667eea;
    color: white;
}

.tag-badge-secondary {
    background-color: #f3f4f6;
    color: #374151;
}

.tag-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Reports Section */
.reports-section {
    padding: 3rem 0;
    background: #fafafa;
    flex: 1;
}

.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.report-card {
    transition: all 0.3s ease;
}

.report-card:hover {
    transform: translateY(-4px);
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

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

.card-header {
    padding: 1.5rem 1.5rem 0 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: #1a1a1a;
    line-height: 1.4;
}

.card-year {
    font-size: 0.875rem;
    color: #6b7280;
}

.card-body {
    padding: 1rem 1.5rem;
    flex: 1;
}

.card-tags {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

.card-footer {
    padding: 0 1.5rem 1.5rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-type {
    font-size: 0.75rem;
    color: #9ca3af;
    font-weight: 500;
}

/* Footer Section */
.footer-section {
    width: 100%;
    padding: 3rem 0;
    background: white;
    border-top: 1px solid #e5e5e5;
    margin-top: 3rem;
}

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

.footer-content p {
    margin: 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.footer-content a {
    color: #667eea;
    text-decoration: none;
}

.footer-content a:hover {
    text-decoration: underline;
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .header-section {
        padding: 2rem 0;
    }
    
    .main-title {
        font-size: 2.5rem;
    }
    
    .filter-section {
        padding: 2rem 0 1.5rem 0;
        margin: 0 auto 1.5rem auto;
    }
    
    .tag-container {
        margin-bottom: 1rem;
    }
    .tag-toggle-btn {
        display: block;
    }
    
    .reports-section {
        padding: 2rem 0 3rem 0;
    }
    
    .reports-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .button-group {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .filter-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .search-year-row {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .search-input {
        min-width: unset;
        width: 100%;
    }
    
    .year-selector {
        width: 100%;
    }
    
    .year-dropdown {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header-section {
        padding: 1.5rem 0;
    }
    
    .main-title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .filter-section {
        padding: 1.5rem 0 1rem 0;
        margin: 0 auto 1rem auto;
    }
    
    .tag-container {
        margin-bottom: 1.5rem;
        gap: 0.75rem;
    }
    
    .reports-section {
        padding: 1.5rem 0 2rem 0;
    }
    
    .container {
        padding: 0 0.75rem;
    }
}