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

:root {
    --bg-gradient-start: #050816;
    --bg-gradient-end: #120f31;
    --accent: #e879f9;
    --accent-soft: rgba(232, 121, 249, 0.25);
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --glass-bg: rgba(15, 23, 42, 0.65);
    --glass-border: rgba(148, 163, 184, 0.35);
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.8);

    --level-verde: #22c55e;
    --level-amarillo: #eab308;
    --level-rojo: #ef4444;
    --level-neutral: #f9fafb;

    --radius-xl: 1.5rem;
    --radius-lg: 1rem;
    --radius-pill: 999px;

    --transition-fast: 0.18s ease-out;
    --transition-normal: 0.25s ease;
}

html, body {
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif;
    color: var(--text-main);
    background: radial-gradient(circle at top, #1d2337 0, #020617 55%, #000 100%);
}

.bg-gradient {
    min-height: 100vh;
    background:
        radial-gradient(circle at 0% 0%, rgba(96, 165, 250, 0.15), transparent 55%),
        radial-gradient(circle at 100% 0%, rgba(244, 114, 182, 0.18), transparent 55%),
        linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-main);
}

/* Header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 1.2rem 1.2rem 0.75rem;
    backdrop-filter: blur(22px);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    border-radius: 999px;
    padding: 0.6rem 1.4rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text-main);
}

.logo-mark {
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #f97316, #facc15, #b91c1c);
    box-shadow: 0 0 10px rgba(248, 250, 252, 0.6);
}

.logo-text {
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.main-nav {
    display: flex;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), transform 0.1s ease-out;
}

.nav-link:hover {
    color: var(--text-main);
    border-color: rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.7);
    transform: translateY(-1px);
}

/* Glass panels */

.glass-panel {
    background: radial-gradient(circle at top left, rgba(148, 163, 184, 0.15), transparent 40%),
                radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.16), transparent 45%),
                var(--glass-bg);
    border-radius: var(--radius-xl);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(22px) saturate(1.7);
}

/* Layout generales */

.landing,
.auth-main,
.admin-main {
    max-width: 1500px;
    margin: 0 auto;
    padding: 1rem 1.2rem 2.5rem;
}

/* Hero */

.hero {
    margin-top: 1.5rem;
    margin-bottom: 1.6rem;
}

.hero-inner {
    padding: 1rem 1rem;
    display: flex!important;
    gap: 0.75rem;
    justify-content: space-between;
}

.hero-title {
    font-size: 2rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 700;
}

.hero-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    max-width: 32rem;
}

/* Sección mensajes */

.messages-section {
    margin-top: 0.5rem;
}

.section-header {
    margin-bottom: 0.9rem;
}

.section-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

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

.messages-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.9rem;
}

/* Layout TV: QR a la izquierda + mensajes a la derecha */

.tv-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

@media (max-width: 900px) {
    .tv-layout {
        grid-template-columns: 1fr;
    }
}

.qr-panel {
    padding: 1.1rem 1rem;
    position: sticky;
    top: 6.5rem;
}

.qr-title {
    font-size: 1rem;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}

.qr-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
}

.qr-img {
    text-align: center;
    width: 100%;
    max-width: 200px;
    height: auto;
    display: block;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(248, 250, 252, 0.06);
}

.qr-url {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #e5e7eb;
    word-break: break-word;
}

/* Tarjeta mensaje */

.message-card {
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.35);
    position: relative;
    overflow: hidden;
}

.message-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top left, rgba(244, 114, 182, 0.18), transparent 55%);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.message-card:hover::before {
    opacity: 1;
}

.message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.2rem;
}

.message-pill {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: rgba(15, 23, 42, 0.7);
}

