:root {
    --primary: #00c4cc;
    --accent: #01bbc4;
    --glow: rgba(0, 196, 204, 0.3);
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 86px;
}

/* TEMA OSCURO */
[data-theme="dark"] {
    --bg: #0b0e14;
    --nav-bg: rgba(21, 25, 33, 0.8);
    --card: rgba(21, 25, 33, 0.7);
    --text: #ffffff;
    --border: rgba(0, 196, 204, 0.2);
    --code-bg: rgba(0, 0, 0, 0.5);
    --code-text: var(--primary);
    --status-success: var(--primary);
}

/* TEMA CLARO */
[data-theme="light"] {
    --bg: #f8fafc;
    --nav-bg: rgba(255, 255, 255, 0.88);
    --card: rgba(255, 255, 255, 0.9);
    --text: #1e293b;
    --border: rgba(0, 196, 204, 0.4);
    --code-bg: #f1f5f9;
    --code-text: #334155;
    --status-success: #000000;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg) !important;
    color: var(--text);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    overflow-x: hidden;
}

/* NAVBAR DESKTOP */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 75px;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    z-index: 1000;
}

.nav-container {
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 18px;
}

.mobile-sidebar-brand,
.mobile-sidebar-toggle { display: none; }

.nav-menu { display: flex; align-items: center; gap: 30px; }
.nav-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    transition: 0.3s;
    background: none;
    border: none;
    cursor: pointer;
}
.nav-link:hover, .nav-link.active { color: var(--primary); }

.nav-dropdown { position: relative; }
.dropdown-content {
    position: absolute;
    top: 50px;
    left: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 220px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: 0.3s;
}
.dropdown-content.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.sub-item { display: flex; align-items: center; gap: 10px; padding: 12px 20px; color: var(--text); text-decoration: none; transition: 0.2s; font-size: 0.9rem; }
.sub-item:hover { background: rgba(0, 196, 204, 0.1); color: var(--primary); }
.action-btn { background: var(--border); border: none; color: var(--text); padding: 10px; border-radius: 10px; cursor: pointer; margin-left: 20px; }
.arrow-icon { transition: transform 0.25s ease; }
.arrow-icon.rotate { transform: rotate(180deg); }

