/* =========================================
   TeenSTAR Core - Frontend Styles
   ========================================= */

:root {
    --ts-primary: #e3047e; /* Magenta TeenSTAR */
    --ts-primary-dark: #c0036b;
    --ts-secondary: #e09900;
    --ts-text: #333;
    --ts-bg-light: #f9f9f9;
    --ts-border-radius: 20px;
}

/* =========================================
   1. UTILITIES & COMPONENTS
   ========================================= */

.ts-material-container {
    width: 100%;
    margin: 20px 0;
    font-family: 'DM Sans', sans-serif;
}

/* Buttons */
.ts-btn {
    width: 100%; height: 50px; border: none; border-radius: 8px;
    font-size: 16px; font-weight: 700; cursor: pointer;
    transition: all 0.3s ease; display: flex; align-items: center; justify-content: center;
    text-decoration: none; text-transform: none;
}
.ts-btn-primary { background-color: var(--ts-primary) !important; color: #fff !important; }
.ts-btn-primary:hover { background-color: var(--ts-primary-dark) !important; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(227, 4, 126, 0.3); }
.ts-btn-outline { background: transparent; border: 2px solid #ddd; color: #666 !important; font-weight: 600; }
.ts-btn-outline:hover { border-color: var(--ts-primary); color: var(--ts-primary) !important; background: #fff; }

.ts-btn-external { display: inline-flex; width: auto; padding: 12px 24px; background-color: var(--ts-primary); color: #fff !important; border-radius: 6px; }
.ts-btn-external:hover { background-color: var(--ts-primary-dark); }
.ts-btn .dashicons { font-size: 18px; line-height: 1.2; margin-left: 5px; }

/* Loading Spinner */
.btn-spinner { display: none; animation: spin 2s infinite linear; margin-left: 10px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.ts-btn.loading .btn-text { display: none; }
.ts-btn.loading .btn-spinner { display: block; }

/* Inputs */
.ts-form-group { margin-bottom: 20px; }
.ts-form-group label { display: block; margin-bottom: 8px; font-weight: 400; font-size: 15px; color: #555; }
.ts-input { width: 100%; height: 52px; padding: 0 20px; border: 1px solid #ccc; border-radius: 10px; font-size: 16px; background: #fff; color: #333; transition: all 0.3s ease; box-sizing: border-box; }
.ts-input:focus { border-color: var(--ts-primary); box-shadow: 0 0 0 3px rgba(227, 4, 126, 0.1); outline: none; }
.ts-input:disabled { background: #f0f0f0; color: #888; border-color: #ddd; cursor: not-allowed; }
.ts-form-extra { margin-bottom: 20px; font-size: 14px; color: #666; }

/* Grid System */
.ts-row { display: flex; gap: 20px; margin-bottom: 5px; }
.ts-col { flex: 1; }
@media (max-width: 600px) { .ts-row { flex-direction: column; gap: 0; } }

/* Messages */
.ts-msg-box { padding: 12px; border-radius: 6px; margin-bottom: 20px; font-size: 14px; text-align: center; }
.ts-msg-error { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.ts-msg-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.ts-admin-notice { background: #fff3cd; color: #856404; padding: 5px 10px; font-size: 11px; border-radius: 4px; display: inline-block; margin-bottom: 10px; border: 1px solid #ffeeba; }

/* =========================================
   2. AUTH CONTAINER
   ========================================= */
.ts-auth-container { display: flex; justify-content: center; align-items: center; padding: 60px 20px; font-family: 'DM Sans', sans-serif; min-height: 80vh; background-image: url('http://www.teenstar.cl/wp-content/uploads/2024/09/background-signs@2x-scaled.webp'); background-size: cover; background-position: center; background-repeat: no-repeat; }
.ts-auth-card { width: 100%; max-width: 450px; background: #ffffff; border-radius: 30px; padding: 50px 40px; box-shadow: 0 20px 50px rgba(0,0,0,0.1); position: relative; overflow: hidden; }
@supports (backdrop-filter: blur(10px)) { .ts-auth-card.ts-glass { background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px); } }
.ts-auth-header { text-align: center; margin-bottom: 35px; }
.ts-auth-header h2 { color: var(--ts-primary); margin: 0 0 10px 0; font-size: 28px; font-weight: 700; }
.ts-auth-header p { color: #666; margin: 0; font-size: 16px; }

/* =========================================
   3. DASHBOARD PERFIL
   ========================================= */
.ts-dashboard-wrapper { width: 100%; max-width: 1100px; background: #fff; border-radius: 30px; box-shadow: 0 20px 60px rgba(0,0,0,0.08); display: grid; grid-template-columns: 300px 1fr; overflow: hidden; min-height: 700px; }
.ts-dash-sidebar { background: #fff; border-right: 1px solid #f0f0f0; padding: 50px 30px; display: flex; flex-direction: column; align-items: center; }
.ts-dash-avatar { position: relative; margin-bottom: 15px; }
.ts-dash-avatar img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 4px solid #f9f9f9; box-shadow: 0 8px 20px rgba(0,0,0,0.08); margin-bottom: 20px; }
.ts-dash-name { font-size: 20px; font-weight: 700; color: #1a1a1a; margin: 0 0 5px 0; text-align: center; }
.ts-dash-role { font-size: 13px; background: var(--ts-primary); color: #fff; padding: 5px 15px; border-radius: 20px; font-weight: 600; margin-bottom: 40px; text-transform: uppercase; letter-spacing: 0.5px; }
.ts-dash-nav { width: 100%; display: flex; flex-direction: column; gap: 15px; }
.ts-nav-item { display: flex; align-items: center; width: 100%; padding: 15px 20px; border: none; background: transparent; border-radius: 15px; cursor: pointer; font-size: 15px; font-weight: 500; color: #666; transition: all 0.2s; text-align: left; }
.ts-nav-item img.ts-nav-icon { width: 28px; height: 28px; margin-right: 15px; object-fit: contain; }
.ts-nav-item .dashicons { font-size: 22px; margin-right: 15px; color: #888; display: flex; align-items: center; justify-content: center; }
.ts-nav-item:hover { background: #f8f9fa; color: var(--ts-primary); }
.ts-nav-item.active { background: #fff0f7; color: var(--ts-primary); font-weight: 700; }
.ts-logout-wrapper { margin-top: auto; width: 100%; padding-top: 30px; border-top: 1px solid #eee; }
.ts-dash-content { padding: 50px; background: #fff; }
.ts-tab-panel { display: none; animation: fadeIn 0.4s ease; }
.ts-tab-panel.active { display: block; }
.ts-content-header { margin-bottom: 40px; border-bottom: 2px solid #f5f5f5; padding-bottom: 20px; }
.ts-content-header h2 { font-size: 26px; color: var(--ts-primary); margin: 0; font-weight: 700; }
.ts-level-card { display: flex; align-items: center; background: #fff; border: 1px solid #eee; border-radius: 16px; padding: 25px; margin-bottom: 20px; text-decoration: none; transition: all 0.3s; box-shadow: 0 5px 15px rgba(0,0,0,0.03); }
.ts-level-card:hover { border-color: var(--ts-primary); transform: translateY(-5px); box-shadow: 0 15px 30px rgba(227, 4, 126, 0.15); }
.ts-level-icon { width: 60px; height: 60px; background: #fdf2f8; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-right: 25px; }
.ts-level-icon img { width: 35px; height: 35px; object-fit: contain; }
.ts-level-info h4 { margin: 0 0 5px 0; color: #333; font-size: 18px; font-weight: 700; }
.ts-level-info span { font-size: 14px; color: #888; }
.ts-level-arrow { margin-left: auto; color: var(--ts-primary); font-size: 20px; }
@media (max-width: 900px) { .ts-dashboard-wrapper { grid-template-columns: 1fr; border-radius: 0; min-height: auto; } .ts-dash-sidebar { border-right: none; border-bottom: 1px solid #eee; padding: 40px 20px; } .ts-dash-content { padding: 30px 20px; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   4. MATERIAL VIEWERS
   ========================================= */
.ts-embed-responsive { position: relative; display: block; width: 100%; padding: 0; overflow: hidden; border-radius: var(--ts-border-radius); background: #f0f0f1; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.ts-pdf-viewer { height: 600px; }
.ts-pdf-viewer iframe, .publuuflip { width: 100%; height: 100%; border: none; display: block; }
.ts-video-player { padding-bottom: 56.25%; background: #000; }
.ts-video-player iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
@media screen and (max-width: 600px) { .ts-pdf-viewer { height: 400px; } }

/* =========================================
   5. CONTENT CARDS
   ========================================= */
.ts-lock-card { display: flex; align-items: center; background: rgba(255, 255, 255, 0.95); border: 1px solid #e2e8f0; border-radius: var(--ts-border-radius); padding: 25px; max-width: 600px; margin: 20px auto; box-shadow: 0 4px 20px rgba(0,0,0,0.05); }
.ts-lock-icon { flex: 0 0 60px; height: 60px; background: #fee2e2; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-right: 20px; }
.ts-lock-icon .dashicons { font-size: 30px; width: 30px; height: 30px; color: #dc2626; }
.ts-lock-content h3 { margin: 0 0 5px 0; font-size: 18px; color: #1e293b; }
.ts-lock-content p { margin: 0; color: #64748b; font-size: 14px; line-height: 1.5; }
@media screen and (max-width: 600px) { .ts-lock-card { flex-direction: column; text-align: center; } .ts-lock-icon { margin-right: 0; margin-bottom: 15px; } }
.ts-link-card { background: #fff; border: 1px solid #eee; border-radius: var(--ts-border-radius); padding: 30px; text-align: center; box-shadow: 0 4px 6px rgba(0,0,0,0.05); max-width: 500px; margin: 0 auto; }
.ts-link-card h3 { margin-top: 0; color: var(--ts-text); }

/* =========================================
   6. GRID MATERIALS & TABS
   ========================================= */
.ts-materials-grid { display: flex; flex-direction: column; gap: 40px; width: 100%; }
.ts-material-item { background: #fff; border: 1px solid #f0f0f1; border-radius: var(--ts-border-radius); padding: 20px; box-shadow: 0 4px 10px rgba(0,0,0,0.03); }
.ts-material-title { margin-top: 0; margin-bottom: 20px; color: var(--ts-primary); font-size: 20px; border-bottom: 2px solid #f9f9f9; padding-bottom: 10px; }
.ts-materials-grid .ts-link-card { box-shadow: none; border: none; padding: 0; max-width: 100%; }
.ts-materials-grid .ts-link-card h3 { display: none; }
@media (min-width: 768px) { .ts-materials-grid.ts-cols-2 { display: grid; grid-template-columns: 1fr 1fr; } }
.ts-tabs-container { width: 100%; margin: 20px 0; font-family: 'DM Sans', sans-serif; }
.ts-tabs-nav { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; border-bottom: 2px solid #f0f0f1; padding-bottom: 10px; }
.ts-tab-link { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 10px 20px; cursor: pointer; font-size: 15px; font-weight: 500; color: #555; transition: all 0.3s ease; outline: none; }
.ts-tab-link:hover { background: #f9f9f9; color: var(--ts-primary); border-color: var(--ts-primary); }
.ts-tab-link.active { background: var(--ts-primary); color: #fff; border-color: var(--ts-primary); box-shadow: 0 4px 6px rgba(227, 4, 126, 0.2); }
.ts-tab-content { display: none; animation: tsFadeIn 0.5s; }
.ts-tab-content.active { display: block; }
@media screen and (max-width: 600px) { .ts-tabs-nav { flex-direction: column; gap: 5px; border-bottom: none; } .ts-tab-link { width: 100%; text-align: left; } }

/* =========================================
   7. NAVBAR (MENU INTELIGENTE - FIX DIVI)
   ========================================= */

.ts-navbar {
    width: 100%;
    z-index: 99999; 
    font-family: 'DM Sans', sans-serif;
    transition: all 0.3s ease;
}

/* FIX CRÍTICO: Eliminar Puntos y Márgenes de Divi */
.ts-navbar ul, .ts-navbar li, .ts-menu ul, .ts-menu li {
    list-style: none !important; list-style-type: none !important;
    padding: 0 !important; margin: 0 !important; background: none !important;
}
.ts-navbar li::before, .ts-menu li::before { display: none !important; content: none !important; }

/* --- ESTILO LIGHT (Estándar) --- */
.ts-navbar-light {
    background-color: transparent !important; /* CORREGIDO: Transparente para respetar el fondo de la web */
    position: relative; 
    box-shadow: none; /* Sin sombra para evitar líneas raras */
}

/* --- ESTILO DARK (Transparente) --- */
.ts-navbar-dark {
    background-color: transparent !important;
    position: absolute; 
    top: 0; left: 0;
    width: 100%;
    border: none !important; 
}

/* Container */
.ts-nav-container {
    max-width: 1280px; 
    margin: 0 auto;
    padding: 15px 40px; 
    display: flex;
    justify-content: space-between;
    align-items: center; 
}

/* Logo */
.ts-nav-logo img {
    height: 65px; 
    width: auto;
    display: block;
    transition: all 0.3s;
}

/* Desktop Menu */
.ts-nav-desktop { display: block; }
.ts-menu {
    display: flex; align-items: center; gap: 35px; 
}

.ts-menu > li { position: relative; padding: 10px 0; }

.ts-menu > li > a {
    text-decoration: none;
    font-size: 17px; 
    font-weight: 500;
    transition: color 0.3s;
    line-height: 1.5;
}

/* FLECHAS PARA MENÚS DESPLEGABLES */
.ts-menu > li.menu-item-has-children > a {
    padding-right: 18px;
    position: relative;
}
/* Chevron icon (v) creado con CSS */
.ts-menu > li.menu-item-has-children > a::after {
    content: "";
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 3px;
    transform: rotate(45deg) translateY(-50%);
    position: absolute;
    top: 40%;
    right: 0;
    transition: transform 0.3s;
    pointer-events: none;
}
/* Rotar flecha al pasar el mouse */
.ts-menu > li.menu-item-has-children:hover > a::after {
    transform: rotate(-135deg) translateY(-50%);
    top: 55%;
}

/* Dropdown (Submenú) */
.ts-menu .sub-menu {
    position: absolute;
    top: 100%; right: 0; 
    width: 260px;
    background: #ffffff !important; /* FONDO BLANCO SIEMPRE */
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    border-radius: 12px;
    padding: 10px 0; 
    opacity: 0; visibility: hidden;
    transform: translateY(15px);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    border-top: 4px solid var(--ts-primary);
    z-index: 100000;
}

/* Flechita decorativa sobre la caja del dropdown */
.ts-menu .sub-menu::before {
    content: "";
    position: absolute;
    top: -10px; right: 20px;
    border-width: 0 10px 10px 10px;
    border-style: solid;
    border-color: transparent transparent var(--ts-primary) transparent;
}

.ts-menu li:hover .sub-menu {
    opacity: 1; visibility: visible;
    transform: translateY(0);
}

/* Estilo de Ítems del Desplegable */
.ts-menu .sub-menu li a {
    display: block;
    padding: 12px 25px; 
    color: #555 !important; /* Texto SIEMPRE oscuro en dropdown */
    text-decoration: none;
    font-size: 15px;
    border-bottom: 1px solid #f9f9f9; 
    transition: all 0.2s;
}
.ts-menu .sub-menu li:last-child a { border-bottom: none; }

.ts-menu .sub-menu li a:hover {
    background: #fff9fc !important;
    color: var(--ts-primary) !important;
    padding-left: 30px; 
}

/* --- DESTACADOS EN DESPLEGABLE --- */

/* 1. Manuales / Niveles (Clase: ts-level-link) */
.ts-menu .sub-menu li.ts-level-link > a {
    font-weight: 700;
    color: var(--ts-primary) !important;
    background-color: #fffbfd;
}

/* 2. Logout (Detección por link) */
.ts-menu .sub-menu li a[href*="logout"] {
    color: #d63384 !important; /* Rojo rosado */
    font-weight: 600;
    background-color: #fff0f5 !important;
    margin: 8px 15px; 
    border-radius: 8px;
    text-align: center;
    border: 1px solid #ffe6f0;
}
.ts-menu .sub-menu li a[href*="logout"]:hover {
    background-color: #ffdeeb !important;
    color: #b01b63 !important;
    padding-left: 25px; 
}

/* --- COLORES DE TEXTO NIVEL 1 (Menu Principal) --- */

/* LIGHT: Texto oscuro */
.ts-navbar-light .ts-menu > li > a { color: #333; }
.ts-navbar-light .ts-menu > li > a:hover { color: var(--ts-primary); }

/* DARK: Texto blanco */
.ts-navbar-dark .ts-menu > li > a { color: #fff; }
.ts-navbar-dark .ts-menu > li > a:hover { color: rgba(255,255,255,0.8); }

/* --- CTA BUTTON (Clase: ts-cta) --- */
.ts-menu > li.ts-cta > a {
    background-color: var(--ts-primary);
    color: #fff !important; 
    padding: 12px 28px;
    border-radius: 50px; 
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(227, 4, 126, 0.3);
    text-shadow: none;
    display: inline-block;
}
.ts-menu > li.ts-cta > a:hover {
    background-color: var(--ts-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(227, 4, 126, 0.4);
}
/* Ajuste de flechita para botón CTA */
.ts-menu > li.ts-cta.menu-item-has-children > a { padding-right: 45px; }
.ts-menu > li.ts-cta.menu-item-has-children > a::after { right: 20px; border-color: #fff; top: 45%; }
.ts-menu > li.ts-cta.menu-item-has-children:hover > a::after { top: 55%; }

/* Mobile */
.ts-mobile-trigger { display: none; background: none; border: none; cursor: pointer; flex-direction: column; gap: 6px; z-index: 100001; }
.ts-mobile-trigger span { display: block; width: 30px; height: 3px; background: #333; border-radius: 3px; transition: 0.3s; }
.ts-navbar-dark .ts-mobile-trigger span { background: #fff; }

.ts-nav-mobile {
    display: none; 
    background: #fff; 
    padding: 20px 30px;
    position: absolute; 
    top: 100%; left: 0; width: 100%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    box-sizing: border-box;
    border-top: 1px solid #eee;
}

.ts-mobile-list { list-style: none; padding: 0; margin: 0; }
.ts-mobile-list li a { display: block; padding: 15px 0; border-bottom: 1px solid #f0f0f0; color: #333; text-decoration: none; font-size: 18px; font-weight: 500; }
.ts-mobile-list li.ts-cta > a { color: var(--ts-primary); font-weight: 700; }

.ts-mobile-list .sub-menu { display: none; padding-left: 20px; background: #f9f9f9; margin-top: 5px; margin-bottom: 10px; border-radius: 8px; position: static; width: auto; box-shadow: none; opacity: 1; visibility: visible; transform: none; border-top: none; }
.ts-mobile-list .sub-menu li a { font-size: 16px; padding: 12px 0; border-bottom: 1px solid #eee; }
/* Flecha móvil */
.ts-mobile-list li.menu-item-has-children > a::after { content: " ▼"; font-size: 12px; float: right; opacity: 0.5; } 
.ts-mobile-list li.menu-item-has-children:hover .sub-menu { display: block; } 

@media (max-width: 980px) {
    .ts-nav-desktop { display: none; }
    .ts-mobile-trigger { display: flex; }
    .ts-navbar.mobile-open .ts-nav-mobile { display: block; }
    .ts-nav-logo img { height: 50px; }
    
    .ts-navbar.mobile-open .ts-mobile-trigger span:nth-child(1) { transform: rotate(45deg) translate(7px, 6px); }
    .ts-navbar.mobile-open .ts-mobile-trigger span:nth-child(2) { opacity: 0; }
    .ts-navbar.mobile-open .ts-mobile-trigger span:nth-child(3) { transform: rotate(-45deg) translate(7px, -7px); }
    
    .ts-navbar-dark.mobile-open .ts-mobile-trigger span { background: #333; }
}

/* OTROS (Login, Perfil, etc) */
.ts-input { width: 100%; height: 52px; padding: 0 20px; border: 1px solid #ccc; border-radius: 10px; font-size: 16px; background: #fff; color: #333; box-sizing: border-box; }
.ts-btn { width: 100%; height: 50px; border: none; border-radius: 8px; font-size: 16px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.ts-btn-primary { background-color: var(--ts-primary) !important; color: #fff !important; }
.ts-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 100000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(5px); animation: fadeIn 0.3s ease; }
.ts-modal-content { background: #fff; width: 90%; max-width: 400px; border-radius: 24px; padding: 40px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.2); animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }