:root {
    --bg0:#05020a;
    --bg1:#130522;
    --panel:rgba(18, 10, 32, .78);
    --line:rgba(192,132,252,.22);
    --purple:#a855f7;
    --cyan:#67e8f9;
    --green:#73ffad;
    --gold:#ffd36a;
    --red:#ff5c7a;
    --text:#fff7ed;
    --muted:rgba(255,255,255,.68);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }

body {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 10%, rgba(168,85,247,.22), transparent 32%),
        radial-gradient(circle at 82% 18%, rgba(103,232,249,.12), transparent 30%),
        radial-gradient(circle at 50% 90%, rgba(255,93,122,.12), transparent 36%),
        linear-gradient(145deg, var(--bg0), var(--bg1) 46%, #05020a);
    overflow-x: hidden;
}

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

.bg-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .45;
    background:
        linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(0deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(circle at center, black 0%, transparent 78%);
}

.bg-glow {
    position: fixed;
    width: 380px;
    height: 380px;
    border-radius: 999px;
    filter: blur(60px);
    pointer-events: none;
    opacity: .42;
}

.bg-glow-a { top: -120px; right: 4%; background: #7c3aed; }
.bg-glow-b { bottom: -160px; left: 10%; background: #0891b2; }

.guides-page,
.admin-page {
    position: relative;
    z-index: 2;
    width: min(1480px, calc(100% - 32px));
    margin: 0 auto;
    padding: 18px 0 40px;
}

.top-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.back-link,
.admin-link,
.btn-nav,
.clear-filter,
.cancel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 13px;
    letter-spacing: .2px;
    border: 1px solid rgba(255,255,255,.10);
    background: rgba(255,255,255,.045);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.back-link:hover,
.admin-link:hover,
.btn-nav:hover,
.clear-filter:hover,
.cancel-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(192,132,252,.45);
    box-shadow: 0 0 22px rgba(168,85,247,.20);
}

.admin-link {
    color: var(--cyan);
}

.hero-card,
.filters-card,
.form-card,
.list-card,
.admin-hero,
.alert {
    border: 1px solid var(--line);
    background:
        radial-gradient(circle at 15% 0%, rgba(168,85,247,.16), transparent 44%),
        linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.018)),
        var(--panel);
    box-shadow: 0 24px 70px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.07);
    backdrop-filter: blur(18px);
}

.hero-card {
    min-height: 320px;
    padding: clamp(28px, 4vw, 62px);
    border-radius: 34px;
    overflow: hidden;
}

.hero-kicker {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1.4px;
    color: var(--green);
    border: 1px solid rgba(115,255,173,.24);
    background: rgba(115,255,173,.07);
    text-transform: uppercase;
}

h1 {
    margin: 18px 0 10px;
    font-size: clamp(38px, 6vw, 86px);
    line-height: .92;
    letter-spacing: -2.5px;
    text-shadow: 0 0 35px rgba(168,85,247,.38);
}

.hero-card p,
.admin-hero p {
    max-width: 760px;
    color: var(--muted);
    font-size: clamp(16px, 1.5vw, 22px);
    line-height: 1.55;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 28px;
    max-width: 780px;
}

.hero-stats div {
    padding: 16px;
    border-radius: 20px;
    background: rgba(0,0,0,.25);
    border: 1px solid rgba(255,255,255,.08);
}

.hero-stats strong {
    display: block;
    font-size: 28px;
    color: var(--gold);
}

.hero-stats span {
    color: var(--muted);
    font-size: 13px;
}

.filters-card {
    margin: 18px 0;
    padding: 14px;
    border-radius: 24px;
}

.filters {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 260px auto auto;
    gap: 12px;
    align-items: end;
}

label span {
    display: block;
    margin-bottom: 7px;
    color: rgba(255,255,255,.75);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .8px;
}

