/* ==========================================================================
   Aprende PHP - Arquitectura UI/UX Moderna
   Distribución estricta:
   1. [BOOTSTRAP] Variables CSS (--bs-*), Grid, Glassmorphism, Cards, Modals, Toasts
   2. [ANIME.JS]  Secuencias Hero, Split-Text Stagger, Trazado SVG (strokeDashoffset)
   3. [MOTION.DEV] Scroll Progress Bar, Scroll Reveal (inView) y Spring Physics 3D
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. [BOOTSTRAP] Personalización profunda de variables CSS Bootstrap 5.3
   -------------------------------------------------------------------------- */
:root,
[data-bs-theme="dark"] {
    /* Paleta de alto contraste jerarquizada */
    --bs-body-bg: #09090b;
    --bs-body-bg-rgb: 9, 9, 11;
    --bs-body-color: #f4f4f5;
    --bs-body-color-rgb: 244, 244, 245;
    --bs-secondary-color: #a1a1aa;
    --bs-tertiary-bg: #121217;

    /* Acentos de marca (Indigo + Cyan + Emerald) */
    --bs-primary: #6366f1;
    --bs-primary-rgb: 99, 102, 241;
    --bs-info: #22d3ee;
    --bs-info-rgb: 34, 211, 238;
    --bs-success: #10b981;
    --bs-success-rgb: 16, 185, 129;
    --bs-warning: #f59e0b;
    --bs-warning-rgb: 245, 158, 11;
    --bs-danger: #f43f5e;
    --bs-danger-rgb: 244, 63, 94;

    /* Tipografía y bordes redondeados modernos */
    --bs-font-sans-serif: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
    --bs-font-monospace: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --bs-border-color: rgba(255, 255, 255, 0.09);
    --bs-border-radius: 0.75rem;
    --bs-border-radius-lg: 1rem;
    --bs-border-radius-xl: 1.35rem;
    --bs-border-radius-xxl: 1.75rem;

    /* Sombras suaves multicapa */
    --shadow-elevated-sm: 0 4px 12px -2px rgba(0, 0, 0, 0.45), 0 2px 6px -1px rgba(99, 102, 241, 0.08);
    --shadow-elevated-md: 0 18px 40px -12px rgba(0, 0, 0, 0.7), 0 4px 18px -4px rgba(99, 102, 241, 0.16), inset 0 1px 0 0 rgba(255, 255, 255, 0.08);
    --shadow-elevated-lg: 0 28px 65px -15px rgba(0, 0, 0, 0.85), 0 0 45px -10px rgba(99, 102, 241, 0.28), inset 0 1px 0 0 rgba(255, 255, 255, 0.12);
}

/* [BOOTSTRAP] Ajustes globales para evitar colisiones y mejorar jerarquía tipográfica */
body {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-family: var(--bs-font-sans-serif);
    overflow-x: hidden;
}

a {
    text-decoration: none;
}

/* [BOOTSTRAP] Utilidades de Glassmorphism y Sombras Multicapa */
.glass-navbar {
    background: rgba(18, 18, 24, 0.72) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: var(--shadow-elevated-md);
}

.glass-card {
    background: linear-gradient(165deg, rgba(24, 24, 32, 0.78) 0%, rgba(14, 14, 20, 0.86) 100%);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-elevated-md);
    transition: border-color 0.28s ease, box-shadow 0.28s ease;
}

.glass-card:hover {
    border-color: rgba(99, 102, 241, 0.38);
    box-shadow: var(--shadow-elevated-lg);
}

/* [BOOTSTRAP] Personalización de Inputs con feedback táctil y visual */
.form-control-glass {
    background-color: rgba(9, 9, 11, 0.72) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #f4f4f5 !important;
    transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.2s ease !important;
}

.form-control-glass::placeholder {
    color: #52525b !important;
}

.form-control-glass:hover {
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.form-control-glass:focus {
    background-color: rgba(9, 9, 11, 0.95) !important;
    border-color: rgba(99, 102, 241, 0.75) !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18), 0 8px 25px -5px rgba(99, 102, 241, 0.25) !important;
    outline: none !important;
}

/* [BOOTSTRAP] Badges modernos de alto contraste */
.badge-glass-indigo {
    background: rgba(99, 102, 241, 0.14);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.badge-glass-cyan {
    background: rgba(34, 211, 238, 0.12);
    border: 1px solid rgba(34, 211, 238, 0.28);
    color: #67e8f9;
    font-weight: 600;
}

.badge-glass-emerald {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.28);
    color: #6ee7b7;
    font-weight: 600;
}

