/* Flask Photo Gallery CSS */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header and Navigation */
.gallery-header {
    background-color: #000;
    color: #fff;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar {
    background-color: transparent;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: #fff;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

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

.nav-dropdown {
    position: relative;
}

.nav-dropbtn {
    background-color: transparent;
    color: #fff;
    padding: 0.5rem 1rem;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.nav-dropbtn:hover,
.nav-dropbtn:focus,
.nav-dropbtn:active {
    background-color: rgba(255,255,255,0.1);
}

/* Add touch-specific feedback for mobile devices */
@media (hover: none) {
    .nav-dropbtn:hover {
        background-color: rgba(255,255,255,0.1);
    }
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    background-color: #000;
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 1001;
    border-radius: 4px;
    top: 100%;
    right: 0;
}

.nav-dropdown-content a {
    color: #fff;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    border-radius: 4px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.nav-dropdown-content .chapter-item {
    color: #fff;
}

.nav-dropdown-content .chapter-title {
    color: #fff;
    font-weight: 500;
}

.nav-dropdown-content .chapter-count {
    color: #ccc;
    font-size: 0.75rem;
    opacity: 0.8;
}

.nav-dropdown-content a:hover,
.nav-dropdown-content a:focus,
.nav-dropdown-content a:active {
    background-color: rgba(255,255,255,0.25);
    transform: translateX(2px);
}

/* Add touch-specific feedback for mobile devices */
@media (hover: none) {
    .nav-dropdown-content a:hover {
        background-color: rgba(255,255,255,0.25);
        transform: translateX(2px);
    }
}

.nav-dropdown:hover .nav-dropdown-content {
    display: block;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 4rem 0;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    margin-bottom: 3rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 300;
    color: #000;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.hero-description {
    font-size: 1.2rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

/* Section Styles */
.section-title {
    font-size: 2rem;
    font-weight: 300;
    color: #000;
    margin-bottom: 2rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Chapters Grid */
.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.chapter-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.chapter-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.chapter-thumbnail {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background-color: #f5f5f5;
}

.chapter-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.chapter-card:hover .chapter-thumbnail img {
    transform: scale(1.05);
}

.chapter-info {
    padding: 1.5rem;
}

.chapter-info h3 {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #000;
}

.chapter-count {
    color: #666;
    font-size: 0.9rem;
}

/* Chapter Header */
.chapter-header {
    margin-bottom: 2rem;
}

.breadcrumb {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.breadcrumb a {
    color: #333;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.chapter-title {
    font-size: 2.5rem;
    font-weight: 300;
    color: #000;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.chapter-meta {
    color: #666;
    font-size: 1.1rem;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 3rem;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background-color: #f5f5f5;
    aspect-ratio: 1;
}

.gallery-link {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    text-decoration: none;
}

.gallery-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-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;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-item:hover .gallery-thumb {
    transform: scale(1.1);
}

.image-title {
    color: #fff;
    font-size: 0.9rem;
    text-align: center;
    padding: 0 1rem;
}

/* Chapter Navigation */
.chapter-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3rem;
    padding: 2rem 0;
    border-top: 1px solid #eee;
}

.nav-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #000;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.nav-btn:hover {
    background-color: #333;
}

/* Footer */
.gallery-footer {
    background-color: #000;
    color: #fff;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

.gallery-footer p {
    margin: 0;
    color: #ccc;
}

/* Utility Classes */
.loading, .error, .no-chapters, .no-images {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.error {
    color: #d32f2f;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .chapter-title {
        font-size: 1.8rem;
    }

    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-menu {
        gap: 1rem;
    }

    .chapters-grid {
        grid-template-columns: 1fr;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.5rem;
    }

    .chapter-navigation {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero-section {
        padding: 2rem 0;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

/* Chapter Navigation Items */
.chapter-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chapter-title {
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.2;
}

.chapter-count {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Navigation States */
.nav-loading {
    padding: 12px 16px;
    text-align: center;
    color: #999;
    font-size: 0.9rem;
}

.nav-error {
    padding: 12px 16px;
    text-align: center;
    color: #ff6b6b;
    font-size: 0.9rem;
}

.nav-empty {
    padding: 12px 16px;
    text-align: center;
    color: #999;
    font-size: 0.9rem;
}

/* Improved dropdown scrolling for many chapters */
.nav-dropdown-content {
    max-height: 80vh;
    overflow-y: auto;
}

/* Custom scrollbar for dropdown */
.nav-dropdown-content::-webkit-scrollbar {
    width: 6px;
}

.nav-dropdown-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.nav-dropdown-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.nav-dropdown-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Chapter metadata styling */
.chapter-metadata {
    margin: 0.5rem 0;
    font-size: 0.85rem;
    color: #666;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chapter-location {
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.chapter-location::before {
    content: "Location";
    font-size: 0.8em;
    color: #888;
}

.chapter-date {
    font-style: italic;
    color: #777;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.chapter-date::before {
    content: "Date";
    font-size: 0.8em;
    color: #888;
}

/* Enhanced chapter card hover effects */
.chapter-card:hover .chapter-thumbnail img {
    transform: scale(1.05);
    filter: brightness(0.95);
}

/* Improved thumbnail loading states */
.chapter-thumbnail img {
    transition: transform 0.3s ease, filter 0.3s ease;
}

.chapter-thumbnail img[src*="data:image/svg"] {
    filter: grayscale(100%);
    opacity: 0.5;
}

/* Responsive adjustments for metadata */
@media (max-width: 768px) {
    .chapter-metadata {
        font-size: 0.8rem;
    }

    .chapter-location::before,
    .chapter-date::before {
        display: none;
    }
}

/* Error Pages */
.error-page {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.error-code {
    font-size: 8rem;
    font-weight: bold;
    color: #000;
    line-height: 1;
    margin-bottom: 1rem;
    opacity: 0.1;
}

.error-title {
    font-size: 2.5rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
}

.error-description {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.error-suggestions {
    text-align: left;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.error-suggestions h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.1rem;
}

.error-suggestions ul {
    list-style: none;
    padding: 0;
}

.error-suggestions li {
    margin-bottom: 0.5rem;
    padding-left: 1.2rem;
    position: relative;
}

.error-suggestions li::before {
    content: "•";
    color: #666;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.error-suggestions a {
    color: #0066cc;
    text-decoration: none;
}

.error-suggestions a:hover {
    text-decoration: underline;
}

.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-primary {
    background-color: #000;
    color: #fff;
    border: 1px solid #000;
}

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

.btn-secondary {
    background-color: #fff;
    color: #000;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background-color: #f8f9fa;
    border-color: #000;
}

/* Mobile responsive for error pages */
@media (max-width: 768px) {
    .error-page {
        padding: 2rem 1rem;
    }

    .error-code {
        font-size: 5rem;
    }

    .error-title {
        font-size: 2rem;
    }

    .error-description {
        font-size: 1.1rem;
    }
}