:root {
    --bg-primary: #0f172a;
    --bg-surface: rgba(30, 41, 59, 0.7);
    --bg-surface-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --accent-color: #6366f1;
    --accent-hover: #4f46e5;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --radius: 16px;
    --transition: all 0.25s ease-in-out;
}

[data-theme="light"] {
    --bg-primary: #f1f5f9;
    --bg-surface: rgba(255, 255, 255, 0.85);
    --bg-surface-border: rgba(0, 0, 0, 0.08);
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --accent-color: #4f46e5;
    --accent-hover: #4338ca;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
}

/* Navbar */
.navbar {
    border-bottom: 1px solid var(--bg-surface-border);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--accent-color);
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--bg-surface-border);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin: 40px 0 30px;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.hero-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Dropzone */
.dropzone {
    border: 2px dashed var(--accent-color);
    border-radius: calc(var(--radius) - 4px);
    padding: 50px 20px;
    text-align: center;
    cursor: pointer;
    background: rgba(99, 102, 241, 0.03);
    transition: var(--transition);
}

.dropzone:hover, .dropzone.dragover {
    background: rgba(99, 102, 241, 0.08);
    border-color: var(--accent-hover);
}

.upload-icon-wrapper svg {
    width: 48px;
    height: 48px;
    color: var(--accent-color);
    margin-bottom: 15px;
}

.browse-link {
    color: var(--accent-color);
    font-weight: 600;
    text-decoration: underline;
}

.badge {
    display: inline-block;
    margin-top: 12px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.08);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.hidden-input { display: none; }
.hidden { display: none !important; }

/* Previews */
.preview-section { margin-top: 25px; }
.preview-header { display: flex; justify-content: space-between; margin-bottom: 15px; }
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.preview-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
}

.preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    cursor: pointer;
    line-height: 22px;
}

/* Forms & Buttons */
.form-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--bg-surface-border);
    background: rgba(0,0,0,0.1);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary { background: var(--accent-color); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.btn-outline { border: 1px solid var(--bg-surface-border); color: var(--text-primary); background: transparent; }
.btn-danger { background: var(--danger-color); color: #fff; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { background: none; border: none; cursor: pointer; color: var(--text-primary); }

/* Gallery */
.album-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.album-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.gallery-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 4/3;
    cursor: pointer;
}

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

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

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    opacity: 0;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 15px;
    transition: var(--transition);
}

.gallery-item:hover .gallery-overlay { opacity: 1; }
.download-icon-btn { background: #fff; color: #000; padding: 8px; border-radius: 50%; display: flex; }

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img { max-width: 90vw; max-height: 85vh; border-radius: 8px; }
.lightbox-close { position: absolute; top: 20px; right: 25px; color: #fff; font-size: 2rem; background: none; border: none; cursor: pointer; }
.lightbox-arrow { position: absolute; color: #fff; font-size: 3rem; background: none; border: none; cursor: pointer; padding: 20px; }
.lightbox-arrow.left { left: 10px; }
.lightbox-arrow.right { right: 10px; }
.lightbox-counter { text-align: center; color: #fff; margin-top: 10px; font-size: 0.9rem; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.modal-content { max-width: 480px; width: 90%; text-align: center; }
.link-box { display: flex; gap: 10px; margin: 20px 0; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ── Select Mode & Checkbox ── */
.gallery-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 22px;
    height: 22px;
    z-index: 10;
    cursor: pointer;
    accent-color: var(--accent-color);
    display: none;
    border-radius: 4px;
}

.gallery-grid.select-mode .gallery-checkbox {
    display: block;
}

.gallery-grid.select-mode .gallery-item {
    cursor: pointer;
}

.gallery-item:has(.gallery-checkbox:checked) {
    outline: 3px solid var(--accent-color);
    border-radius: 12px;
}

/* ── Selection Toolbar ── */
.selection-toolbar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--bg-surface-border);
    border-radius: 50px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 400;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    white-space: nowrap;
}

.selection-toolbar span {
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 80px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title { font-size: 1.8rem; }
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .album-header { flex-direction: column; gap: 15px; align-items: flex-start; }
}

@media (max-width: 600px) {
    .selection-toolbar {
        flex-wrap: wrap;
        justify-content: center;
        border-radius: 16px;
        bottom: 12px;
        width: 92%;
    }
}