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

:root {
    --primary:      #2563eb;
    --primary-dark: #1d4ed8;
    --success:      #16a34a;
    --danger:       #dc2626;
    --warning:      #d97706;
    --bg:           #f1f5f9;
    --card:         #ffffff;
    --border:       #e2e8f0;
    --text:         #1e293b;
    --muted:        #64748b;
    --radius:       10px;
}

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

/* ── NAV ── */
.topnav {
    background: var(--primary);
    color: #fff;
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.nav-links a { color: rgba(255,255,255,.85); text-decoration: none; font-size: .9rem; }
.nav-links a:hover { color: #fff; }
.nav-name { color: rgba(255,255,255,.7); font-size: .85rem; }
.btn-link {
    background: none;
    border: none;
    color: rgba(255,255,255,.85);
    cursor: pointer;
    font-size: .9rem;
    padding: 0;
}
.btn-link:hover { color: #fff; }

/* ── LAYOUT ── */
.container { max-width: 900px; margin: 2rem auto; padding: 0 1.25rem; }
.container-wide { max-width: 1200px; margin: 2rem auto; padding: 0 1.25rem; }

/* ── CARDS ── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}
.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}
.card h2 {
    font-size: 1.1rem;
    margin-bottom: .75rem;
}

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .5rem 1rem;
    border: none;
    border-radius: 7px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s;
    white-space: nowrap;
}
.btn:hover { opacity: .85; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-success  { background: var(--success); color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-ghost    { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-sm       { padding: .3rem .7rem; font-size: .8rem; }
.btn-full     { width: 100%; justify-content: center; }

/* ── FORMS ── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: .78rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .3rem;
}
.form-control {
    width: 100%;
    padding: .55rem .8rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: .95rem;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
textarea.form-control { min-height: 150px; resize: vertical; font-family: monospace; font-size: .875rem; }

/* ── ALERTS ── */
.alert {
    padding: .75rem 1rem;
    border-radius: 7px;
    margin-bottom: 1rem;
    font-size: .9rem;
}
.alert-success { background: #dcfce7; color: #15803d; }
.alert-error   { background: #fee2e2; color: #b91c1c; }
.alert-info    { background: #dbeafe; color: #1e40af; }
.alert-warning { background: #fef3c7; color: #92400e; }

/* ── LANDING PAGE ── */
.hero {
    text-align: center;
    padding: 4rem 1.5rem 2.5rem;
}
.hero h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: .75rem; }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 500px; margin: 0 auto 2rem; }

/* ── LOGIN / REGISTER CARD ── */
.auth-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.75rem;
    max-width: 420px;
    margin: 0 auto;
    box-shadow: 0 4px 24px rgba(0,0,0,.06);
}
.auth-card h2 { font-size: 1.3rem; margin-bottom: 1.25rem; text-align: center; }

/* ── DASHBOARD GRID ── */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}
.dash-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.dash-card .icon { font-size: 2rem; }
.dash-card h3 { font-size: 1rem; font-weight: 700; }
.dash-card p  { font-size: .875rem; color: var(--muted); }

/* ── QR CODE ── */
.qr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
}
.qr-wrap img {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .5rem;
    background: #fff;
}
.qr-url {
    font-size: .85rem;
    color: var(--primary);
    word-break: break-all;
    text-align: center;
}

/* ── TOGGLE ── */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.toggle-label { font-size: .9rem; }
.toggle {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 13px;
    cursor: pointer;
    transition: background .2s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(22px); }

/* ── PHOTO GRID ── */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}
.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border);
    background: #000;
    cursor: pointer;
}
.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity .15s;
}
.photo-item:hover img { opacity: .75; }
.photo-item .photo-actions {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    opacity: 0;
    transition: opacity .15s;
}
.photo-item:hover .photo-actions { opacity: 1; }

/* ── UPLOAD ZONE ── */
.upload-zone {
    border: 3px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.upload-zone.drag-over {
    border-color: var(--primary);
    background: #eff6ff;
}
.upload-zone .upload-icon { font-size: 3rem; margin-bottom: .75rem; }
.upload-zone h2 { font-size: 1.25rem; margin-bottom: .5rem; }
.upload-zone p { color: var(--muted); font-size: .9rem; }
.upload-zone input[type=file] { display: none; }

.upload-list { margin-top: 1.25rem; }
.upload-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 7px;
    margin-bottom: .5rem;
    font-size: .875rem;
    transition: background .4s ease;
}
.upload-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .status { font-size: .78rem; font-weight: 600; }
.status-ok     { color: var(--success); }
.status-err    { color: var(--danger); }
.status-pending { color: var(--muted); }

/* ── ADMIN TABLE ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
.data-table th {
    text-align: left;
    padding: .6rem .9rem;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
}
.data-table td {
    padding: .65rem .9rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }

/* ── BADGE ── */
.badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
}
.badge-green   { background: #dcfce7; color: #15803d; }
.badge-red     { background: #fee2e2; color: #b91c1c; }
.badge-yellow  { background: #fef3c7; color: #92400e; }
.badge-blue    { background: #dbeafe; color: #1e40af; }

/* ── SLIDESHOW ── */
body.fullscreen {
    background: #000;
    overflow: hidden;
}
#slideshow { position: fixed; inset: 0; }
.layer {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1s linear;
}
.layer.active { opacity: 1; }
.layer img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    cursor: pointer;
    user-select: none;
}

/* ── MISC ── */
.muted { color: var(--muted); font-size: .875rem; }
.flex-gap { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.section-header {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    margin: 1.5rem 0 .75rem;
}
.section-header:first-child { margin-top: 0; }

/* ── GUEST UPLOAD (mobile-first) ── */
.guest-wrap { max-width: 520px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.guest-custom { margin-bottom: 1.25rem; }
.upload-actions {
    display: flex;
    gap: .75rem;
    justify-content: center;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}
.upload-actions .btn {
    flex: 1;
    min-width: 130px;
    max-width: 200px;
    justify-content: center;
    padding: .75rem 1rem;
    font-size: 1rem;
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.6rem; }
    .dash-grid { grid-template-columns: 1fr; }
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
