:root {
    --bg: #111214;
    --surface: #1b1c1f;
    --surface-hover: #24262a;
    --text: #f2f2f2;
    --text-muted: #9a9ca1;
    --accent: #4f8cff;
    --danger: #ff5c5c;
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a {
    color: inherit;
}

/* Login page */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px 28px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 1.6rem;
}

.login-subtitle {
    margin: 0 0 20px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.login-error {
    color: var(--danger);
    font-size: 0.9rem;
    margin: 0 0 16px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-form input {
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid #33353a;
    background: #101113;
    color: var(--text);
    font-size: 1rem;
}

.login-form button {
    padding: 12px 14px;
    border-radius: var(--radius);
    border: none;
    background: var(--accent);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.login-form button:disabled,
.login-form input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.login-form button:hover:not(:disabled) {
    filter: brightness(1.08);
}

/* Layout */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar h1 {
    font-size: 1.1rem;
    margin: 0;
    flex: 1;
    text-align: center;
}

.back-link,
.logout-link,
.download-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

.back-link:hover,
.logout-link:hover,
.download-link:hover {
    color: var(--text);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.breadcrumb {
    padding: 10px 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 1200px;
    margin: 0 auto;
}

.breadcrumb a {
    text-decoration: none;
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--text);
}

.breadcrumb-sep {
    color: #55575c;
}

.breadcrumb-current {
    color: var(--text);
}

.page {
    padding: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    margin-top: 60px;
}

/* Album grid */

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

.album-card {
    display: block;
    text-decoration: none;
    color: var(--text);
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.15s ease, background 0.15s ease;
}

.album-card:hover {
    background: var(--surface-hover);
    transform: translateY(-2px);
}

.album-cover {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #000;
}

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

.album-info {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.album-title {
    font-weight: 600;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.album-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Photo grid */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 6px;
}

.photo-thumb {
    padding: 0;
    border: none;
    background: #000;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 4px;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (min-width: 640px) {
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }
}

/* Lightbox */

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    touch-action: pan-y;
}

.lightbox[hidden] {
    display: none;
}

.lightbox-image {
    max-width: 92vw;
    max-height: 90vh;
    object-fit: contain;
    user-select: none;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text);
    cursor: pointer;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

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

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

@media (max-width: 480px) {
    .lightbox-prev,
    .lightbox-next {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }
}
