/* 
   Juan El Discípulo - Design System
   Estilo Premium para Jóvenes Teólogos
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&family=Outfit:wght@300;400;600;900&display=swap');

:root {
    /* Paleta de Colores (Juvenil y Sobria a la vez) */
    --primary: #6366f1;
    /* Indigo vibrante */
    --primary-glow: rgba(99, 102, 241, 0.4);
    --accent: #f43f5e;
    /* Rose para alertas/interacción */

    /* Modo Claro (Default) */
    --bg: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.8);
    --text: #1e293b;
    --text-muted: #64748b;
    --glass-border: rgba(255, 255, 255, 0.3);
    --overlay-bg: rgba(15, 23, 42, 0.4);

    /* Tipografía */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-base-size: 16px;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --overlay-bg: rgba(0, 0, 0, 0.8);
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--font-base-size);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 800;
}

/* Efecto Glassmorphism */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

/* Botones Premium */
.btn-primary {
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px 0 var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 var(--primary-glow);
}

/* Botón de Cambio de Tema y Accesibilidad Global */
.theme-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.theme-toggle-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.1);
}

.theme-toggle-btn:active {
    transform: scale(0.9);
}

.sun-icon {
    display: none;
}

.moon-icon {
    display: block;
}

[data-theme="dark"] .sun-icon {
    display: block;
}

[data-theme="dark"] .moon-icon {
    display: none;
}

.sun-icon,
.moon-icon {
    width: 24px;
    height: 24px;
}

/* Utilidades de Fuente */
.font-xl {
    font-size: 1.5rem;
}

.font-lg {
    font-size: 1.25rem;
}

.font-md {
    font-size: 1rem;
}

.font-sm {
    font-size: 0.875rem;
}

/* Botón Volver Circular */
.btn-back-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px var(--primary-glow);
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    z-index: 10;
}

.btn-back-circle:hover {
    transform: scale(1.1) translateX(-3px);
    background: white;
    color: var(--primary);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn-back-circle svg {
    width: 24px;
    height: 24px;
}

/* 🔘 Botón de Cambio de Tema Estándar */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.theme-toggle-btn:hover {
    background: var(--primary);
    color: white;
    transform: rotate(15deg) scale(1.1);
}

.theme-toggle-btn svg {
    position: absolute;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 22px;
    height: 22px;
}

.theme-toggle-btn .sun-icon {
    opacity: 0;
    transform: translateY(25px);
}

.theme-toggle-btn .moon-icon {
    opacity: 1;
    transform: translateY(0);
}

[data-theme="dark"] .theme-toggle-btn .sun-icon {
    opacity: 1;
    transform: translateY(0);
}

[data-theme="dark"] .theme-toggle-btn .moon-icon {
    opacity: 0;
    transform: translateY(-25px);
}

/* 📝 Campos de Formulario */
.form-group {
    text-align: center;
    margin-bottom: 20px;
    width: 100%;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    background: white;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.2s ease;
    outline: none;
    text-align: center;
}

[data-theme="dark"] .form-input {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

/* 👤 Avatar Interactivo y Perfil */
.avatar-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.avatar-wrapper:hover {
    transform: scale(1.05);
}

.avatar-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--primary);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    border: 3px solid white;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.avatar-edit-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.avatar-wrapper:hover .avatar-edit-overlay {
    background: var(--accent);
    transform: scale(1.1);
}

/* ✂️ Cropper Modal Styles */
.cropper-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
}

.cropper-content {
    background: var(--bg);
    padding: 25px;
    border-radius: 24px;
    width: 95%;
    max-width: 450px;
    text-align: center;
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

#cropper-container {
    width: 100%;
    min-height: 300px;
    height: auto;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    overflow: hidden;
    /* Evitar desbordamiento de Croppie */
}

/* 🏔️ Perfil Header Rediseñado */
.profile-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.profile-header h1 {
    margin: 0 !important;
    font-size: 1.8rem !important;
    line-height: 1 !important;
}

/* 👁️ Password Visibility Toggle (Dentro del Campo) */
.password-toggle-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Centrar input si no ocupa todo */
}

