/* ============================================
   BioAsist — Sistema de Diseño v2.0 (Premium)
   ============================================ */

/* --- Importación de Google Fonts (respaldo si falla preconnect) --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    /* ── Principal - Azul Marino Vibrante ── */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;

    /* ── Acento - Cian/Verde Azulado ── */
    --accent-400: #22d3ee;
    --accent-500: #06b6d4;
    --accent-600: #0891b2;

    /* ── Colores Semánticos ── */
    --success-50: #ecfdf5;
    --success-400: #34d399;
    --success-500: #10b981;
    --success-600: #059669;

    --warning-50: #fffbeb;
    --warning-400: #fbbf24;
    --warning-500: #f59e0b;
    --warning-600: #d97706;

    --danger-50: #fef2f2;
    --danger-400: #f87171;
    --danger-500: #ef4444;
    --danger-600: #dc2626;

    --info-50: #f0f9ff;
    --info-400: #38bdf8;
    --info-500: #0ea5e9;

    /* ── Tema Oscuro (Por defecto) ── */
    --bg-primary: #0b0f1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1e293b;
    --bg-elevated: #1a2332;
    --bg-hover: rgba(37, 99, 235, 0.08);
    --bg-active: rgba(37, 99, 235, 0.15);
    --bg-card: rgba(17, 24, 39, 0.75);
    --bg-glass: rgba(17, 24, 39, 0.6);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-inverse: #0f172a;

    --border-color: rgba(148, 163, 184, 0.12);
    --border-light: rgba(148, 163, 184, 0.06);
    --border-glow: rgba(37, 99, 235, 0.25);

    /* ── Sombras ── */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.5), 0 4px 8px -4px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 24px 48px -8px rgba(0, 0, 0, 0.5), 0 8px 16px -6px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 24px rgba(37, 99, 235, 0.2);
    --shadow-glow-lg: 0 0 40px rgba(37, 99, 235, 0.3);

    /* ── Diseño ── */
    --sidebar-width: 268px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;

    /* ── Radios ── */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* ── Transiciones ── */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* ── Z-index ── */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal-backdrop: 300;
    --z-modal: 400;
    --z-toast: 500;

    /* ── Patrón de Fondo ── */
    --main-bg: linear-gradient(135deg, rgba(11, 15, 26, 0.95), rgba(17, 24, 39, 0.95)),
               url('../js/fotos/futurista.png');
}

/* ── Tema Claro ── */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #ffffff;
    --bg-hover: rgba(37, 99, 235, 0.06);
    --bg-active: rgba(37, 99, 235, 0.12);
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.7);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-inverse: #f1f5f9;

    --border-color: rgba(15, 23, 42, 0.08);
    --border-light: rgba(15, 23, 42, 0.04);
    --border-glow: rgba(37, 99, 235, 0.2);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 24px 48px -8px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 24px rgba(37, 99, 235, 0.1);

    --main-bg: linear-gradient(135deg, rgba(248, 250, 252, 0.96), rgba(241, 245, 249, 0.96)),
               url('../js/fotos/futurista.png');
}

/* ── Restablecimiento y Base ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--primary-400);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--primary-300);
}

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Tipografía ── */
h1 {
    font-size: 1.875rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
}
h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.3;
}
h3 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}
h4 {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}

/* ── Clases de Utilidad ── */
.text-xs { font-size: .75rem; }
.text-sm { font-size: .875rem; }
.text-lg { font-size: 1.125rem; }
.text-muted { color: var(--text-secondary); }
.text-success { color: var(--success-500); }
.text-warning { color: var(--warning-500); }
.text-danger { color: var(--danger-500); }
.text-primary-c { color: var(--primary-500); }
.text-center { text-align: center; }
.fw-medium { font-weight: 500; }
.fw-semibold { font-weight: 600; }
.fw-bold { font-weight: 700; }

/* ── Flex y Cuadrícula ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Espaciado ── */
.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.ml-auto { margin-left: auto; }
.mr-2 { margin-right: .5rem; }
.p-3 { padding: .75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.relative { position: relative; }

/* ── Barra de Desplazamiento Personalizada ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-full);
    transition: background 0.2s;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.45);
}

/* ── Pantalla de Carga ── */
.loading-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 9999;
    gap: 1.25rem;
    transition: opacity .6s ease, visibility .6s ease;
}
.loading-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loading-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.loading-screen h2 {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-300), var(--accent-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.03em;
    position: relative;
    z-index: 1;
}

.loading-screen p {
    color: var(--text-secondary);
    font-size: .875rem;
    position: relative;
    z-index: 1;
}

.loading-bar {
    width: 220px;
    height: 3px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.loading-bar-fill {
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, var(--primary-500), var(--accent-400));
    border-radius: var(--radius-full);
    animation: loading-slide 1.5s ease-in-out infinite;
}

