/* 
   Ocupacional Móvil - Sistema de Estilos Premium 
   Diseño de Alta Calidad para Evaluador Psicomotriz CRC
*/

/* --- Variables de Diseño (Sistema de Color HSL) --- */
:root {
    color-scheme: dark; /* Force Safari to use dark-mode native form controls */
    --bg-gradient: radial-gradient(circle at 50% 50%, #0f172a 0%, #020617 100%);
    --font-outfit: 'Outfit', 'Inter', sans-serif;
    --font-inter: 'Inter', sans-serif;
    
    /* Colores HSL */
    --primary-hue: 190; /* Cyan */
    --primary: hsl(var(--primary-hue), 90%, 50%);
    --primary-hover: hsl(var(--primary-hue), 100%, 45%);
    --primary-glow: hsla(var(--primary-hue), 90%, 50%, 0.15);
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.15);
    
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.15);
    
    --slate-glass: rgba(15, 23, 42, 0.6);
    --border-glass: rgba(255, 255, 255, 0.08);
}

/* --- Estilos de Base --- */
body {
    background: var(--bg-gradient);
    font-family: var(--font-inter);
    color: #e2e8f0;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .font-outfit {
    font-family: var(--font-outfit);
}

/* --- Efecto Glassmorphism --- */
.glass {
    background: var(--slate-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Elementos de Formulario Premium (Global) --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.2s ease;
}

.form-group:focus-within label {
    color: var(--primary);
}

.form-group input, 
.form-group select {
    background: rgba(15, 23, 42, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    color: #ffffff;
    font-family: var(--font-inter);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.25s ease;
}

.form-group input::placeholder {
    color: #475569;
}

.form-group input:hover,
.form-group select:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    background: rgba(15, 23, 42, 0.95) !important;
}

/* --- Badges Estilizados --- */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 9999px;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.badge-cyan {
    background-color: hsla(var(--primary-hue), 90%, 50%, 0.1);
    color: var(--primary);
    border-color: hsla(var(--primary-hue), 90%, 50%, 0.2);
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.2);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.3);
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Animaciones e Interacción --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#step-1-view, #step-2-view, #step-3-view {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ================================================================
   PASO 3 — Filas Horizontales de Formulario (Form Row Horizontal)
   ================================================================ */
.form-row-horizontal {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.form-row-horizontal:last-child {
    border-bottom: none;
}

/* Label dentro de filas horizontales */
.form-row-horizontal > label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.form-row-horizontal:focus-within > label {
    color: var(--primary);
}

/* En pantallas medianas: layout horizontal lado a lado */
@media (min-width: 640px) {
    .form-row-horizontal {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }
    .form-row-horizontal > label {
        width: 48%;
        margin-bottom: 0;
    }
    .form-row-horizontal .input-addon-wrapper {
        width: 52%;
    }
}

/* ================================================================
   INPUT CON SUFIJO — Wrapper para unidad integrada (s / err / %)
   ================================================================ */
.input-addon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

/* El input dentro del wrapper: fondo oscuro, texto blanco visible */
.input-addon-wrapper input {
    width: 100%;
    background: rgba(15, 23, 42, 0.85) !important;
    -webkit-background-clip: padding-box !important;
    background-clip: padding-box !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.65rem;
    padding: 0.6rem 2.5rem 0.6rem 0.85rem;
    color: #f1f5f9 !important;
    -webkit-text-fill-color: #f1f5f9 !important; /* Fix Safari: respeta este en vez de color */
    font-family: var(--font-inter);
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
    -webkit-appearance: none !important; /* Quita el estilo nativo de Safari */
    appearance: none !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    -moz-appearance: textfield;
}

.input-addon-wrapper input::placeholder {
    color: #475569; /* Slate-600 — placeholder tenue, no invasivo */
    font-weight: 400;
}

.input-addon-wrapper input:hover {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(15, 23, 42, 0.95) !important;
}

/* Estado focus / escritura activa: borde cyan + glow */
.input-addon-wrapper input:focus,
.input-addon-wrapper input.input-active {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(2, 6, 23, 0.98) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important; /* Safari: texto blanco al escribir */
}

/* Quitar flechas del spinner de number en Chrome/Safari */
.input-addon-wrapper input[type=number]::-webkit-inner-spin-button,
.input-addon-wrapper input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Sufijo/unidad flotante a la derecha del input */
.input-addon-suffix {
    position: absolute;
    right: 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b; /* Slate-500 */
    pointer-events: none;
    text-transform: lowercase;
    user-select: none;
    transition: color 0.2s ease;
}

/* Al hacer focus el sufijo también se ilumina */
.input-addon-wrapper input:focus ~ .input-addon-suffix,
.input-addon-wrapper input.input-active ~ .input-addon-suffix {
    color: var(--primary);
}

/* ================================================================
   TEXTAREAS — Observaciones y Recomendaciones del profesional
   ================================================================ */
textarea.premium-textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    color: #f1f5f9 !important;
    font-family: var(--font-inter);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.6;
    outline: none;
    resize: vertical;
    min-height: 90px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea.premium-textarea::placeholder {
    color: #475569;
}

textarea.premium-textarea:hover {
    border-color: rgba(255, 255, 255, 0.22);
}

textarea.premium-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(2, 6, 23, 0.98) !important;
    color: #ffffff !important;
}

