/* ==========================================================================
   CIBER-DETECTIVES: SEGURIDAD DIGITAL • ESTILOS (3ER GRADO)
   ========================================================================== */

:root {
    --bg-dark: #080C1E;
    --primary-blue: #0284C7;
    --primary-cyan: #38BDF8;
    --accent-amber: #F59E0B;
    --accent-emerald: #10B981;
    --accent-rose: #F43F5E;
    --accent-purple: #8B5CF6;
    
    --card-bg: rgba(22, 30, 52, 0.9);
    --border-glow: rgba(56, 189, 248, 0.35);
    
    --font-kids: 'Fredoka', cursive, sans-serif;
    --font-main: 'Plus Jakarta Sans', system-ui, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body.detective-body {
    min-height: 100vh;
    background: radial-gradient(circle at 50% 15%, #1E1B4B 0%, #080C1E 70%, #03050F 100%);
    color: #FFFFFF;
    font-family: var(--font-kids);
    overflow-x: hidden;
    padding-bottom: 30px;
}

#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 100;
}

/* 1. BARRA SUPERIOR */
.detective-header {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.btn-detective-nav {
    background: rgba(30, 41, 59, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    text-decoration: none;
    font-weight: 800;
    padding: 8px 18px;
    border-radius: 99px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-detective-nav:hover {
    background: var(--accent-amber);
    color: #080C1E;
    transform: scale(1.05);
}

.detective-title-group {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.badge-grade {
    background: var(--accent-amber);
    color: #080C1E;
    font-weight: 900;
    font-size: 0.8rem;
    padding: 3px 14px;
    border-radius: 99px;
}

.detective-title {
    font-size: 1.45rem;
    font-weight: 900;
    background: linear-gradient(135deg, #FFFFFF 0%, #FDE047 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.detective-tools {
    display: flex;
    gap: 8px;
}

.btn-tool {
    background: rgba(30, 41, 59, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.btn-tool:hover {
    background: var(--accent-amber);
    color: #080C1E;
}

/* 2. SELECTOR DE CASOS */
.missions-tab-bar {
    max-width: 1000px;
    margin: 0 auto 16px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

@media (max-width: 650px) {
    .missions-tab-bar {
        grid-template-columns: 1fr;
    }
}

.mission-tab-btn {
    background: rgba(30, 41, 59, 0.8);
    border: 2.5px solid rgba(255, 255, 255, 0.15);
    color: #CBD5E1;
    font-family: var(--font-kids);
    font-size: 1rem;
    font-weight: 800;
    padding: 12px 16px;
    border-radius: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
}

.mission-tab-btn:hover {
    background: rgba(51, 65, 85, 0.9);
    border-color: #38BDF8;
}

.mission-tab-btn.active {
    background: linear-gradient(135deg, #0284C7 0%, #38BDF8 100%);
    border-color: #FDE047;
    color: #080C1E;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
    transform: translateY(-2px);
}

/* 3. CONTENEDOR DE CASOS */
.detective-container {
    max-width: 950px;
    margin: 0 auto;
    padding: 0 20px;
}

.case-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.case-section.active-case {
    display: block;
}

.case-card {
    background: var(--card-bg);
    border: 3px solid var(--border-glow);
    border-radius: 28px;
    padding: 26px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
}

.case-header-box {
    text-align: center;
    border-bottom: 2px dashed rgba(255, 255, 255, 0.12);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.case-tag {
    background: #0284C7;
    color: #FFFFFF;
    font-size: 0.8rem;
    font-weight: 900;
    padding: 4px 14px;
    border-radius: 99px;
    display: inline-block;
    margin-bottom: 6px;
}

.case-header-box h2 {
    font-size: 1.6rem;
    font-weight: 900;
    color: #FDE047;
    margin-bottom: 4px;
}

.case-header-box p {
    font-size: 1.05rem;
    color: #94A3B8;
}

/* CASO 1: PASSWORD LAB */
.password-lab-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
    align-items: center;
}

@media (max-width: 750px) {
    .password-lab-grid {
        grid-template-columns: 1fr;
    }
}

.input-lbl {
    display: block;
    font-size: 0.95rem;
    font-weight: 800;
    color: #38BDF8;
    margin-bottom: 8px;
}

.pwd-input-wrap {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.pwd-input-field {
    flex: 1;
    background: #0A0F1D;
    border: 2px solid #38BDF8;
    border-radius: 14px;
    padding: 10px 14px;
    font-family: var(--font-kids);
    font-size: 1.1rem;
    color: #FFFFFF;
    outline: none;
}

.btn-generate {
    background: var(--accent-amber);
    color: #080C1E;
    font-family: var(--font-kids);
    font-weight: 900;
    border: none;
    border-radius: 14px;
    padding: 0 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-generate:hover {
    transform: scale(1.05);
}

.strength-meter-box {
    background: #0A0F1D;
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 15px;
}

.meter-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.meter-bar-track {
    height: 12px;
    background: #1E293B;
    border-radius: 99px;
    overflow: hidden;
}

.meter-bar-fill {
    height: 100%;
    width: 15%;
    background: #EF4444;
    border-radius: 99px;
    transition: width 0.3s ease, background 0.3s ease;
}

.pwd-checklist {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.check-item {
    font-size: 0.9rem;
    color: #94A3B8;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s;
}

.check-item.valid {
    color: #10B981;
}
.check-item.valid i {
    color: #10B981;
}
.check-item.valid i::before {
    content: "\f058"; /* check circle */
}

/* Reactor del Virus Cracker */
.cracker-reactor-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.reactor-screen {
    background: #060913;
    border: 3px solid #EF4444;
    border-radius: 20px;
    padding: 20px;
    width: 100%;
    text-align: center;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    transition: all 0.3s;
}

.reactor-screen.shield-active {
    border-color: #10B981;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.6);
}

.virus-boss-face {
    font-size: 4.5rem;
    margin-bottom: 6px;
    animation: gentleBob 2s infinite;
}

.cracker-status {
    font-size: 0.95rem;
    color: #FCA5A5;
    font-weight: 700;
}

.btn-test-shield {
    width: 100%;
    background: linear-gradient(135deg, #059669 0%, #10B981 100%);
    color: #FFFFFF;
    font-family: var(--font-kids);
    font-size: 1.15rem;
    font-weight: 900;
    padding: 14px;
    border-radius: 18px;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    transition: all 0.2s;
}

.btn-test-shield.disabled {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(1);
}

.btn-test-shield:hover:not(.disabled) {
    transform: scale(1.03);
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.8);
}

/* CASO 2: PHISHING RADAR */
.phishing-inspector-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 680px;
    margin: 0 auto;
}

.message-card {
    background: #0A0F1D;
    border: 3px solid #38BDF8;
    border-radius: 22px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
}

.msg-sender-row {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    margin-bottom: 12px;
}

.msg-avatar {
    font-size: 2.2rem;
}

.msg-meta {
    display: flex;
    flex-direction: column;
}

.msg-meta strong {
    font-size: 1.05rem;
    color: #FDE047;
}

.msg-meta small {
    color: #94A3B8;
    font-size: 0.85rem;
}

.msg-body {
    font-size: 1.15rem;
    line-height: 1.4;
    color: #E2E8F0;
    margin-bottom: 15px;
}

.detective-clue-box {
    background: rgba(245, 158, 11, 0.2);
    border: 1.5px solid #F59E0B;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.95rem;
    color: #FEF08A;
}

.verdict-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 550px) {
    .verdict-controls {
        grid-template-columns: 1fr;
    }
}

.btn-verdict {
    font-family: var(--font-kids);
    font-size: 1.1rem;
    font-weight: 900;
    padding: 16px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    transition: all 0.2s;
}

.btn-safe {
    background: linear-gradient(135deg, #059669 0%, #10B981 100%);
    color: #FFFFFF;
}

.btn-danger {
    background: linear-gradient(135deg, #DC2626 0%, #EF4444 100%);
    color: #FFFFFF;
}

.btn-verdict:hover {
    transform: scale(1.04);
}

.phish-progress-tracker, .privacy-tracker {
    text-align: center;
    font-size: 0.9rem;
    color: #94A3B8;
    margin-top: 15px;
    font-weight: 800;
}

/* CASO 3: PRIVACY GUARDIAN */
.privacy-arena {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    max-width: 650px;
    margin: 0 auto;
}

.privacy-token-box {
    background: #0A0F1D;
    border: 4px solid #F59E0B;
    border-radius: 24px;
    padding: 24px;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.3);
    animation: gentleBob 3s infinite;
}

.token-icon {
    font-size: 4.5rem;
}

.token-title {
    font-size: 1.45rem;
    font-weight: 900;
    color: #FFFFFF;
}

.token-hint {
    font-size: 0.95rem;
    color: #94A3B8;
}

.privacy-drop-zones {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    width: 100%;
}

@media (max-width: 550px) {
    .privacy-drop-zones {
        grid-template-columns: 1fr;
    }
}

.zone-btn {
    font-family: var(--font-kids);
    border-radius: 22px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    padding: 20px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    transition: all 0.2s;
}

.zone-public {
    background: linear-gradient(135deg, #0284C7 0%, #38BDF8 100%);
    color: #080C1E;
}

.zone-private {
    background: linear-gradient(135deg, #7C3AED 0%, #9333EA 100%);
    color: #FFFFFF;
}

.zone-btn i {
    font-size: 2.2rem;
}

.zone-btn strong {
    font-size: 1.25rem;
    font-weight: 900;
}

.zone-btn small {
    font-size: 0.85rem;
    opacity: 0.9;
}

.zone-btn:hover {
    transform: translateY(-4px) scale(1.03);
    border-color: #FFFFFF;
}

/* 4. MODAL DIPLOMA */
.detective-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 17, 0.95);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 200;
}

.detective-modal-overlay.active {
    display: flex;
}

.detective-modal-card {
    background: #FFFFFF;
    color: #0F172A;
    width: 100%;
    max-width: 640px;
    border-radius: 30px;
    border: 10px solid #F59E0B;
    padding: 35px;
    text-align: center;
    box-shadow: 0 25px 70px rgba(0,0,0,0.8);
    animation: zoomIn 0.3s ease;
}

.modal-badge {
    background: #F59E0B;
    color: #080C1E;
    font-size: 0.9rem;
    font-weight: 900;
    padding: 6px 20px;
    border-radius: 99px;
    display: inline-block;
    margin-bottom: 8px;
}

.modal-title {
    font-size: 2rem;
    font-weight: 900;
    color: #0F172A;
}

.diploma-subtitle {
    font-size: 1.05rem;
    color: #64748B;
    margin-bottom: 12px;
}

.modal-mascot {
    width: 95px;
    height: 95px;
    border-radius: 50%;
    border: 4px solid #F59E0B;
    margin-bottom: 12px;
}

.diploma-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 8px;
}

.student-input {
    width: 85%;
    max-width: 380px;
    padding: 10px 16px;
    font-family: var(--font-kids);
    font-size: 1.3rem;
    font-weight: 900;
    text-align: center;
    color: #D97706;
    background: #FFFBEB;
    border: 3px dashed #F59E0B;
    border-radius: 16px;
    outline: none;
    margin-bottom: 14px;
}

.diploma-desc {
    font-size: 1.05rem;
    color: #475569;
    margin-bottom: 22px;
    line-height: 1.45;
}

.diploma-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.btn-modal {
    font-family: var(--font-kids);
    font-size: 1.05rem;
    font-weight: 900;
    padding: 12px 24px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-print { background: #10B981; color: #FFFFFF; }
.btn-home { background: #334155; color: #FFFFFF; }
.btn-modal:hover { transform: scale(1.05); }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes gentleBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
