:root {
    --bg: #f5f2ec;
    --card: #fff;
    --text: #171717;
    --muted: #777;
    --line: #e8e3da;
    --accent: #171717;
    --danger: #b42318;
    --radius: 24px;
    --shadow: 0 18px 60px rgba(0,0,0,.08)
}

* {
    box-sizing: border-box
}

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

body {
    min-height: 100vh
}

.page {
    padding: 32px 18px
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px
}

.narrow {
    max-width: 560px;
    margin: 40px auto
}

.event-card {
    max-width: 620px;
    margin: 25px auto;
    text-align: center
}

.wide {
    max-width: 1180px;
    margin: 0 auto
}

h1 {
    font-size: clamp(30px,5vw,54px);
    line-height: 1;
    margin: .2em 0 .25em;
    letter-spacing: -.04em
}

.eyebrow {
    font-size: 12px;
    letter-spacing: .18em;
    font-weight: 800;
    color: var(--muted)
}

.muted {
    color: var(--muted)
}

.small {
    font-size: 13px
}

.stack {
    display: grid;
    gap: 14px
}

.upload-box {
    display: grid;
    place-items: center;
    gap: 8px;
    padding: 34px;
    border: 2px dashed #d7d0c5;
    border-radius: 20px;
    cursor: pointer;
    background: #faf9f7
}

.upload-icon {
    font-size: 42px
}

.btn {
    appearance: none;
    border: 0;
    background: var(--accent);
    color: white;
    border-radius: 14px;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center
}

.btn.secondary {
    background: #eee9e1;
    color: #171717
}

.btn.danger {
    background: #fff0ee;
    color: var(--danger)
}

.btn:disabled {
    opacity: .5
}

.smallbtn {
    padding: 10px 13px;
    font-size: 13px
}

.link {
    color: inherit;
    text-decoration: none;
    font-weight: 700
}

.row {
    display: flex;
    align-items: center
}

.between {
    justify-content: space-between
}

.gap {
    gap: 8px;
    flex-wrap: wrap
}

textarea,input[type=password] {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    font: inherit
}

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

.status {
    min-height: 24px;
    margin: 0
}

.selection {
    font-size: 14px;
    color: var(--muted)
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 28px 0
}

.progress {
    height: 8px;
    background: #ece7df;
    border-radius: 999px;
    overflow: hidden
}

.progress>div {
    height: 100%;
    background: #171717;
    width: 0;
    transition: width .2s
}

.hidden {
    display: none
}

.success {
    padding: 14px;
    background: #ecfdf3;
    border-radius: 12px
}

.error {
    color: #b42318
}

.notice {
    padding: 14px;
    background: #fff6d8;
    border-radius: 12px
}

.event-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    border-top: 1px solid var(--line);
    text-decoration: none;
    color: inherit
}

.badge {
    font-size: 12px;
    font-weight: 800;
    background: #eee9e1;
    padding: 7px 10px;
    border-radius: 999px
}

.admin-head {
    margin-bottom: 20px
}

.moderation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(260px,1fr));
    gap: 18px
}

.mod-card {
    background: #fff;
    border: 2px solid transparent;
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.06)
}

.mod-card.pending {
    border-color: #e6b94f
}

.mod-card.approved {
    border-color: #71c88a
}

.mod-card.rejected {
    opacity: .45
}

.mod-card img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    border-radius: 12px;
    background: #eee
}

.mod-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0
}

.message-card {
    min-height: 220px;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 24px;
    border-radius: 12px;
    background: #f6f2eb;
    font-size: 22px
}

.gallery {
    columns: 4 230px;
    column-gap: 14px
}

.gallery-item,.gallery-message {
    display: block;
    break-inside: avoid;
    margin: 0 0 14px;
    border-radius: 16px;
    overflow: hidden;
    background: #fff
}

.gallery-item img {
    display: block;
    width: 100%;
    height: auto
}

.gallery-message {
    padding: 24px;
    font-size: 22px
}

.album-head {
    text-align: center;
    margin: 20px 0 32px
}

.live-body {
    margin: 0;
    background: #0a0a0a;
    color: white;
    overflow: hidden
}

.live-stage {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: grid;
    place-items: center;
    padding: 6vh 6vw
}

.live-brand {
    position: absolute;
    top: 4vh;
    left: 5vw;
    z-index: 3
}

.live-brand h1 {
    font-size: clamp(34px,5vw,82px);
    margin: .1em 0
}

/* =====================================================
   LIVE WALL - CONTENEDOR DEL SLIDESHOW
   ===================================================== */

