/* ====================================================================
   RIMASUNCHIK — admin.css
   Panel de administración
==================================================================== */

/* === TOKENS ====================================================== */
:root {
    --bg: #0c1311;
    --panel: #131d1a;
    --panel-hover: #1a2825;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.14);
    --text: #f6f2eb;
    --muted: #c8c0ba;
    --muted-2: #8f9b98;
    --fuchsia: #ef2b7e;
    --fuchsia-2: #ff6aac;
    --green: #34c36b;
    --radius: 22px;
    --radius-sm: 14px;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    --sidebar-w: 17rem;
    --font-display: "Newsreader", serif;
    --font-ui: "Sora", sans-serif;
}

/* === RESET ======================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 0.94rem;
    line-height: 1.6;
    background:
        radial-gradient(circle at top left, rgba(239, 43, 126, 0.15), transparent 28rem),
        linear-gradient(180deg, #0a100f, #101816);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

/* === MARCA ======================================================= */
.brand,
.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 0.96rem;
    letter-spacing: 0.04em;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--fuchsia), var(--fuchsia-2));
    font-size: 1rem;
    font-weight: 800;
    color: white;
    box-shadow: 0 10px 24px rgba(239, 43, 126, 0.28);
}

/* === LOGIN ======================================================= */
.admin-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.login-card {
    width: min(30rem, 100%);
    padding: 2.2rem;
    border-radius: 32px;
    border: 1px solid var(--line);
    background: rgba(19, 29, 26, 0.96);
    box-shadow: var(--shadow);
}

.login-card .login-brand {
    margin-bottom: 1.5rem;
}

.login-card h1 {
    margin: 0 0 0.5rem;
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.login-card p {
    color: var(--muted);
    line-height: 1.7;
    margin: 0 0 1.5rem;
    font-size: 0.92rem;
}

.back-link {
    display: inline-block;
    margin-top: 1.25rem;
    color: var(--muted);
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--text);
}

/* === LAYOUT DASHBOARD ============================================ */
.admin-dashboard {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

/* === SIDEBAR ===================================================== */
.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 1.4rem 1.2rem;
    border-right: 1px solid var(--line);
    background: rgba(8, 12, 11, 0.96);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.admin-sidebar .brand {
    padding: 0.4rem 0.4rem 0.6rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 0.4rem;
}

.admin-sidebar nav {
    display: grid;
    gap: 0.25rem;
    flex: 1;
}

.admin-sidebar nav a,
.sidebar-actions a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.72rem 0.9rem;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 0.9rem;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-sidebar nav a:hover,
.sidebar-actions a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.admin-sidebar nav a.is-active {
    background: rgba(239, 43, 126, 0.12);
    color: var(--fuchsia-2);
    border: 1px solid rgba(239, 43, 126, 0.18);
}

.sidebar-actions {
    display: grid;
    gap: 0.25rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--line);
    margin-top: 0.5rem;
}

/* === MAIN ======================================================== */
.admin-main {
    padding: 1.6rem;
    display: grid;
    gap: 1.4rem;
    align-content: start;
    min-width: 0; /* Evita overflow */
}

/* === TOPBAR ====================================================== */
.admin-topbar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.admin-topbar h1,
.section-title h2 {
    margin: 0.2rem 0 0;
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.eyebrow {
    display: inline-block;
    color: #ffcee1;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.74rem;
    font-weight: 700;
}

.topbar-badge {
    padding: 0.7rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
    font-size: 0.88rem;
    color: var(--muted);
    flex-shrink: 0;
}

/* === SECCIONES DEL ADMIN ======================================== */
.admin-section {
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(19, 29, 26, 0.9);
    box-shadow: var(--shadow);
}

.section-title {
    margin-bottom: 1.2rem;
}

.section-title p,
.current-media,
.empty-state {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0.3rem 0 0;
}

.empty-state {
    padding: 2rem;
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: var(--radius-sm);
}

/* === FORMULARIOS ================================================= */
.stacked-form,
.admin-form {
    display: grid;
    gap: 1rem;
}

.stacked-form label,
.admin-form label {
    display: grid;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 500;
}

.stacked-form input,
.admin-form input,
.admin-form textarea,
.admin-form select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 0.88rem 1rem;
    font: inherit;
    font-size: 0.94rem;
    transition: border-color 0.2s ease;
}