/* [BOOTSTRAP] Tooltip personalizado */
.tooltip {
    z-index: 1080;
    pointer-events: none;
}
.tooltip-inner {
    max-width: 280px;
    padding: 0.5rem 0.85rem;
    color: #f4f4f5;
    text-align: center;
    background: rgba(18, 18, 24, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.7), 0 0 20px -5px rgba(99, 102, 241, 0.35);
}
.bs-tooltip-top .tooltip-arrow::before { border-top-color: rgba(18, 18, 24, 0.95); }
.bs-tooltip-bottom .tooltip-arrow::before { border-bottom-color: rgba(18, 18, 24, 0.95); }
.bs-tooltip-start .tooltip-arrow::before { border-left-color: rgba(18, 18, 24, 0.95); }
.bs-tooltip-end .tooltip-arrow::before { border-right-color: rgba(18, 18, 24, 0.95); }

/* [BOOTSTRAP] Contenedor y diseño de Toasts */
.app-toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: calc(100vw - 2rem);
    pointer-events: none;
}
.app-toast-container > * {
    pointer-events: auto;
}
.toast {
    width: 360px;
    max-width: 100%;
    background: rgba(18, 18, 24, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1.1rem;
    box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.8), 0 0 35px -10px rgba(99, 102, 241, 0.4);
    color: #f4f4f5;
    overflow: hidden;
}
.toast-header {
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #f4f4f5;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.toast-body {
    padding: 0.9rem 1.1rem;
    font-size: 0.875rem;
    color: #a1a1aa;
    line-height: 1.5;
}

/* [BOOTSTRAP] Modales con Glassmorphism */
.modal-backdrop {
    background-color: rgba(5, 5, 8, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.modal-content {
    background: rgba(18, 18, 24, 0.96);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1.5rem;
    box-shadow: 0 35px 80px -20px rgba(0, 0, 0, 0.9), 0 0 60px -15px rgba(99, 102, 241, 0.35);
    color: #f4f4f5;
}
.modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.25rem 1.5rem;
}
.modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1rem 1.5rem;
}

/* [BOOTSTRAP] Dropdown Menu Glassmorphism */
.dropdown-menu {
    min-width: 14.5rem;
    padding: 0.5rem;
    margin: 0.5rem 0 0;
    background: rgba(18, 18, 24, 0.96) !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 1.1rem !important;
    box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.85), 0 0 30px -10px rgba(99, 102, 241, 0.3) !important;
    color: #f4f4f5;
}
.dropdown-item {
    color: #d4d4d8 !important;
    border-radius: 0.65rem;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.55rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    transition: all 0.18s ease;
}
.dropdown-item:hover,
.dropdown-item:focus {
    background: rgba(99, 102, 241, 0.18) !important;
    color: #ffffff !important;
}
.dropdown-divider {
    border-color: rgba(255, 255, 255, 0.08) !important;
    margin: 0.4rem 0;
}

/* --------------------------------------------------------------------------
   2. [ANIME.JS] Secuencias Complejas, Staggering y Trazado de Líneas SVG
   -------------------------------------------------------------------------- */

/* [ANIME.JS] Trazos SVG dinámicos animados con strokeDashoffset */
.anime-svg-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    will-change: stroke-dashoffset;
}

.anime-svg-ring {
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

/* [ANIME.JS] Partículas ambientales interactivas */
.anime-particle {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    opacity: 0.7;
    will-change: transform, opacity;
}

/* [ANIME.JS] Letras/palabras animadas en cascada con anime.stagger() */
.anime-split-char {
    display: inline-block;
    will-change: transform, opacity;
}

/* --------------------------------------------------------------------------
   3. [MOTION.DEV] Scroll Progress Bar y Micro-interacciones Spring Physics
   -------------------------------------------------------------------------- */

/* [MOTION.DEV] Barra superior de progreso de lectura impulsada por scroll() */
.motion-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1 0%, #22d3ee 50%, #10b981 100%);
    transform-origin: 0% 50%;
    transform: scaleX(0);
    z-index: 2000;
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.75);
    pointer-events: none;
}

/* [MOTION.DEV] Elementos interactivos con físicas de resorte (spring) */
.motion-spring-btn,
.motion-spring-card,
.anime-btn,
.anime-interactive {
    will-change: transform;
    transform-style: preserve-3d;
    cursor: pointer;
}

/* Badge con pulso de luz interactivo */
.pulse-badge {
    position: relative;
}
.pulse-badge::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    background: inherit;
    opacity: 0.4;
    animation: badgePulse 2.4s infinite ease-out;
    z-index: -1;
}
@keyframes badgePulse {
    0% { transform: scale(0.95); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 0; }
    100% { transform: scale(0.95); opacity: 0; }
}