.message-author {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.message-title {
    font-size: 1.25rem;
    margin-bottom: 0.15rem;
    font-weight: 600;
}

.message-body {
    font-size: 1.1rem;
    line-height: 1.35;
    color: #e5e7eb;
    margin-bottom: 0.3rem;
}

.message-footer {
    display: flex;
    justify-content: flex-end;
}

.message-date {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Colores por nivel */

.message-level-verde {
    border-left: 3px solid var(--level-verde);
}

.message-level-amarillo {
    border-left: 3px solid var(--level-amarillo);
}

.message-level-rojo {
    border-left: 3px solid var(--level-rojo);
}

.message-level-neutral {
    border-left: 3px solid var(--level-neutral);
}

/* Empty state */

.empty-state {
    padding: 1.2rem 1.1rem;
    text-align: left;
}

.empty-state h3 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.empty-state p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Auth / Login */

.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 5rem);
}

.auth-wrapper {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    padding: 1.6rem 1.5rem 1.7rem;
}

.auth-title {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.2rem;
}

.auth-form {
    display: grid;
    gap: 0.9rem;
    margin-bottom: 1rem;
}

/* Admin layout */

.admin-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 1.1rem;
    margin-top: 1.3rem;
}

.admin-card {
    padding: 1.4rem 1.4rem 1.6rem;
}

.admin-title {
    font-size: 1.3rem;
    margin-bottom: 0.2rem;
}

.admin-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.admin-form {
    display: grid;
    gap: 0.85rem;
}

.admin-card-header {
    margin-bottom: 0.7rem;
}

.admin-card-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.admin-messages-list {
    display: grid;
    gap: 0.75rem;
    max-height: 460px;
    padding-right: 0.2rem;
    overflow-y: auto;
}

.admin-messages-list .message-card {
    box-shadow: none;
    background: rgba(15, 23, 42, 0.7);
}

.admin-note {
    margin-top: 0.9rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Formularios */

.form-group {
    display: grid;
    gap: 0.2rem;
}

.form-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    border-radius: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.85);
    color: var(--text-main);
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), transform 0.1s ease-out;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--accent);
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 0 0 1px var(--accent-soft);
    transform: translateY(-1px);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

/* Botones */

.btn-primary {
    border-radius: 999px;
    border: none;
    padding: 0.65rem 1.3rem;
    background: linear-gradient(135deg, #38bdf8, #a855f7);
    color: #fefefe;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 18px 40px rgba(56, 189, 248, 0.4);
    transition: transform 0.1s ease-out, box-shadow 0.12s ease-out, filter 0.1s ease-out;
}

.btn-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow: 0 22px 55px rgba(56, 189, 248, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.9);
}

.btn-full {
    width: 100%;
}

/* Alerts */

.alert {
    border-radius: 0.85rem;
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.6);
    color: #bbf7d0;
}

.alert-error {
    background: rgba(239, 68, 68, 0.13);
    border-color: rgba(239, 68, 68, 0.7);
    color: #fecaca;
}

/* Footer */

.site-footer {
    padding: 0.4rem 1.2rem 1.8rem;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}

.footer-text {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* --- Mensajes con scroll en landing --- */
.landing .messages-section {
    margin-top: 0.5rem;
}

.landing .messages-grid {
    max-height: 69vh;          /* Altura máxima del área de mensajes */
    overflow-y: auto;          /* Scroll vertical */
    padding-right: 0.5rem;
    scroll-behavior: smooth;   /* Scroll suave */
}

/* Scrollbar sutil para mensajes */
.landing .messages-grid::-webkit-scrollbar {
    width: 6px;
}
.landing .messages-grid::-webkit-scrollbar-track {
    background: transparent;
}
.landing .messages-grid::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.6);
    border-radius: 999px;
}

/* Animación de entrada específica de mensajes */
.message-card-enter {
    opacity: 0;
    transform: translateY(6px);
}
.message-card-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}


/* Responsive */

@media (max-width: 768px) {
    .header-inner {
        border-radius: 1rem;
    }

    .main-nav {
        display: none;
    }

    .hero-inner {
        border-radius: 1.1rem;
    }

    .admin-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .admin-messages-list {
        max-height: 260px;
    }
}



.btn-danger{ border:1px solid rgba(255,90,90,.55); background: rgba(255,90,90,.12); color: inherit; }
.btn-danger:hover{ background: rgba(255,90,90,.18); }