.stacked-form input:focus,
.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
    outline: 2px solid rgba(239, 43, 126, 0.3);
    border-color: rgba(239, 43, 126, 0.45);
}

.admin-form textarea {
    min-height: 7rem;
    resize: vertical;
}

.admin-form select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238f9b98' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* Botones de acción */
.stacked-form button,
.admin-form button,
.admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: fit-content;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--fuchsia), var(--fuchsia-2));
    color: white;
    font: inherit;
    font-weight: 700;
    font-size: 0.92rem;
    padding: 0.88rem 1.4rem;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(239, 43, 126, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stacked-form button:hover,
.admin-form button:hover,
.admin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(239, 43, 126, 0.3);
}

.admin-btn-ghost {
    background: transparent;
    box-shadow: none;
    border: 1px solid var(--line);
    color: var(--muted);
}

.admin-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: none;
    color: var(--text);
}

.admin-btn-danger {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    box-shadow: 0 12px 28px rgba(192, 57, 43, 0.22);
}

/* === GRIDS DE FORMULARIOS ======================================= */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.form-grid .full-width {
    grid-column: 1 / -1;
}

/* Repeaters */
.repeater-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.repeater-card {
    padding: 1.1rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.02);
    display: grid;
    gap: 0.8rem;
    position: relative;
}

.repeater-card:hover {
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.03);
}

/* Checkboxes y toggles */
.checkbox-row {
    display: inline-flex !important;
    align-items: center;
    gap: 0.7rem;
    cursor: pointer;
}

.checkbox-row input {
    width: auto !important;
    width: 1.1rem !important;
    height: 1.1rem !important;
    cursor: pointer;
}

/* === TABLA DE MENSAJES ========================================== */
.message-table {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    text-align: left;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--line);
    color: var(--muted-2);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.02);
}

td {
    text-align: left;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    color: var(--muted);
}

tr:last-child td {
    border-bottom: 0;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text);
}

td strong {
    color: var(--text);
}