.slide {
    position: relative;

    width: 88vw;
    height: 74vh;

    display: grid;
    place-items: center;

    overflow: hidden;

    border-radius: 18px;

    background: #050505;

    opacity: 0;

    transition:
        opacity 0.6s ease,
        transform 0.6s ease;
}

.slide.visible {
    opacity: 1;
}


/* =====================================================
   LIVE WALL - FOTO
   ===================================================== */

.live-photo {
    position: absolute;
    inset: 0;

    display: grid;
    place-items: center;

    overflow: hidden;
}


/*
 * Fondo desenfocado:
 * llena el área visible cuando la foto es vertical.
 */
.live-photo-backdrop {
    position: absolute;
    inset: -6%;

    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;

    filter:
        blur(28px)
        brightness(0.52)
        saturate(1.08);

    transform: scale(1.08);

    opacity: 0.95;
}


/*
 * Ligero oscurecimiento para que destaque la foto real.
 */
.live-photo::after {
    content: "";

    position: absolute;
    inset: 0;

    background: rgba(0, 0, 0, 0.08);

    pointer-events: none;
}


/*
 * Fotografía real.
 * contain = nunca cortar la foto.
 */
.live-photo-image {
    position: relative;
    z-index: 2;

    display: block;

    width: auto;
    height: auto;

    max-width: 100%;
    max-height: 100%;

    object-fit: contain;

    border-radius: 14px;

    box-shadow:
        0 28px 90px rgba(0, 0, 0, 0.5);
}


/*
 * Horizontal:
 * ocupa todo lo posible sin deformarse.
 */
.live-photo.landscape .live-photo-image {
    width: 100%;
    height: 100%;

    object-fit: contain;
}


/*
 * Vertical:
 * se muestra completa y deja un pequeño margen.
 */
.live-photo.portrait .live-photo-image {
    width: auto;
    height: 96%;

    max-width: 100%;

    object-fit: contain;
}

.empty-live,.live-message {
    text-align: center;
    font-size: clamp(28px,5vw,72px);
    max-width: 1100px;
    line-height: 1.08
}

.qr-panel {
    position: absolute;
    right: 4vw;
    bottom: 4vh;
    background: white;
    color: #111;
    padding: 14px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 14px 40px rgba(0,0,0,.3)
}

#qrcode img,#qrcode canvas {
    display: block
}

.qr-panel strong {
    font-size: 18px
}

@media(max-width:700px) {
    .page {
        padding: 18px 12px
    }
    .card {
        padding: 22px;
        border-radius: 18px
    }
    .admin-head {
        align-items: flex-start;
        gap: 12px;
        flex-direction: column
    }
    .live-brand {
        top: 3vh
    }
    .qr-panel {
        right: 3vw;
        bottom: 3vh;
        transform: scale(.78);
        transform-origin: bottom right
    }
    .slide {
        height: 68vh
    }
    .gallery {
        columns: 2 140px
    }
}

/* ===== FASE 2 DASHBOARD ===== */
.dashboard-shell {
    max-width: 1180px;
    margin: 0 auto
}

.login-card {
    max-width: 520px;
    margin: 8vh auto
}

.dashboard-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin: 14px 0 28px
}

.dashboard-top h1 {
    margin-bottom: 8px
}

.dashboard-logout {
    padding: 12px
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 14px;
    margin: 0 0 22px
}

.stat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px 20px;
    box-shadow: 0 8px 28px rgba(0,0,0,.04)
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em
}

.stat-card strong {
    display: block;
    font-size: 34px;
    letter-spacing: -.04em;
    margin-top: 4px
}

.stat-grid.compact {
    grid-template-columns: repeat(2,1fr);
    margin: 0
}

.event-dashboard-list {
    display: grid;
    gap: 14px
}

.dashboard-event-card {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 22px 24px;
    box-shadow: 0 8px 28px rgba(0,0,0,.04)
}

.event-title-row h2 {
    margin: 0;
    font-size: 23px;
    letter-spacing: -.025em
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    background: #aaa
}

.status-dot.active {
    background: #35a854;
    box-shadow: 0 0 0 5px rgba(53,168,84,.12)
}

.status-dot.closed {
    background: #999
}

.event-meta {
    display: flex;
    gap: 7px;
    align-items: center;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 13px;
    margin: 7px 0 12px
}

.event-status-pill {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 5px 8px;
    border-radius: 999px;
    background: #eee
}

.event-status-pill.active {
    background: #eaf8ee;
    color: #23733a
}

.mini-stats {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--muted)
}

.mini-stats strong {
    color: var(--text)
}

.event-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px
}

.event-link-row {
    display: flex;
    gap: 12px;
    font-size: 12px
}