/* ================================================================
   SELECT PREMIUM — Desplegable de concepto override
   ================================================================ */
select.premium-select {
    width: 100%;
    background: rgba(15, 23, 42, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    color: #f1f5f9 !important;
    font-family: var(--font-inter);
    font-size: 0.875rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 1rem center !important;
    padding-right: 2.5rem;
}

select.premium-select option {
    background: #0f172a;
    color: #f1f5f9;
}

select.premium-select:hover {
    border-color: rgba(255, 255, 255, 0.22);
}

select.premium-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Ocultar elementos de impresión por defecto en pantalla */
.only-print {
    display: none !important;
}

/* --- SISTEMA DE IMPRESIÓN OFICIAL (Resolución 217) --- */
@media print {
    /* Reiniciar Estilos del Navegador para Impresión */
    @page {
        size: letter;
        margin: 1.5cm;
    }
    
    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-family: 'Inter', sans-serif !important;
        font-size: 10pt !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Ocultar elementos de la interfaz interactiva */
    .no-print {
        display: none !important;
    }

    /* Mostrar encabezado y elementos específicos de impresión */
    .only-print {
        display: block !important;
    }

    /* Expandir tarjeta a tamaño completo de página */
    .print-card {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Ajustar textos a negro puro */
    .print-text-black {
        color: #000000 !important;
    }

    /* Líneas y divisiones oscuras claras */
    .print-border-black {
        border-color: #333333 !important;
    }

    /* Fondos claros para contraste formal */
    .print-bg-light {
        background-color: #f8fafc !important;
        border: 1px solid #cbd5e1 !important;
    }

    /* Badges adaptados para impresión en blanco y negro o color formal */
    .print-badge {
        background: #f1f5f9 !important;
        border: 2px solid #000000 !important;
        color: #000000 !important;
        font-weight: 900 !important;
        border-radius: 4px !important;
    }

    /* Tabla de diagnóstico con líneas visibles */
    .print-table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin-top: 15px !important;
        margin-bottom: 15px !important;
    }

    .print-table th, 
    .print-table td {
        border: 1px solid #475569 !important;
        padding: 8px 12px !important;
        color: #000000 !important;
    }

    .print-table th {
        background-color: #f1f5f9 !important;
        font-weight: bold !important;
    }

    .print-divide-black {
        border-color: #475569 !important;
    }

    /* Forzar saltos de página y firmas fijas */
    .signature-section {
        margin-top: 50px !important;
        page-break-inside: avoid;
    }
}
