:root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1f2430;
    --text: #eef1f6;
    --muted: #9aa3b2;
    --accent: #d4a017;
    --accent-2: #f0c040;
    --danger: #e35d6a;
    --ok: #3ecf8e;
    --radius: 14px;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    width: min(1100px, 92vw);
    margin: 0 auto;
}

.public-header, .admin-header {
    background: rgba(15, 17, 21, 0.92);
    border-bottom: 1px solid #2a3140;
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.public-header .container, .admin-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.brand {
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text);
    text-decoration: none;
}

.admin-nav a, .admin-nav a:visited {
    margin-left: 1rem;
    color: var(--muted);
}

.admin-main { padding: 2rem 0 4rem; }
.public-footer {
    padding: 2rem 0 3rem;
    color: var(--muted);
    text-align: center;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn, button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 1px solid #3a4356;
    background: var(--surface-2);
    color: var(--text);
    border-radius: 999px;
    padding: 0.65rem 1.1rem;
    cursor: pointer;
    font: inherit;
    text-decoration: none;
}

.btn:hover, button.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, #b8860b, #f0c040); color: #111; border-color: transparent; font-weight: 600; }
.btn-secondary { background: #2a3140; }
.btn-danger { background: #4a1f28; border-color: #7a3040; color: #ffd7dc; }
.btn-link { background: none; border: none; color: var(--accent-2); padding: 0; cursor: pointer; }
.btn-link.danger { color: var(--danger); }

.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.alert-error { background: #3a1820; color: #ffb8c0; border: 1px solid #7a3040; }
.alert-success { background: #143026; color: #b8f5d8; border: 1px solid #2f6b52; }

.auth-card, .card {
    background: var(--surface);
    border: 1px solid #2a3140;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    max-width: 420px;
    margin: 4rem auto;
}

.form-stack label, .form-grid label, .form-inline label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.9rem;
    color: var(--muted);
    font-size: 0.92rem;
}

input, textarea, select {
    background: #0f131a;
    border: 1px solid #334055;
    color: var(--text);
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    font: inherit;
}

textarea { resize: vertical; min-height: 90px; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.form-grid fieldset {
    border: 1px solid #2a3140;
    border-radius: var(--radius);
    padding: 1rem;
    margin: 0;
    background: var(--surface);
}

.form-grid .full-width { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.checkbox { flex-direction: row !important; align-items: center; gap: 0.6rem !important; }
.checkbox-grid { display: grid; gap: 0.5rem; }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 0.75rem; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
}

.data-table th, .data-table td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid #2a3140;
    text-align: left;
}

.data-table.compact td, .data-table.compact th { padding: 0.5rem 0.7rem; }
.actions a { margin-right: 0.75rem; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: #273044;
    color: #dbe4f3;
    font-size: 0.78rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid #2a3140;
    border-radius: var(--radius);
    padding: 1rem;
}

.stat-label { color: var(--muted); font-size: 0.85rem; }
.stat-value { font-size: 1.8rem; display: block; margin-top: 0.25rem; }

.album-hero {
    padding: 2rem 0 1rem;
    background: radial-gradient(circle at top, #2a220f 0%, transparent 55%);
}

.cover-carousel {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 1fr);
    gap: 0.75rem;
    overflow: hidden;
    margin-bottom: 1.25rem;
    border-radius: var(--radius);
}

.cover-slide {
    height: 160px;
    background-size: cover;
    background-position: center;
    border-radius: var(--radius);
    border: 1px solid #3a4356;
    animation: fadeSlide 12s infinite;
}

.cover-slide:nth-child(2) { animation-delay: 2s; }
.cover-slide:nth-child(3) { animation-delay: 4s; }
.cover-slide:nth-child(4) { animation-delay: 6s; }
.cover-slide:nth-child(5) { animation-delay: 8s; }

@keyframes fadeSlide {
    0%, 18% { opacity: 1; transform: scale(1); }
    22%, 100% { opacity: 0.35; transform: scale(0.98); }
}

.album-desc { color: var(--muted); max-width: 60ch; }

.search-section { padding: 2rem 0; }
.search-form {
    background: var(--surface);
    border: 1px solid #2a3140;
    border-radius: var(--radius);
    padding: 1.25rem;
}

.consent-box {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    color: var(--muted);
    font-size: 0.92rem;
    margin-bottom: 1rem;
}

.capture-row {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 1rem;
}

@media (max-width: 760px) {
    .capture-row { grid-template-columns: 1fr; }
}

.capture-preview {
    background: #0c1017;
    border: 1px dashed #3a4356;
    border-radius: var(--radius);
    min-height: 280px;
    height: 320px;
    display: grid;
    place-items: center;
    overflow: hidden;
    position: relative;
}

.capture-preview video,
.capture-preview img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.capture-preview video.camera-video {
    transform: scaleX(-1); /* espelho natural da selfie */
}

.capture-preview .is-hidden,
.capture-actions .is-hidden,
.is-hidden[hidden] {
    display: none !important;
}

.capture-placeholder {
    color: var(--muted);
    padding: 1rem;
    text-align: center;
    z-index: 1;
}

.capture-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.file-btn { cursor: pointer; }

.camera-status {
    margin: 0.25rem 0 0;
    font-size: 0.88rem;
    color: var(--muted);
    line-height: 1.35;
}

.camera-status.is-error {
    color: #ffb8c0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.85rem;
    padding: 1rem 0 2.5rem;
}

.gallery-item {
    position: relative;
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid #2f3748;
    background: #121722;
    box-shadow: var(--shadow);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease, filter 0.35s ease;
}

.gallery-item:hover img {
    transform: scale(1.06);
    filter: brightness(1.05);
}

.gallery-item::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.45), transparent 50%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.gallery-item:hover::after { opacity: 1; }

.similarity-badge {
    position: absolute;
    left: 0.55rem;
    bottom: 0.55rem;
    background: rgba(0,0,0,0.72);
    color: #fff;
    font-size: 0.78rem;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    z-index: 2;
}

.admin-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.admin-photo-card {
    background: var(--surface);
    border: 1px solid #2a3140;
    border-radius: 12px;
    overflow: hidden;
}

.admin-photo-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.admin-photo-meta {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.photo-placeholder {
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 0.8rem;
}

.filter-bar, .form-inline {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: end;
    margin-bottom: 1rem;
}

.form-inline.card { max-width: none; margin: 0 0 1.5rem; }

.pagination {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
}

.error-page { text-align: center; padding: 4rem 0; }

/* Banner + modal no estilo Fotto */
.find-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    color: #1a1a1a;
    border-radius: 16px;
    padding: 1rem 1.1rem;
    margin: 0.5rem 0 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}

.find-banner-icon { color: #c62828; flex: 0 0 auto; }
.find-banner-copy { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.find-banner-copy strong { font-size: 1.02rem; color: #111; }
.find-banner-copy span { color: #555; font-size: 0.92rem; }

.btn-find {
    background: #c62828 !important;
    border-color: #c62828 !important;
    color: #fff !important;
    font-weight: 700;
    border-radius: 999px;
    white-space: nowrap;
}

.btn-outline {
    background: #fff !important;
    color: #111 !important;
    border: 1.5px solid #222 !important;
    border-radius: 999px;
    font-weight: 600;
}

.album-kicker {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-size: 0.75rem;
    margin: 0 0 0.35rem;
}

.photo-count { color: var(--muted); }

body.modal-open { overflow: hidden; }

.face-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.face-modal[hidden],
.face-modal.is-hidden { display: none !important; }

.face-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 12, 16, 0.62);
    backdrop-filter: blur(4px);
}

.face-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(440px, 94vw);
    background: #fff;
    color: #1a1a1a;
    border-radius: 18px;
    padding: 1.35rem 1.35rem 1.5rem;
    box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}

.face-modal-close {
    position: absolute;
    top: 0.65rem;
    right: 0.85rem;
    border: 0;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: #444;
}

.face-modal-dialog h2 {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
}

.face-modal-art { display: grid; place-items: center; margin: 0.5rem 0 0.75rem; }
.face-modal-art-circle {
    width: 150px;
    height: 150px;
    border-radius: 999px;
    background: #f7d5d8;
    display: grid;
    place-items: center;
}

.face-modal-lead {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0.4rem 0;
}

.face-modal-note {
    text-align: center;
    color: #555;
    font-size: 0.92rem;
    margin: 0 0 1.1rem;
}

.face-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.face-modal-actions .btn,
.face-modal-actions label.btn {
    width: 100%;
    justify-content: center;
}

.consent-mini {
    margin: 1rem 0 0;
    font-size: 0.82rem;
    color: #555;
}

.consent-mini .checkbox {
    align-items: flex-start;
}

.modal-preview {
    min-height: 280px;
    height: 300px;
    margin-bottom: 0.85rem;
    border-radius: 14px;
    background: #111;
}

.face-modal-step.is-hidden,
.is-hidden { display: none !important; }

@media (max-width: 560px) {
    .find-banner { flex-wrap: wrap; }
    .find-banner .btn-find { width: 100%; }
    .face-modal-actions { grid-template-columns: 1fr; }
}