/* === FLASH MESSAGES ============================================= */
.flash {
    padding: 0.9rem 1.1rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.flash-success {
    background: rgba(27, 127, 84, 0.18);
    border: 1px solid rgba(74, 196, 136, 0.25);
    color: #a8ffd4;
}

.flash-error {
    background: rgba(160, 30, 70, 0.22);
    border: 1px solid rgba(239, 43, 126, 0.32);
    color: #ffb8d1;
}

/* === CODE ======================================================= */
code {
    font-size: 0.88em;
    padding: 0.2rem 0.45rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    font-family: "Courier New", monospace;
    color: #a8ffd4;
}

/* === MEDIA PREVIEW ============================================== */
.media-preview {
    margin-top: 0.6rem;
}

.media-preview img {
    max-width: 12rem;
    max-height: 8rem;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
}

/* === BADGES / ESTADO ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.badge-new {
    background: rgba(239, 43, 126, 0.14);
    color: var(--fuchsia-2);
    border: 1px solid rgba(239, 43, 126, 0.22);
}

.badge-read {
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted-2);
}

/* === RESPONSIVE ================================================= */

/* 1080px: sidebar colapsa arriba */
@media (max-width: 1080px) {
    .admin-dashboard {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: center;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 0.9rem 1.2rem;
        overflow: visible;
    }

    .admin-sidebar .brand {
        border-bottom: 0;
        margin-bottom: 0;
        padding: 0;
        margin-right: 0.5rem;
    }

    .admin-sidebar nav {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.25rem;
        flex: 1;
    }

    .admin-sidebar nav a {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }

    .sidebar-actions {
        display: flex;
        flex-direction: row;
        border-top: 0;
        border-left: 1px solid var(--line);
        padding-top: 0;
        padding-left: 0.8rem;
        margin-top: 0;
        margin-left: 0.3rem;
    }

    .sidebar-actions a {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* 760px: formularios de 1 columna */
@media (max-width: 760px) {
    .form-grid,
    .repeater-grid {
        grid-template-columns: 1fr;
    }

    .admin-main {
        padding: 1.1rem;
        gap: 1rem;
    }

    .admin-section {
        padding: 1.2rem;
    }

    .login-card {
        padding: 1.4rem;
    }

    .admin-topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .topbar-badge {
        align-self: flex-start;
    }

    th,
    td {
        padding: 0.7rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* 520px: sidebar nav como columna vertical */
@media (max-width: 520px) {
    .admin-sidebar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.3rem;
    }

    .admin-sidebar nav {
        flex-direction: column;
    }

    .sidebar-actions {
        flex-direction: column;
        border-left: 0;
        border-top: 1px solid var(--line);
        padding-left: 0;
        padding-top: 0.6rem;
    }

    .admin-sidebar .brand {
        border-bottom: 1px solid var(--line);
        padding-bottom: 0.6rem;
        margin-bottom: 0.2rem;
    }

    .message-table {
        border-radius: 0;
    }

    /* Tabla scrollable en horizontal */
    table {
        min-width: 480px;
    }
}

/* === SLIDES REPEATER ============================================ */
.slides-repeater {
    display: grid;
    gap: 0.75rem;
}

.slide-card {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.025);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.slide-card:hover {
    border-color: var(--line-strong);
}

.slide-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    cursor: pointer;
    user-select: none;
    background: rgba(255, 255, 255, 0.02);
}

.slide-card-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.slide-num {
    display: grid;
    place-items: center;
    width: 1.8rem;
    height: 1.8rem;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(239, 43, 126, 0.18);
    color: var(--fuchsia-2);
    font-size: 0.78rem;
    font-weight: 800;
}

.slide-theme-dot {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    border-radius: 50%;
}

.slide-title-preview {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.slide-header-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.slide-toggle-btn,
.slide-del-btn {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--muted-2);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.slide-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.slide-del-btn:hover {
    background: rgba(192, 57, 43, 0.18);
    color: #ff8c7c;
    border-color: rgba(192, 57, 43, 0.35);
}

.slide-card.is-collapsed .slide-body {
    display: none;
}

.slide-card.is-collapsed .slide-toggle-btn {
    transform: rotate(-90deg);
}

.slide-body {
    padding: 1rem 1rem 1.2rem;
    display: grid;
    gap: 1rem;
    border-top: 1px solid var(--line);
}

.slide-subsection-label,
.social-section-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted-2);
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--line);
    margin-top: 0.2rem;
}

.slide-label-inline {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
}

.slide-theme-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

/* Theme color selector */
.theme-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.theme-option {
    display: flex !important;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--muted);
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.theme-option:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.theme-option input {
    position: absolute;
    opacity: 0;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none;
}

.theme-option:has(input:checked) {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.07);
    color: var(--text);
}

.theme-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.slide-add-btn {
    margin-top: 0.25rem;
}

/* === REDES SOCIALES ============================================= */
.social-section-label {
    margin-top: 0.8rem;
}

.social-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.social-field {
    display: grid !important;
    grid-template-columns: 2rem 1fr !important;
    grid-template-rows: auto auto !important;
    gap: 0.3rem 0.5rem !important;
    align-items: start;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
    transition: border-color 0.2s;
}

.social-field:hover {
    border-color: var(--line-strong);
}

.social-icon {
    grid-row: 1 / 3;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.social-icon svg {
    width: 1rem;
    height: 1rem;
}

.social-icon--fb  { color: #4267b2; }
.social-icon--ig  { color: #e1306c; }
.social-icon--li  { color: #0a66c2; }
.social-icon--tt  { color: #f0f0f0; }
.social-icon--yt  { color: #ff0000; }

.social-field > span:not(.social-icon) {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted-2);
    align-self: end;
}

.social-field input {
    grid-column: 2;
    grid-row: 2;
}

/* === ACCESIBILIDAD ============================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--fuchsia);
    outline-offset: 3px;
}
