/* ============================================
   Global Styles and Reset
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #0056b3;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* ============================================
   Header Styles
   ============================================ */

.header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 2rem 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.collection-description {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    opacity: 0.95;
}

.statistics {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-label {
    font-weight: 600;
    opacity: 0.9;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
}

/* ============================================
   Disclaimer Banner Styles
   ============================================ */

.disclaimer-banner {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-bottom: 3px solid #ffc107;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
    position: sticky;
    top: 0;
    z-index: 101;
}

.disclaimer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.disclaimer-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.disclaimer-text {
    font-size: 0.95rem;
    color: #856404;
    line-height: 1.5;
}

.disclaimer-text strong {
    font-weight: 700;
    color: #664d03;
}

.disclaimer-text a {
    color: #0056b3;
    font-weight: 600;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.disclaimer-text a:hover {
    color: #003d82;
}

/* ============================================
   Navigation and Search Styles
   ============================================ */

.navigation {
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
}

.search-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

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

.clear-button {
    padding: 0.75rem 1.5rem;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.clear-button:hover {
    background-color: #e0e0e0;
    border-color: #999;
}

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

.result-count {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
    line-height: 1.5;
}

/* Highlight result count when filters are active */
.result-count.has-filters {
    color: #007bff;
    font-weight: 600;
}

/* ============================================
   Filter Component Styles
   ============================================ */

.filter-container {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

.filter-dropdown {
    padding: 0.75rem 1rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: inherit;
}

.filter-dropdown:hover {
    border-color: #999;
}

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

/* Active filter indicator - when a value is selected */
.filter-dropdown:not([value=""]):valid,
.filter-dropdown.active,
.filter-dropdown.filter-active {
    border-color: #007bff;
    background-color: #f0f8ff;
    font-weight: 600;
}

/* Visual indicator when filters are active */
.filter-container.has-active-filters {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.filter-container.has-active-filters .clear-filters-button {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.filter-container.has-active-filters .clear-filters-button:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.clear-filters-button {
    padding: 0.75rem 1.5rem;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    align-self: flex-end;
    white-space: nowrap;
}

.clear-filters-button:hover {
    background-color: #e0e0e0;
    border-color: #999;
}

.clear-filters-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.clear-filters-button:active {
    background-color: #d0d0d0;
}

/* ============================================
   Main Content Styles
   ============================================ */

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: calc(100vh - 400px);
}

/* ============================================
   Gallery Grid Styles
   ============================================ */

.gallery-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
    margin-bottom: 2rem;
    grid-auto-rows: auto;
    align-items: start;
}

/* Mobile: 1 column (max-width: 640px) */
@media (max-width: 640px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0;
    }
}

/* Tablet: 1 column (641px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding: 0;
    }
}

/* Desktop: 1 column (1025px and above) */
@media (min-width: 1025px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0;
    }
}

/* Large Desktop: 1 column (1400px and above) */
@media (min-width: 1400px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* ============================================
   Image Card Styles
   ============================================ */

.image-card {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background-color: white;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.image-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.image-card:focus-within {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.image-card.hidden {
    display: none;
}

.image-wrapper {
    position: relative;
    width: 100%;
    overflow: visible;
    background-color: #f0f0f0;
    flex-shrink: 0;
}

.image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.image-card:hover .image-overlay {
    opacity: 1;
}

.pdf-link-button {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background-color: #007bff;
    color: white;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.pdf-link-button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.pdf-link-button:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.pdf-link-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.pdf-link-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: scale(1);
}

.card-metadata {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-filename {
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 0.5rem;
    word-break: break-word;
    line-height: 1.4;
}

.card-info {
    font-size: 0.85rem;
    color: #666;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card-info-item {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.card-info-label {
    font-weight: 500;
    flex-shrink: 0;
}

.card-info-value {
    color: #999;
    text-align: right;
    word-break: break-word;
}

/* ============================================
   Loading State Styles
   ============================================ */

.loading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    gap: 1rem;
}

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

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

.loading p {
    color: #666;
    font-size: 1rem;
}

/* ============================================
   No Results Styles
   ============================================ */

.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
    font-size: 1.1rem;
}

.no-results strong {
    color: #333;
    font-size: 1.3rem;
    display: block;
    margin-bottom: 1rem;
}

.no-results ul.filter-list {
    list-style: none;
    padding: 0;
    margin: 1rem auto;
    max-width: 400px;
    text-align: left;
}

.no-results ul.filter-list li {
    padding: 0.5rem 1rem;
    background-color: #f8f9fa;
    border-left: 3px solid #007bff;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.no-results em {
    font-style: normal;
    font-weight: 600;
    color: #007bff;
}

.inline-clear-button {
    display: inline;
    padding: 0.25rem 0.75rem;
    background-color: #007bff;
    color: white;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    border: none;
}

.inline-clear-button:hover {
    background-color: #0056b3;
}

.inline-clear-button:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* ============================================
   Filter Error State Styles
   ============================================ */

.filter-container.filter-error {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    padding: 1rem;
    border-radius: 8px;
}

.filter-error-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: #fff;
    border-radius: 4px;
    margin-top: 0.5rem;
    border-left: 3px solid #ffc107;
}

.filter-error-message .error-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.filter-error-message .error-text {
    font-size: 0.9rem;
    color: #856404;
    font-weight: 500;
}

.filter-dropdown.filter-disabled,
.clear-filters-button.filter-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f0f0f0;
}

.filter-dropdown.filter-disabled:hover {
    border-color: #ddd;
}

.clear-filters-button.filter-disabled:hover {
    background-color: #f0f0f0;
    border-color: #ddd;
}

/* ============================================
   Footer Styles
   ============================================ */

.footer {
    background-color: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    padding: 2rem 1rem;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

.footer-content p {
    margin: 0.5rem 0;
}

.footer-content a {
    color: #007bff;
}

.footer-content a:hover {
    color: #0056b3;
}

/* ============================================
   Responsive Adjustments
   ============================================ */

/* Tablet and below */
@media (max-width: 768px) {
    .disclaimer-banner {
        padding: 0.75rem;
    }

    .disclaimer-content {
        flex-direction: row;
        gap: 0.75rem;
    }

    .disclaimer-icon {
        font-size: 1.25rem;
    }

    .disclaimer-text {
        font-size: 0.85rem;
    }

    .header {
        padding: 1.5rem 1rem;
    }

    .header h1 {
        font-size: 1.8rem;
        margin-bottom: 0.75rem;
    }

    .collection-description {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .statistics {
        gap: 1rem;
        font-size: 0.9rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .stat-item {
        gap: 0.75rem;
    }

    .search-container {
        flex-direction: column;
        gap: 0.75rem;
    }

    .search-input {
        width: 100%;
        padding: 0.75rem;
    }

    .clear-button {
        width: 100%;
        padding: 0.75rem;
    }

    /* Filter component responsive styles */
    .filter-container {
        flex-direction: column;
        gap: 0.75rem;
    }

    .filter-group {
        width: 100%;
        min-width: unset;
    }

    .filter-dropdown {
        width: 100%;
        padding: 0.75rem;
    }

    .clear-filters-button {
        width: 100%;
        padding: 0.75rem;
        align-self: stretch;
    }

    .main-content {
        padding: 1rem;
        min-height: calc(100vh - 350px);
    }

    .card-filename {
        font-size: 0.9rem;
    }

    .card-info {
        font-size: 0.8rem;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .collection-description {
        font-size: 0.95rem;
    }

    .statistics {
        gap: 0.75rem;
        font-size: 0.85rem;
    }

    .stat-value {
        font-size: 1rem;
    }

    .main-content {
        padding: 0.75rem;
    }

    .gallery-grid {
        gap: 0.75rem;
    }

    .card-metadata {
        padding: 0.75rem;
    }

    .card-filename {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }

    .card-info {
        font-size: 0.75rem;
        gap: 0.2rem;
    }

    .pdf-link-button {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
}

/* Large screens */
@media (min-width: 1440px) {
    .main-content {
        max-width: 1400px;
    }

    .header-content {
        max-width: 1400px;
    }

    .nav-content {
        max-width: 1400px;
    }

    .footer-content {
        max-width: 1400px;
    }
}

/* ============================================
   Accessibility Styles
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }

    .header {
        background: linear-gradient(135deg, #0056b3 0%, #003d82 100%);
    }

    .disclaimer-banner {
        background: linear-gradient(135deg, #3a3000 0%, #4a3d00 100%);
        border-bottom-color: #ffc107;
    }

    .disclaimer-text {
        color: #ffc107;
    }

    .disclaimer-text strong {
        color: #ffd54f;
    }

    .disclaimer-text a {
        color: #4da3ff;
    }

    .disclaimer-text a:hover {
        color: #80bdff;
    }

    .navigation {
        background-color: #2a2a2a;
        border-bottom-color: #444;
    }

    .search-input {
        background-color: #333;
        color: #e0e0e0;
        border-color: #555;
    }

    .search-input:focus {
        border-color: #007bff;
        box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    }

    .clear-button {
        background-color: #333;
        border-color: #555;
        color: #e0e0e0;
    }

    .clear-button:hover {
        background-color: #444;
        border-color: #666;
    }

    .image-card {
        background-color: #2a2a2a;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .image-card:hover {
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    }

    .image-card:focus-within {
        outline-color: #007bff;
    }

    .image-wrapper {
        background-color: #1a1a1a;
    }

    .card-filename {
        color: #e0e0e0;
    }

    .card-info {
        color: #999;
    }

    .card-info-value {
        color: #666;
    }

    .pdf-link-button {
        background-color: #007bff;
        color: white;
    }

    .pdf-link-button:hover {
        background-color: #0056b3;
        box-shadow: 0 4px 8px rgba(0, 123, 255, 0.4);
    }

    .pdf-link-button:focus {
        outline-color: #4da3ff;
    }

    .footer {
        background-color: #2a2a2a;
        border-top-color: #444;
        color: #999;
    }

    .no-results {
        color: #999;
    }

    /* Filter component dark mode styles */
    .filter-group label {
        color: #e0e0e0;
    }

    .filter-dropdown {
        background-color: #333;
        color: #e0e0e0;
        border-color: #555;
    }

    .filter-dropdown:hover {
        border-color: #666;
    }

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

    .filter-dropdown.active,
    .filter-dropdown.filter-active,
    .filter-dropdown:not([value=""]):valid {
        border-color: #007bff;
        background-color: #1a3a52;
        font-weight: 600;
    }

    /* Visual indicator when filters are active in dark mode */
    .filter-container.has-active-filters {
        background-color: #2a2a2a;
        border-color: #444;
    }

    .filter-container.has-active-filters .clear-filters-button {
        background-color: #007bff;
        color: white;
        border-color: #007bff;
    }

    .filter-container.has-active-filters .clear-filters-button:hover {
        background-color: #0056b3;
        border-color: #0056b3;
    }

    /* Highlight result count when filters are active in dark mode */
    .result-count.has-filters {
        color: #4da3ff;
        font-weight: 600;
    }

    .clear-filters-button {
        background-color: #333;
        border-color: #555;
        color: #e0e0e0;
    }

    .clear-filters-button:hover {
        background-color: #444;
        border-color: #666;
    }

    .clear-filters-button:active {
        background-color: #555;
    }

    /* No results dark mode styles */
    .no-results strong {
        color: #e0e0e0;
    }

    .no-results ul.filter-list li {
        background-color: #2a2a2a;
        border-left-color: #4da3ff;
    }

    .no-results em {
        color: #4da3ff;
    }

    .inline-clear-button {
        background-color: #007bff;
        color: white;
    }

    .inline-clear-button:hover {
        background-color: #0056b3;
    }

    /* Filter error state dark mode styles */
    .filter-container.filter-error {
        background-color: #3a3000;
        border-color: #ffc107;
    }

    .filter-error-message {
        background-color: #2a2a2a;
        border-left-color: #ffc107;
    }

    .filter-error-message .error-text {
        color: #ffc107;
    }

    .filter-dropdown.filter-disabled,
    .clear-filters-button.filter-disabled {
        opacity: 0.5;
        background-color: #2a2a2a;
    }
}

/* ============================================
   CTA Section Styles
   ============================================ */

.cta-section {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    padding: 3rem 1rem;
    margin-top: 3rem;
    text-align: center;
}

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

.cta-content h2 {
    color: white;
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.cta-content p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background-color: white;
    color: #007bff;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    color: #0056b3;
}

.cta-button:focus {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 4px;
}

.cta-button:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Responsive CTA Styles */
@media (max-width: 768px) {
    .cta-section {
        padding: 2rem 1rem;
        margin-top: 2rem;
    }

    .cta-content h2 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }

    .cta-content p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .cta-button {
        padding: 0.875rem 2rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .cta-section {
        padding: 1.5rem 1rem;
    }

    .cta-content h2 {
        font-size: 1.3rem;
    }

    .cta-content p {
        font-size: 0.95rem;
    }

    .cta-button {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
        width: 100%;
        max-width: 300px;
    }
}

/* Dark mode CTA styles */
@media (prefers-color-scheme: dark) {
    .cta-section {
        background: linear-gradient(135deg, #0056b3 0%, #003d82 100%);
    }

    .cta-button {
        background-color: #e0e0e0;
        color: #0056b3;
    }

    .cta-button:hover {
        color: #003d82;
    }

    .cta-button:focus {
        outline-color: rgba(224, 224, 224, 0.5);
    }
}