input,
select,
textarea {
    width: 100%;
    color: var(--text);
    background: rgba(4, 2, 10, .72);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 16px;
    padding: 13px 14px;
    outline: none;
    font: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}

textarea { resize: vertical; }

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(103,232,249,.52);
    box-shadow: 0 0 0 4px rgba(103,232,249,.08);
}

button,
.filters button,
.form-actions button {
    min-height: 46px;
    padding: 10px 16px;
    border: 0;
    border-radius: 16px;
    cursor: pointer;
    color: #10051f;
    font-weight: 1000;
    background: linear-gradient(135deg, #73ffad, #67e8f9);
    box-shadow: 0 12px 26px rgba(103,232,249,.18);
}

.guides-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.guide-card,
.empty-card {
    min-height: 330px;
    padding: 20px;
    border-radius: 28px;
    border: 1px solid rgba(255,255,255,.10);
    background:
        radial-gradient(circle at 50% 0%, rgba(168,85,247,.17), transparent 48%),
        linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.015)),
        rgba(10, 5, 20, .74);
    box-shadow: 0 18px 48px rgba(0,0,0,.30), inset 0 1px 0 rgba(255,255,255,.06);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.guide-card.featured::before {
    content: "DESTACADA";
    position: absolute;
    top: 16px;
    right: -42px;
    transform: rotate(35deg);
    width: 150px;
    height: 25px;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 1000;
    color: #220b00;
    background: linear-gradient(90deg, #ffd36a, #ff8a00);
}

.guide-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pdf-badge {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 1000;
    background: linear-gradient(135deg, #ef4444, #7c2d12);
    box-shadow: 0 0 26px rgba(239,68,68,.28);
}

.guide-category {
    max-width: 70%;
    padding: 7px 11px;
    border-radius: 999px;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 900;
    background: rgba(103,232,249,.08);
    border: 1px solid rgba(103,232,249,.18);
}

.guide-card h2 {
    margin: 18px 0 10px;
    font-size: 25px;
    line-height: 1.08;
}

.guide-description {
    color: var(--muted);
    line-height: 1.5;
    flex: 1;
}

.guide-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
    color: rgba(255,255,255,.70);
    font-size: 12px;
}

.guide-meta span {
    padding: 7px 9px;
    border-radius: 999px;
    background: rgba(255,255,255,.045);
}

.guide-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.download-btn,
.view-btn {
    min-height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-weight: 1000;
}

.download-btn {
    color: #15031d;
    background: linear-gradient(135deg, #ffd36a, #73ffad);
}

.view-btn {
    padding: 0 16px;
    color: var(--cyan);
    border: 1px solid rgba(103,232,249,.22);
    background: rgba(103,232,249,.07);
}

.empty-card {
    grid-column: 1 / -1;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.empty-icon { font-size: 64px; }

.admin-hero {
    padding: 28px;
    border-radius: 30px;
    margin-bottom: 18px;
}

.admin-layout {
    display: grid;
    grid-template-columns: minmax(340px, 500px) minmax(0, 1fr);
    gap: 18px;
}

.form-card,
.list-card {
    border-radius: 28px;
    padding: 20px;
}

.form-card h2,
.list-card h2 {
    margin: 0 0 16px;
    font-size: 26px;
}

.guide-form {
    display: grid;
    gap: 13px;
}

.file-zone {
    display: block;
    padding: 16px;
    border: 1px dashed rgba(103,232,249,.34);
    border-radius: 20px;
    background: rgba(103,232,249,.055);
}

.file-zone small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
}

.checks {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.checks label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.045);
}

.checks input { width: auto; }

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-list {
    display: grid;
    gap: 12px;
}

.admin-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border-radius: 20px;
    background: rgba(0,0,0,.25);
    border: 1px solid rgba(255,255,255,.075);
}

.admin-item-title {
    font-size: 17px;
    font-weight: 1000;
}