/* CONTENIDO WEB */
.main-content { padding-top: 120px; width: 90%; max-width: 1200px; margin: 0 auto; }
.top-header { text-align: center; margin-bottom: 40px; }
.img-logo { max-width: 250px; height: auto; filter: drop-shadow(0 0 15px var(--glow)); }
.search-area { margin-bottom: 50px; }
.search-glass { background: var(--card); backdrop-filter: blur(10px); padding: 25px; border-radius: 20px; border: 1px solid var(--border); display: flex; gap: 15px; align-items: stretch; }
.input-box { flex: 1; display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.05); padding: 12px 18px; border-radius: 12px; border: 1px solid var(--border); }
.input-box input { background: none; border: none; color: var(--text); outline: none; width: 100%; font-size: 1rem; }
.primary-btn { background: var(--primary); color: #000; border: none; padding: 0 30px; border-radius: 12px; font-weight: bold; cursor: pointer; box-shadow: 0 0 15px var(--glow); transition: 0.2s; }
.pdf-btn { background: #fff; color: #000; border: none; padding: 12px 18px; border-radius: 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }

/* SCORE WEB */
.score-card { background: var(--card); border: 1px solid var(--border); padding: 30px; border-radius: 20px; text-align: center; margin-bottom: 40px; }
.score-number { font-size: 5rem; font-weight: 900; color: var(--primary); transition: all 0.5s ease; }
.score-number.bad-score { color: #ff5f5f !important; text-shadow: 0 0 20px rgba(255, 95, 95, 0.3); }

/* RESULTADOS WEB */
.results-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-bottom: 60px; }
.res-card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 30px; border-left: 8px solid transparent; transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.success-state { border-left-color: var(--primary) !important; border-color: var(--primary) !important; }
.error-state { border-left-color: #ff5f5f !important; border-color: #ff5f5f !important; }
.res-header { display: flex; align-items: center; gap: 10px; font-weight: 800; margin-bottom: 14px; }
.res-body { min-height: 40px; }

/* INFO CARDS */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 25px; border-top: 1px solid var(--border); padding: 40px 0; }
.info-card {
    background: var(--card);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: 0.3s ease;
}
.info-card h4 { color: var(--primary); margin: 0; text-transform: uppercase; font-size: 0.9rem; letter-spacing: 1px; }
.info-card p { font-size: 0.9rem; line-height: 1.6; margin: 0; color: var(--text); opacity: 0.95; text-align: left; }
.info-card strong { color: var(--primary); font-weight: 600; }
.info-card:hover { border-color: var(--primary); box-shadow: 0 10px 25px rgba(0, 196, 204, 0.05); }

/* UTILS */
.status-label { font-weight: bold; font-size: 0.8rem; letter-spacing: 1.5px; margin-bottom: 10px; text-transform: uppercase; display: inline-block; }
.code-block { background-color: var(--code-bg) !important; color: var(--code-text) !important; padding: 15px; border-radius: 10px; font-family: 'Courier New', monospace; font-size: 0.8rem; margin-top: 15px; word-break: break-all; white-space: pre-wrap; line-height: 1.5; border: 1px solid var(--border); }
.syntax-error { background: rgba(255, 95, 95, 0.05); border: 1px dashed #ff5f5f; color: #ff5f5f; padding: 12px; border-radius: 8px; margin-top: 10px; font-size: 0.75rem; }
.error-explanation { color: var(--text); font-size: 0.85rem; margin-top: 10px; line-height: 1.5; font-style: italic; opacity: 0.8; }
.hidden { display: none; opacity: 0; }
.fade-in { animation: fadeIn 0.6s ease forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

/* MÓVIL */
@media (max-width: 900px) {

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1090;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-sidebar-toggle {
        display: inline-flex;
        position: fixed;
        top: 18px;
        left: 18px;
        z-index: 1101;
        width: 48px;
        height: 48px;
        border-radius: 14px;
        border: 1px solid var(--border);
        background: var(--nav-bg);
        color: var(--text);
        align-items: center;
        justify-content: center;
        backdrop-filter: blur(12px);
        cursor: pointer;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    }

    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        width: var(--sidebar-width);
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1100;
        background: var(--nav-bg);
        overflow-y: auto;
    }

    .navbar.mobile-open {
        transform: translateX(0);
    }

    .nav-container {
        width: 100%;
        padding: 80px 15px 20px;
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .mobile-sidebar-brand {
        display: flex;
        justify-content: center;
        margin-bottom: 10px;
    }

    .sidebar-logo {
        max-width: 140px;
    }

    .nav-menu,
    .nav-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .nav-link,
    .dropdown-btn,
    .action-btn {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px;
        border-radius: 10px;
    }

    .dropdown-content {
        position: static;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: 0.3s;
    }

    .dropdown-content.open {
        max-height: 200px;
        opacity: 1;
    }

    .main-content {
        margin: 0 10px;
        padding-top: 100px;
    }

    .primary-btn {
        display: none;
    }

    .pdf-btn span {
        display: inline;
    }
    .nav-container {
    align-items: flex-start;
}

.nav-menu {
    width: 100%;
    align-items: flex-start;
}

.nav-link,
.dropdown-btn {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
}

.nav-actions {
    width: 100%;
    align-items: flex-start;
}
.nav-link span {
    text-align: left;
}
}

/* IMPRESIÓN PDF */
.pdf-container { display: none; }

@media print {
    @page { margin: 0; size: A4 portrait; }

    nav, .main-content, .nav-actions, .search-area, #scoreWrapper, #resultsGrid, .mobile-sidebar-toggle {
        display: none !important;
    }

    body { background: white !important; margin: 0; padding: 0; }

    .pdf-container {
        display: block !important;
        width: 210mm;
        height: 296mm;
        background-image: url('FondoPDF.png') !important;
        background-size: 100% 100% !important;
        background-repeat: no-repeat !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        position: relative;
        overflow: hidden;
    }

    .pdf-sheet {
        padding: 12mm 18mm;
        font-family: 'Inter', sans-serif;
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .pdf-top-bar { display: flex; justify-content: space-between; align-items: center; }
    .pdf-date-text { font-size: 11px; color: #666; }
    .pdf-brand-logo { height: 32px; }
    .pdf-header-divider { width: 100%; height: 2px; background: var(--primary); margin: 5px 0 10px 0; opacity: 0.3; }
    .pdf-main-title { text-align: center; color: var(--primary); font-size: 26px; text-decoration: underline; font-weight: 800; margin: 8px 0; }
    .pdf-domain-box { border: 1.2px solid var(--primary); margin: 0 auto 8px auto; padding: 5px 25px; border-radius: 8px; width: fit-content; font-size: 14px; font-weight: bold; color: #333; }
    .pdf-big-number { font-size: 55px; font-weight: 900; color: var(--primary); text-align: center; margin-top: 5px; line-height: 1; }
    .pdf-big-number.bad { color: #ff5f5f !important; }
    .pdf-status-desc { text-align: center; font-size: 18px; font-weight: bold; color: #ff5f5f; margin-bottom: 12px; text-transform: uppercase; }
    .pdf-status-desc.good { color: var(--primary) !important; }
    .pdf-card { background: rgba(255, 255, 255, 0.7); border: 1px solid #ddd; border-radius: 12px; padding: 10px 15px; margin-bottom: 8px; border-left: 6px solid var(--primary); }
    .pdf-card.error { border-left-color: #ff5f5f !important; border-color: #ff5f5f !important; }
    .pdf-card label { font-weight: bold; font-size: 12px; display: block; margin-bottom: 2px; color: #444; }
    .pdf-body .status-label { font-size: 9px; font-weight: 800; }
    .pdf-body .code-block { font-size: 8.5px !important; padding: 6px !important; margin-top: 4px !important; background: #f1f5f9 !important; color: #333 !important; border: 1px solid #ccc !important; }
    .pdf-body .error-explanation { font-size: 9px; margin-top: 2px; line-height: 1.2; color: #333; }
    .pdf-body .syntax-error { font-size: 8px; padding: 4px; border: 1px solid #ff5f5f; }
    .pdf-cta { margin-top: auto; padding-bottom: 30px; font-size: 14px; color: #333; }
    .pdf-link { color: #000000 !important; text-decoration: none; border-bottom: 1.5px solid var(--primary); padding-bottom: 2px; }
    .pdf-footer-info { padding-top: 10px; border-top: 1px solid #eee; font-size: 10px; color: #555; margin-bottom: 10mm; }
}

.error-state .syntax-error {
    background: rgba(255, 95, 95, 0.1);
    color: #ff5f5f;
    border: 1px dashed #ff5f5f;
}

.error-state .error-explanation {
    color: #ff8a8a;
}


/* AJUSTES DMARCONE FINAL */
.no-select,
.img-logo,
.sidebar-logo,
.pdf-brand-logo {
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-actions .action-btn {
    margin-left: 0;
    height: 42px;
    min-width: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.language-selector {
    background: var(--border);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
    outline: none;
    min-width: 72px;
    height: 42px;
}

.language-selector option {
    background: #111827;
    color: #ffffff;
}

[data-theme="light"] .language-selector option {
    background: #ffffff;
    color: #1e293b;
}

.dropdown-content {
    z-index: 1200;
}

.sub-item.disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 900px) {
    .search-glass {
        flex-direction: column;
        align-items: stretch;
    }

    .input-box,
    .primary-btn,
    .pdf-btn {
        width: 100%;
    }

    .primary-btn {
        display: flex !important;
        min-height: 48px;
        align-items: center;
        justify-content: center;
        padding: 14px 18px;
    }

    .pdf-btn {
        min-height: 48px;
    }

    .nav-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .language-selector,
    .nav-actions .action-btn {
        width: 100%;
        min-height: 46px;
    }

    .dropdown-content.open {
        max-height: 260px;
    }

    .sub-item {
        width: 100%;
    }
}
