/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Theme Variables */
:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --card-bg: #f8f9fa;
    --border-color: #e9ecef;
    --hover-color: #f1f3f4;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

[data-theme="white"] {
    --bg-color: #ffffff;
    --text-color: #333333;
    --card-bg: #f8f9fa;
    --border-color: #e9ecef;
    --hover-color: #f1f3f4;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

[data-theme="grey"] {
    --bg-color: #6c757d;
    --text-color: #ffffff;
    --card-bg: #5a6268;
    --border-color: #495057;
    --hover-color: #495057;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="black"] {
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --card-bg: #2d2d2d;
    --border-color: #404040;
    --hover-color: #404040;
    --shadow: 0 2px 8px rgba(0,0,0,0.5);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Theme Selector */
.theme-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 10px;
}

.theme-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.theme-btn:hover,
.theme-btn.active {
    background: var(--hover-color);
    border-color: var(--text-color);
}

/* Header */
header {
    text-align: center;
    padding: 20px 20px;
    border-bottom: 1px solid var(--border-color);
}

header h1 {
    font-size: 2em;
    font-weight: 300;
    margin-bottom: 5px;
}

/* Navigation */
nav {
    margin-bottom: 20px;
}

.back-btn {
    color: var(--text-color);
    text-decoration: none;
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.3s ease;
    display: inline-block;
}

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

/* Albums Grid */
.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.album-card {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.album-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.album-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.album-card h3 {
    padding: 20px;
    font-size: 1.2em;
    font-weight: 400;
    text-align: center;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.image-card {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
    cursor: pointer;
}

.image-card:hover {
    transform: scale(1.05);
}

.gallery-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

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

.modal-content {
    position: relative;
    margin: auto;
    padding: 10px;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.modal img {
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    cursor: grab;
    transition: transform 0.1s ease;
}

.modal img:active {
    cursor: grabbing;
}

.image-container {
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 80px);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    top: 10px;
    left: 15px;
    z-index: 2001;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.zoom-btn {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.zoom-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Minimap */
.minimap {
    position: absolute;
    top: 80px; /* Move down to avoid close button */
    right: 80px; /* Move away from right navigation area */
    width: 150px;
    height: 100px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    display: none;
    z-index: 2001;
    pointer-events: auto; /* Ensure it can be clicked */
}

.minimap.active {
    display: block;
}

.minimap canvas {
    width: 100%;
    height: 100%;
    border-radius: 2px;
    cursor: pointer;
}

.minimap-viewport {
    position: absolute;
    top: 0;
    left: 0;
    border: 2px solid #ff0000;
    background: rgba(255, 0, 0, 0.2);
    cursor: pointer;
}

.close {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #fff;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.share-btn {
    position: absolute;
    top: 10px;
    right: 65px;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    z-index: 2001;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.share-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.nav-btn {
    position: absolute;
    top: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 24px;
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 50%;
    transform: translateY(-50%);
    transition: background 0.3s ease;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.prev {
    left: 10px;
}

.next {
    right: 10px;
}

/* Large invisible click areas for navigation */
.nav-area {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 20%;
    cursor: pointer;
    z-index: 1999;
}

.nav-area.prev-area {
    left: 0;
}

.nav-area.next-area {
    right: 0;
}

/* EXIF Data */
.exif-data {
    color: white;
    background: rgba(0, 0, 0, 0.8);
    padding: 8px 16px;
    border-radius: 20px;
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.pagination-bottom {
    margin-top: 40px;
    margin-bottom: 20px;
}

.page-btn, .page-num {
    padding: 8px 12px;
    text-decoration: none;
    border: 1px solid;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 40px;
    text-align: center;
}

.page-num.current {
    font-weight: bold;
    cursor: default;
}

.ellipsis {
    padding: 8px 4px;
    font-size: 14px;
}

.image-count {
    font-size: 0.7em;
    font-weight: normal;
    opacity: 0.7;
}

/* Progressive loading effects */
.gallery-thumbnail {
    transition: filter 0.3s ease, opacity 0.3s ease;
}

.gallery-thumbnail[data-loading="true"] {
    filter: blur(2px);
    opacity: 0.7;
}

/* Theme-specific pagination colors */
[data-theme="white"] .page-btn,
[data-theme="white"] .page-num {
    color: #333;
    border-color: #ddd;
    background: #fff;
}

[data-theme="white"] .page-btn:hover,
[data-theme="white"] .page-num:hover {
    background: #f5f5f5;
    border-color: #999;
}

[data-theme="white"] .page-num.current {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

[data-theme="grey"] .page-btn,
[data-theme="grey"] .page-num {
    color: #e0e0e0;
    border-color: #555;
    background: #2a2a2a;
}

[data-theme="grey"] .page-btn:hover,
[data-theme="grey"] .page-num:hover {
    background: #404040;
    border-color: #777;
}

[data-theme="grey"] .page-num.current {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

[data-theme="black"] .page-btn,
[data-theme="black"] .page-num {
    color: #ccc;
    border-color: #444;
    background: #1a1a1a;
}

[data-theme="black"] .page-btn:hover,
[data-theme="black"] .page-num:hover {
    background: #333;
    border-color: #666;
}

[data-theme="black"] .page-num.current {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Responsive Design */
@media (max-width: 768px) {
    .albums-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
        padding: 20px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
        padding: 20px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .theme-selector {
        position: relative;
        top: auto;
        right: auto;
        justify-content: center;
        margin-bottom: 20px;
    }
    
    .modal-content {
        padding: 5px;
    }
    
    .modal img {
        max-width: calc(100vw - 10px);
        max-height: calc(100vh - 60px);
    }
    
    .nav-btn {
        font-size: 20px;
        padding: 10px 12px;
        width: 40px;
        height: 40px;
    }
    
    .close {
        top: 5px;
        right: 10px;
        font-size: 24px;
        width: 35px;
        height: 35px;
    }
    
    .share-btn {
        top: 5px;
        right: 55px;
        font-size: 16px;
        width: 35px;
        height: 35px;
    }
    
    .exif-data {
        font-size: 11px;
        padding: 6px 12px;
        bottom: 5px;
    }
    
    .nav-area {
        width: 25%;
    }
    
    .zoom-controls {
        top: 5px;
        left: 10px;
    }
    
    .zoom-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .minimap {
        top: 60px;
        right: 55px;
        width: 120px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .albums-grid {
        grid-template-columns: 1fr;
        padding: 15px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
        padding: 15px;
    }
    
    header {
        padding: 20px 15px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .modal img {
        max-width: calc(100vw - 5px);
        max-height: calc(100vh - 50px);
    }
    
    .nav-btn {
        font-size: 18px;
        padding: 8px 10px;
        width: 36px;
        height: 36px;
    }
    
    .prev {
        left: 5px;
    }
    
    .next {
        right: 5px;
    }
    
    .close {
        top: 5px;
        right: 5px;
        font-size: 20px;
        width: 30px;
        height: 30px;
    }
    
    .share-btn {
        top: 5px;
        right: 40px;
        font-size: 14px;
        width: 30px;
        height: 30px;
    }
    
    .exif-data {
        font-size: 10px;
        padding: 4px 8px;
        bottom: 2px;
    }
    
    .nav-area {
        width: 30%;
    }
    
    .zoom-controls {
        top: 5px;
        left: 5px;
    }
    
    .zoom-btn {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    .minimap {
        top: 50px;
        right: 40px;
        width: 100px;
        height: 60px;
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.pagination-bottom {
    margin-top: 40px;
    margin-bottom: 20px;
}

.page-btn, .page-num {
    padding: 8px 12px;
    text-decoration: none;
    border: 1px solid;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 40px;
    text-align: center;
}

.page-num.current {
    font-weight: bold;
    cursor: default;
}

.ellipsis {
    padding: 8px 4px;
    font-size: 14px;
}

.image-count {
    font-size: 0.7em;
    font-weight: normal;
    opacity: 0.7;
}

/* Progressive loading effects */
.gallery-thumbnail {
    transition: filter 0.3s ease, opacity 0.3s ease;
}

.gallery-thumbnail[data-loading="true"] {
    filter: blur(2px);
    opacity: 0.7;
}

/* Theme-specific pagination colors */
[data-theme="white"] .page-btn,
[data-theme="white"] .page-num {
    color: #333;
    border-color: #ddd;
    background: #fff;
}

[data-theme="white"] .page-btn:hover,
[data-theme="white"] .page-num:hover {
    background: #f5f5f5;
    border-color: #999;
}

[data-theme="white"] .page-num.current {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

[data-theme="grey"] .page-btn,
[data-theme="grey"] .page-num {
    color: #e0e0e0;
    border-color: #555;
    background: #2a2a2a;
}

[data-theme="grey"] .page-btn:hover,
[data-theme="grey"] .page-num:hover {
    background: #404040;
    border-color: #777;
}

[data-theme="grey"] .page-num.current {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

[data-theme="black"] .page-btn,
[data-theme="black"] .page-num {
    color: #ccc;
    border-color: #444;
    background: #1a1a1a;
}

[data-theme="black"] .page-btn:hover,
[data-theme="black"] .page-num:hover {
    background: #333;
    border-color: #666;
}

[data-theme="black"] .page-num.current {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Responsive pagination */
@media (max-width: 768px) {
    .pagination {
        gap: 5px;
    }
    
    .page-btn, .page-num {
        padding: 6px 8px;
        font-size: 12px;
        min-width: 32px;
    }
    
    .image-count {
        display: block;
        font-size: 0.8em;
        margin-top: 5px;
    }
}

@media (max-width: 480px) {
    .pagination {
        gap: 3px;
    }
    
    .page-btn, .page-num {
        padding: 4px 6px;
        font-size: 11px;
        min-width: 28px;
    }
}
