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

/* === Base === */
body {
    background: #0a0a0a;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* === Typography === */
h1 { font-size: 1.5rem; font-weight: 500; color: #fff; margin-bottom: 8px; }

/* === Card (login/setup) === */
.card {
    background: #141414;
    border-radius: 12px;
    padding: 48px;
    max-width: 400px;
    width: 100%;
}

/* === Form elements === */
button {
    background: #fff;
    color: #0a0a0a;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    font-weight: 500;
}
button:hover { background: #e0e0e0; }

input {
    width: 100%;
    background: #0a0a0a;
    border: 1px solid #333;
    color: #e0e0e0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.95rem;
}
input:focus { outline: none; border-color: #555; }

label { display: block; color: #999; font-size: 0.8rem; margin-bottom: 6px; margin-top: 16px; }

.error { color: #e55; font-size: 0.85rem; margin-top: 16px; display: none; }

/* === Auth pages (centered layout) === */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
.auth-page .card { text-align: center; }
.auth-page p { color: #666; font-size: 0.9rem; margin-bottom: 32px; }
.setup-link { margin-top: 24px; }
.setup-link a { color: #666; font-size: 0.8rem; text-decoration: none; }
.setup-link a:hover { color: #999; }

/* === Gallery === */
.header {
    max-width: 1400px;
    margin: 0 auto 32px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.header .stats {
    font-size: 0.85rem;
    color: #666;
}

.date-group {
    max-width: 1400px;
    margin: 0 auto 48px;
}
.date-group h2 {
    font-size: 0.9rem;
    font-weight: 400;
    color: #888;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.photo-card {
    background: #141414;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.15s ease;
    cursor: pointer;
}
.photo-card:hover { transform: scale(1.02); }

.photo-card img {
    width: 100%;
    aspect-ratio: 3/2;
    object-fit: cover;
    display: block;
    background: #1a1a1a;
}

.photo-card .placeholder {
    width: 100%;
    aspect-ratio: 3/2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    color: #444;
    font-size: 0.85rem;
}

.photo-card .info {
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.photo-card .name { font-size: 0.8rem; color: #999; }
.photo-card .exts { font-size: 0.7rem; color: #555; text-transform: uppercase; }

.badge {
    background: #2a2a2a;
    color: #888;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge.raw { background: #1a2a1a; color: #6a9; }

/* === Icons === */
.icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* === Skeleton loading === */
.photo-card.skeleton img,
.photo-card.skeleton .placeholder {
    background: linear-gradient(90deg, #1a1a1a 25%, #222 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === Lightbox === */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}
.lightbox-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.lightbox-image {
    width: 95vw;
    height: 95vh;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.1s ease;
}
.lightbox-image.loaded { opacity: 1; }

.lightbox-loader {
    position: absolute;
    color: #666;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    color: #fff;
    cursor: pointer;
    padding: 8px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.3); color: #fff; }

.lightbox-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 12px;
    transition: opacity 0.3s ease, bottom 0.2s ease;
    z-index: 10;
}
.lightbox-controls.hidden { opacity: 0; pointer-events: none; }
.lightbox-controls.above-meta { bottom: 68px; }

.lightbox-controls button {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    color: #fff;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.lightbox-controls button:hover {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.3);
    color: #fff;
}

.lightbox-meta {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.85);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #aaa;
    transform: translateY(100%);
    transition: transform 0.2s ease;
}
.lightbox-meta.visible { transform: translateY(0); }

.lightbox-meta .meta-items {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}
.lightbox-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.lightbox-meta .meta-label { color: #666; }

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    cursor: pointer;
    padding: 12px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: background 0.15s, color 0.15s;
}
.lightbox-nav:hover { color: #fff; background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.3); }
.lightbox-nav.prev { left: 12px; }
.lightbox-nav.next { right: 12px; }

/* === Photo Action Buttons === */
.lightbox-controls .lb-star-btn.starred {
    color: #f5c518;
}
.lightbox-controls .lb-star-btn.starred svg {
    fill: #f5c518 !important;
    stroke: #f5c518;
}

.lightbox-controls .lb-trash-btn:hover {
    color: #e55;
    background: rgba(238, 85, 85, 0.15);
}

.lightbox-controls .lb-archive-btn:hover {
    color: #f5c518;
    background: rgba(245, 197, 24, 0.15);
}

/* === Toast Notifications === */
.toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.toast {
    background: rgba(30, 30, 30, 0.95);
    color: #e0e0e0;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
}
.toast.visible {
    opacity: 1;
    transform: translateY(0);
}
.toast-error {
    border: 1px solid rgba(238, 85, 85, 0.3);
}

/* === Share Modal === */
.share-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-modal {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 24px;
    width: 420px;
    max-width: 90vw;
}

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.share-modal-header h3 {
    font-size: 1rem;
    font-weight: 500;
    color: #e0e0e0;
}
.share-modal-close {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    width: auto;
}
.share-modal-close:hover { color: #999; background: none; }

.share-modal label {
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 6px;
    margin-top: 14px;
    display: block;
}
.share-modal label:first-child { margin-top: 0; }

.share-modal input,
.share-modal select {
    width: 100%;
    background: #0a0a0a;
    border: 1px solid #333;
    color: #e0e0e0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
}
.share-modal input:focus,
.share-modal select:focus { outline: none; border-color: #555; }

.share-create-btn {
    margin-top: 20px;
    background: #fff;
    color: #0a0a0a;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    width: 100%;
    font-weight: 500;
}
.share-create-btn:hover { background: #e0e0e0; }
.share-create-btn:disabled { background: #555; color: #999; cursor: not-allowed; }

.share-done-btn {
    background: transparent;
    border: 1px solid #333;
    color: #e0e0e0;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    width: 100%;
}
.share-done-btn:hover { border-color: #555; background: rgba(255,255,255,0.05); }

.share-url-output {
    background: #0a0a0a;
    border: 1px solid #333;
    color: #4a9;
    font-family: monospace;
    font-size: 0.85rem;
}

.share-copy-btn {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    color: #fff;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.share-copy-btn:hover { background: rgba(255,255,255,0.22); }