.event-link-row a {
    color: var(--muted);
    font-weight: 700;
    text-decoration: none
}

.event-link-row a:hover {
    color: var(--text)
}

.empty-admin {
    text-align: center;
    padding: 46px
}

.form-shell {
    max-width: 760px;
    margin: 18px auto
}

.form-shell.wide-edit {
    max-width: 1120px
}

.form-eyebrow {
    margin-top: 30px
}

.form-card label {
    display: grid;
    gap: 8px;
    font-weight: 750;
    font-size: 14px
}

.form-card input[type=text],.form-card input[type=date],.form-card select {
    width: 100%;
    padding: 14px 15px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    font: inherit;
    color: inherit
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px
}

.form-actions {
    margin-top: 6px
}

.error-box {
    padding: 14px;
    background: #fff0ee;
    color: var(--danger);
    border-radius: 12px
}

.edit-header {
    align-items: flex-end;
    margin-bottom: 18px
}

.edit-layout {
    display: grid;
    grid-template-columns: minmax(0,1.1fr) minmax(320px,.9fr);
    gap: 20px;
    align-items: start
}

.slug-readonly {
    display: grid;
    gap: 7px;
    padding: 14px;
    background: #f8f5ef;
    border-radius: 14px
}

.slug-readonly span {
    font-weight: 750;
    font-size: 14px
}

.slug-readonly code {
    font-size: 15px
}

.slug-readonly small {
    color: var(--muted)
}

.links-card {
    padding: 22px
}

.share-link {
    display: grid;
    gap: 5px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line)
}

.share-link span {
    font-size: 12px;
    color: var(--muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em
}

.share-link a {
    font-size: 13px;
    color: inherit;
    overflow-wrap: anywhere
}

.qr-preview {
    display: grid;
    place-items: center;
    padding: 22px 0 0
}

.qr-preview #qrcode {
    padding: 10px;
    background: #fff;
    border-radius: 12px
}

.moderation-tabs {
    display: flex;
    gap: 8px;
    margin: 0 0 18px
}

.filter-chip {
    border: 1px solid var(--line);
    background: #fff;
    padding: 9px 13px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 750;
    color: var(--muted)
}

.filter-chip.active {
    background: #171717;
    color: #fff;
    border-color: #171717
}

@media(max-width:850px) {
    .dashboard-top,.dashboard-event-card,.edit-header {
        align-items: flex-start;
        flex-direction: column
    }
    .event-actions {
        align-items: flex-start;
        width: 100%
    }
    .stat-grid {
        grid-template-columns: repeat(2,1fr)
    }
    .edit-layout {
        grid-template-columns: 1fr
    }
    .form-grid {
        grid-template-columns: 1fr
    }
}

@media(max-width:520px) {
    .stat-grid {
        grid-template-columns: 1fr 1fr
    }
    .dashboard-event-card {
        padding: 18px
    }
    .event-link-row {
        gap: 10px;
        flex-wrap: wrap
    }
}

/* Event themes */
body.theme-elegant {
    --bg: #f3eee5;
    --card: #fffdf9;
    --text: #241d18;
    --muted: #8a7b70;
    --line: #e8ded1;
    --accent: #6a4b3a
}

.theme-elegant h1 {
    font-family: Georgia,"Times New Roman",serif;
    font-weight: 500;
    letter-spacing: -.03em
}

.theme-elegant .event-card {
    border-radius: 8px
}

.live-body.theme-elegant {
    background: #241d18
}

.theme-elegant .live-brand h1 {
    font-family: Georgia,"Times New Roman",serif;
    font-weight: 500
}

.theme-elegant .qr-panel {
    border-radius: 8px
}

body.theme-dark {
    --bg: #0c0d0f;
    --card: #15171a;
    --text: #f5f5f5;
    --muted: #9ea2a8;
    --line: #292c31;
    --accent: #f5f5f5;
    color: var(--text)
}

.theme-dark .card,.theme-dark .gallery-message {
    background: var(--card)
}

.theme-dark .btn {
    background: #f5f5f5;
    color: #111
}

.theme-dark .btn.secondary {
    background: #272a2f;
    color: #fff
}

.theme-dark textarea,.theme-dark input {
    background: #1c1f23;
    color: #fff;
    border-color: #34383f
}

.theme-dark .upload-box {
    background: #1b1d21;
    border-color: #3a3e45
}

.theme-dark hr {
    border-color: #2c3036
}

.theme-dark .notice {
    background: #292314
}

.live-body.theme-dark {
    background: #050607
}

.album-page.theme-dark .gallery-item {
    background: #15171a
}
