/* ============================================
   DT Photos - Style Sheet
   Dark cinema theme for photo galleries
   ============================================ */

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #21262d;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --border: #30363d;
    --overlay: rgba(0, 0, 0, 0.9);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    --radius: 12px;
    --transition: 0.3s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ---- Utility ---- */
.hidden {
    display: none !important;
}

/* ---- Access Screen ---- */
.access-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #1a1e2e 100%);
}

.access-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow);
}

.access-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.access-box h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.access-box > p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.access-box input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    margin-bottom: 1rem;
    outline: none;
    transition: border-color var(--transition);
}

.access-box input:focus {
    border-color: var(--accent);
}

.access-box button {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    transition: background var(--transition);
}

.access-box button:hover {
    background: var(--accent-hover);
}

.error {
    color: #f85149;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* ---- App Container ---- */
.app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Header ---- */
.header {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-icon {
    font-size: 1.6rem;
}

.header h1 {
    font-size: 1.8rem;
    cursor: pointer;
    display: inline-block;
    transition: color var(--transition);
}

.header h1:hover {
    color: var(--accent);
}

.breadcrumb {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* ---- Albums Grid ---- */
.albums-view {
    flex: 1;
}

.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.album-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.album-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--accent);
}

.album-card-cover {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
    background: var(--bg-card);
}

.album-card-info {
    padding: 1rem 1.2rem;
}

.album-card-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.album-card-info p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.album-card-info .album-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ---- Photos View ---- */
.photos-view {
    flex: 1;
}

.album-header {
    margin-bottom: 2rem;
}

.back-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--transition);
    margin-bottom: 1rem;
}

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

.album-header h2 {
    font-size: 1.6rem;
    margin-bottom: 0.3rem;
}

.album-header > p {
    color: var(--text-secondary);
}

/* ---- Photos Grid ---- */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 8px;
}

.photo-thumb {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    background: var(--bg-card);
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease, filter 0.4s ease;
}

.photo-thumb:hover img {
    transform: scale(1.05);
    filter: brightness(1.15);
}

.photo-thumb .photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
    color: #fff;
    font-size: 0.82rem;
    opacity: 0;
    transition: opacity var(--transition);
}

.photo-thumb:hover .photo-overlay {
    opacity: 1;
}

/* ---- Lightbox ---- */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    text-align: center;
    position: relative;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
}

.lightbox-caption {
    color: var(--text-primary);
    margin-top: 12px;
    font-size: 0.95rem;
}

.lightbox-counter {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 4px;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
    transition: background var(--transition);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-close {
    top: 20px;
    right: 20px;
}

.lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* ---- Loading Spinner ---- */
.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

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

/* ---- Footer ---- */
.footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .albums-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 16px;
    }

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

    .lightbox-prev,
    .lightbox-next {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }

    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }

    .access-box {
        padding: 2rem;
    }

    .header h1 {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .photos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 3px;
    }

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

    .app {
        padding: 12px;
    }
}