.admin-item-meta {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.admin-item-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-item-actions a,
.admin-item-actions button {
    min-height: 36px;
    padding: 8px 11px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 900;
    color: #fff;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: none;
}

.admin-item-actions button {
    color: #ffd3dc;
    border-color: rgba(255,92,122,.28);
}

.admin-item-actions form { margin: 0; }

.alert {
    padding: 14px 16px;
    border-radius: 18px;
    margin: 12px 0;
    font-weight: 900;
}

.alert-ok {
    color: var(--green);
    border-color: rgba(115,255,173,.28);
}

.alert-error {
    color: #ffd3dc;
    border-color: rgba(255,92,122,.30);
}

.admin-empty {
    color: var(--muted);
    padding: 18px;
    border-radius: 18px;
    background: rgba(255,255,255,.04);
}

@media (max-width: 1180px) {
    .guides-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-layout { grid-template-columns: 1fr; }
    .filters { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
    .guides-page,
    .admin-page {
        width: min(100% - 18px, 1480px);
        padding-top: 10px;
    }

    .top-actions,
    .hero-stats,
    .filters,
    .guide-actions,
    .admin-item {
        grid-template-columns: 1fr;
    }

    .top-actions { display: grid; }
    .guides-grid { grid-template-columns: 1fr; }

    .hero-card {
        padding: 24px;
        border-radius: 24px;
    }

    h1 {
        font-size: 42px;
        letter-spacing: -1px;
    }

    .admin-item-actions { justify-content: stretch; }

    .admin-item-actions a,
    .admin-item-actions button {
        width: 100%;
    }
}


.btn-nav {
    min-height: 38px;
    padding: 9px 16px;
    border-radius: 12px;
    font-weight: 900;
    letter-spacing: .2px;
}

.btn-admin {
    color: #dff7ff;
    background: rgba(12, 76, 121, .42);
    border: 1px solid rgba(103, 232, 249, .32);
    box-shadow: 0 0 24px rgba(103, 232, 249, .12);
}

.btn-superadmin {
    color: #ffeefb;
    background: linear-gradient(135deg, rgba(168,85,247,.38), rgba(236,72,153,.28));
    border: 1px solid rgba(236,72,153,.46);
    box-shadow: 0 0 26px rgba(236,72,153,.20), inset 0 1px 0 rgba(255,255,255,.12);
}


/* COTNAS Guías v4: cabecera a media altura */
.guides-page {
    padding-top: 12px;
}

.hero {
    margin-bottom: 12px;
}

.top-actions {
    margin-bottom: 10px;
}

.hero-card {
    min-height: 0 !important;
    padding: clamp(14px, 1.7vw, 24px) clamp(18px, 2.2vw, 32px) !important;
    border-radius: 22px !important;
}

.hero-kicker {
    padding: 5px 9px !important;
    font-size: 10px !important;
    letter-spacing: 1.1px !important;
}

h1 {
    margin: 10px 0 6px !important;
    font-size: clamp(30px, 3.2vw, 44px) !important;
    line-height: 1 !important;
    letter-spacing: -1px !important;
}

.hero-card p {
    max-width: 760px !important;
    margin: 0 !important;
    font-size: clamp(13px, 1vw, 16px) !important;
    line-height: 1.35 !important;
}

.hero-stats {
    margin-top: 12px !important;
    max-width: 620px !important;
    gap: 8px !important;
}

.hero-stats div {
    padding: 8px 10px !important;
    border-radius: 14px !important;
}

.hero-stats strong {
    font-size: 19px !important;
    line-height: 1 !important;
}

.hero-stats span {
    font-size: 11px !important;
}

.filters-card {
    margin-top: 12px !important;
}

@media (max-width: 760px) {
    .hero-card {
        padding: 16px !important;
    }

    h1 {
        font-size: 30px !important;
    }

    .hero-stats {
        grid-template-columns: 1fr !important;
    }

    .top-actions {
        align-items: stretch !important;
    }

    .btn-nav,
    .back-link {
        width: 100%;
    }
}