.password-toggle-btn {
    position: absolute;
    right: 15px;
    /* Mantener al interior derecho del campo */
    top: 50%;
    transform: translateY(-50%);
    background: transparent !important;
    border: none !important;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: none !important;
}

/* 🔐 Password Requirements */
.password-requirements {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    text-align: center;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 0.8rem;
}

.requirement {
    color: var(--text-muted);
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.requirement.valid {
    color: #10b981;
    font-weight: 600;
}

.requirement.invalid {
    color: #ef4444;
}

.requirement i {
    font-size: 0.7rem;
}

.form-label {
    text-align: center !important;
    display: block;
    width: 100%;
}

.form-input {
    text-align: center !important;
}

.password-toggle-btn:hover {
    color: var(--primary);
    transform: translateY(-50%) scale(1.1);
}

.password-toggle-btn svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.glass-card {
    margin-top: 5px;
}

/* 🧭 Avatar de Navegación (Dashboard) */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 15px 6px 6px;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 99px;
    transition: all 0.3s ease;
    text-decoration: none;
}

[data-theme="dark"] .user-profile {
    background: rgba(30, 41, 59, 0.4);
}

.user-profile:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.avatar-nav {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: var(--primary);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    color: white;
    border: 2px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

/* 📚 Lesson Item - Diseño Unificado */
.lesson-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 15px 20px;
    width: 100%;
    border-radius: 16px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    /* Sombra permanente para móviles */
}

/* Refuerzo Crítico para Modo Claro (Percepción de Botón) */
[data-theme="light"] .lesson-item {
    background: white;
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.08);
}

.lesson-item:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
    transform: translateX(8px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.12);
}

/* 💎 PREMIUM TABLES STANDARD (JUAN EL DISCÍPULO) */
.premium-table-container {
    background: var(--card-bg);
    border-radius: 2em;
    overflow: hidden;
    border: 2px dashed rgba(99, 102, 241, 0.4);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
    margin: 3em 0;
    transition: all 0.3s ease;
    width: 100%;
}

.premium-table-container:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 20px 45px rgba(99, 102, 241, 0.1);
}

.premium-table-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    padding: 1.2em 2em;
    font-weight: 800;
    font-size: 1.15em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    letter-spacing: -0.01em;
    width: 100%;
}

.premium-table-body {
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    table-layout: auto;
}

.premium-table th {
    background: rgba(99, 102, 241, 0.05);
    color: var(--primary);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.85em;
    /* Cambiado de rem a em */
    letter-spacing: 1px;
    padding: 1.2em 1em;
    border-bottom: 2px solid rgba(99, 102, 241, 0.1);
    text-align: center !important;
}

.premium-table td {
    padding: 1.25em 1em;
    border-bottom: 1px solid var(--glass-border);
    text-align: center;
    color: var(--text);
    font-size: 0.95em;
    /* Cambiado de rem a em */
    line-height: 1.4;
    transition: background 0.2s ease;
}

.premium-table tr:last-child td {
    border-bottom: none;
}

.premium-table tr:hover td {
    background: rgba(99, 102, 241, 0.03);
}

.premium-table td:first-child,
.premium-table th:first-child {
    padding-left: 2em;
}

.premium-table td:last-child,
.premium-table th:last-child {
    padding-right: 2em;
}

.premium-table td:first-child {
    text-align: left;
    font-weight: 700;
}

[data-theme="dark"] .premium-table-container {
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .premium-table th {
    background: rgba(99, 102, 241, 0.1);
}

/* 🏷️ SECTION HEADERS (Alternativa a info_box para títulos) */
.section-premium-header {
    border-left: 5px solid var(--primary);
    padding: 0.5em 1.25em;
    margin: 2.5em 0 1em 0;
    background: linear-gradient(90deg, var(--primary-glow) 0%, transparent 100%);
    border-radius: 0 12px 12px 0;
}

.section-premium-header h3 {
    margin: 0;
    font-size: 1.3em;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: var(--font-heading);
}

.section-subtitle {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1em;
    color: var(--accent);
    margin: 1.5em 0 0.8em 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-subtitle::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}