/* ── Fotogramas Clave (Keyframes) ── */
@keyframes loading-slide {
    0% { transform: translateX(-100%); width: 30%; }
    50% { width: 60%; }
    100% { transform: translateX(400%); width: 30%; }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 24px rgba(99, 102, 241, 0.25), 0 0 48px rgba(99, 102, 241, 0.1); }
    50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.45), 0 0 80px rgba(99, 102, 241, 0.2); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* ── Clases de Animación ── */
.animate-fadeIn { animation: fadeIn var(--transition-base); }
.animate-fadeInUp { animation: fadeInUp var(--transition-slow); }
.animate-scaleIn { animation: scaleIn var(--transition-base); }

.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }

/* ── Diseño Responsivo ── */
@media (max-width: 1024px) {
    .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    h1 { font-size: 1.5rem; }
}

/* ── Robot Animado (Lottie Local) ── */
.robot-feedback-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9998;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}
.robot-feedback-container.active {
    opacity: 1;
}
.robot-feedback-container .robot-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.robot-feedback-container .robot-anim {
    position: relative;
    z-index: 1;
    width: 300px;
    height: 300px;
    filter: drop-shadow(0 0 40px rgba(99, 102, 241, 0.4));
    animation: robotBounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.robot-feedback-container .robot-label {
    position: relative;
    z-index: 2;
    margin-top: 1.25rem;
    padding: 0.85rem 2.2rem;
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    text-align: center;
    border-radius: 24px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: bubblePopIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}

/* Punta / colita de la burbuja de chat apuntando hacia el robot */
.robot-feedback-container .robot-label::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid var(--bubble-border-color, rgba(255, 255, 255, 0.3));
}

.robot-feedback-container .robot-label::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--bubble-bg-color, rgba(15, 23, 42, 0.95));
}

.robot-feedback-container .robot-label.error {
    --bubble-bg-color: rgba(35, 12, 18, 0.92);
    --bubble-border-color: rgba(255, 75, 75, 0.8);
    background: linear-gradient(135deg, rgba(45, 14, 22, 0.95), rgba(28, 8, 14, 0.95));
    border: 1.5px solid rgba(255, 75, 75, 0.7);
    color: #ff5252;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 68, 68, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.15);
    text-shadow: 0 0 16px rgba(255, 82, 82, 0.6), 0 2px 4px rgba(0, 0, 0, 0.8);
}

.robot-feedback-container .robot-label.success {
    --bubble-bg-color: rgba(8, 32, 22, 0.92);
    --bubble-border-color: rgba(52, 211, 153, 0.8);
    background: linear-gradient(135deg, rgba(10, 38, 26, 0.95), rgba(6, 24, 16, 0.95));
    border: 1.5px solid rgba(52, 211, 153, 0.7);
    color: #34d399;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5), 0 0 30px rgba(52, 211, 153, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.15);
    text-shadow: 0 0 16px rgba(52, 211, 153, 0.6), 0 2px 4px rgba(0, 0, 0, 0.8);
}

@keyframes robotBounceIn {
    0% { opacity: 0; transform: scale(0.3); }
    50% { opacity: 1; transform: scale(1.1); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

@keyframes bubblePopIn {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(0.85);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Burbuja Futurista Robot ── */
.futuristic-bubble {
    background: rgba(10, 15, 30, 0.85);
    border: 1px solid rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3), inset 0 0 10px rgba(99, 102, 241, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 4px 16px 16px 16px;
    padding: 8px 16px;
    position: relative;
    color: #e0e7ff;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    font-family: 'Courier New', Courier, monospace;
    text-shadow: 0 0 5px rgba(99, 102, 241, 0.8);
}
.futuristic-bubble::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: -10px;
    width: 15px;
    height: 10px;
    background: rgba(99, 102, 241, 0.5);
    clip-path: polygon(100% 0, 0 100%, 100% 100%);
}
.futuristic-text {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid #6366f1;
    width: 0;
    animation: typing 1.5s steps(18, end) 0.5s forwards, blink-caret 0.75s step-end infinite;
}
.futuristic-text-line1 {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid #6366f1;
    width: 0;
    animation: typing-line1 1.2s steps(18, end) 0.3s forwards, hide-caret 0.01s 1.5s forwards;
}
.futuristic-text-line2 {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid #6366f1;
    width: 0;
    animation: typing-line2 1.2s steps(18, end) 1.5s forwards, blink-caret 0.75s step-end infinite;
}
@keyframes typing {
    from { width: 0; }
    to { width: 19ch; }
}
@keyframes typing-line1 {
    from { width: 0; }
    to { width: 19ch; }
}
@keyframes typing-line2 {
    from { width: 0; }
    to { width: 19ch; }
}
@keyframes hide-caret {
    to { border-right-color: transparent; }
}
@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #6366f1; }
}



