/* isoteck — Sistema de tema visual
 * Variables derivadas del tema activo de la empresa (inyectadas inline por el layout).
 * Ver docs/arch/onboarding.md
 */

:root {
    --tema-primario:  #2563eb;
    --tema-acento:    #0ea5e9;
    --tema-50:  #eff6ff;
    --tema-100: #dbeafe;
    --tema-200: #bfdbfe;
    --tema-300: #93c5fd;
    --tema-400: #60a5fa;
    --tema-500: #3b82f6;
    --tema-600: #2563eb;
    --tema-700: #1d4ed8;
    --tema-800: #1e40af;
    --tema-900: #1e3a8a;
}

/* ─── Tipografía refinada ─────────────────────────────────── */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-feature-settings: 'cv11', 'ss01', 'ss03';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}
h1, h2, h3, h4 {
    letter-spacing: -0.025em;
}

/* ─── Clases utilitarias del tema ─────────────────────────── */
.t-bg-primario      { background-color: var(--tema-primario); }
.t-bg-50            { background-color: var(--tema-50); }
.t-bg-100           { background-color: var(--tema-100); }
.t-text-primario    { color: var(--tema-primario); }
.t-text-700         { color: var(--tema-700); }
.t-border-primario  { border-color: var(--tema-primario); }
.t-border-200       { border-color: var(--tema-200); }
.t-ring-primario    { --tw-ring-color: var(--tema-primario); }

.t-grad,
.t-grad-primario {
    background-image: linear-gradient(135deg, var(--tema-500) 0%, var(--tema-700) 100%);
}
.t-grad-suave {
    background-image: linear-gradient(135deg, var(--tema-50) 0%, var(--tema-100) 100%);
}
.t-grad-marca {
    background-image: linear-gradient(135deg, var(--tema-900) 0%, var(--tema-700) 50%, var(--tema-500) 100%);
}

/* ═══════════════════════════════════════════════════════════
   ESTILO: MINIMAL (plano, sobrio, editorial)
   ═══════════════════════════════════════════════════════════ */
body.tema-minimal {
    background: #fafafa;
}
body.tema-minimal .card,
body.tema-minimal .superficie {
    background: #ffffff;
    border: 1px solid #e7e7e9;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
body.tema-minimal .card:hover {
    border-color: #d4d4d8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
body.tema-minimal .boton-primario {
    background: var(--tema-primario);
    color: #ffffff;
    border-radius: 10px;
    padding: 0.625rem 1.125rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: background 0.15s ease, transform 0.1s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
body.tema-minimal .boton-primario:hover {
    background: var(--tema-700);
}
body.tema-minimal .boton-primario:active {
    transform: translateY(1px);
}
body.tema-minimal .sidebar-marca {
    background: #0a0a0a;
    color: #f5f5f5;
}
body.tema-minimal .divisor-fino {
    border-color: #e7e7e9;
}

/* ═══════════════════════════════════════════════════════════
   ESTILO: GLASS (vidrio esmerilado, profundidad, luz)
   ═══════════════════════════════════════════════════════════ */
body.tema-glass {
    background:
        radial-gradient(circle at 15% 10%, var(--tema-100) 0%, transparent 45%),
        radial-gradient(circle at 85% 90%, var(--tema-50) 0%, transparent 45%),
        linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    background-attachment: fixed;
    min-height: 100vh;
}
body.tema-glass .card,
body.tema-glass .superficie {
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 20px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 8px 24px rgba(15, 23, 42, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
body.tema-glass .card:hover {
    transform: translateY(-1px);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 16px 36px rgba(15, 23, 42, 0.08);
}
body.tema-glass .boton-primario {
    background: linear-gradient(135deg, var(--tema-500) 0%, var(--tema-700) 100%);
    color: #ffffff;
    border-radius: 14px;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.08),
        0 8px 20px color-mix(in srgb, var(--tema-primario) 28%, transparent);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
body.tema-glass .boton-primario:hover {
    transform: translateY(-1px);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.08),
        0 14px 28px color-mix(in srgb, var(--tema-primario) 38%, transparent);
}
body.tema-glass .sidebar-marca {
    background: linear-gradient(160deg, rgba(15, 23, 42, 0.92) 0%, var(--tema-900) 100%);
    backdrop-filter: blur(12px);
    color: #f1f5f9;
}
body.tema-glass .divisor-fino {
    border-color: rgba(148, 163, 184, 0.22);
}

/* ─── Stepper (común a ambos estilos, usa tema) ───────────── */
.stepper-activo {
    background: linear-gradient(135deg, var(--tema-500) 0%, var(--tema-700) 100%);
    color: #fff;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--tema-primario) 35%, transparent);
}
.stepper-completo {
    background: color-mix(in srgb, var(--tema-primario) 12%, white);
    color: var(--tema-700);
}

/* ═══════════════════════════════════════════════════════════
   SISTEMA DE ESTADO DE CAMPOS (patrón RaT)
   Verde = campo requerido lleno · Ámbar = requerido vacío
   JS en layout.php aplica las clases dinámicamente.
   ═══════════════════════════════════════════════════════════ */

input.campo-lleno,
select.campo-lleno,
textarea.campo-lleno {
    border-color: #86efac !important;
    background:   #f0fdf4 !important;
    color:        #166534 !important;
    font-weight:  600 !important;
}
input.campo-vacio-req,
select.campo-vacio-req,
textarea.campo-vacio-req {
    border-color: #fcd34d !important;
    background:   #fffbeb !important;
    color:        #b45309 !important;
}

/* ─── Pills / chips de opciones ──────────────────────────── */
.sgp-pill {
    display: inline-flex; align-items: center; gap: 4px;
    border: 1px solid #d1d5db; border-radius: 999px;
    padding: 5px 12px; font-size: 12px; font-weight: 600;
    color: #4b5563; background: #fff; cursor: pointer;
    transition: all .12s; white-space: nowrap;
}
.sgp-pill:hover { border-color: #9ca3af; }
.sgp-pill.on, .sgp-pill.activa {
    background: #f0fdf4; border-color: #86efac; color: #166534;
}
.sgp-pill.on::before, .sgp-pill.activa::before { content: '✓ '; font-weight: 800; }

/* ─── Badge ISO/normativa ─────────────────────────────────── */
.badge-iso {
    display: inline-flex; align-items: center;
    font-size: 10px; font-weight: 800;
    background: #eef2ff; color: #4338ca;
    padding: 3px 7px; border-radius: 6px; white-space: nowrap;
    letter-spacing: .02em;
}

/* ─── Badge de bloque numerado ────────────────────────────── */
.badge-bloque {
    width: 28px; height: 28px; border-radius: 9px;
    background: #2563eb; color: #fff;
    font-weight: 900; font-size: 13px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ─── Texto de ayuda en formularios ──────────────────────── */
.sgp-ayuda {
    font-style: italic; font-size: 13px;
    color: #8b93a1; line-height: 1.4;
}

/* ─── Modal con sombra profunda ───────────────────────────── */
.sgp-modal {
    background: #fff; border-radius: 18px;
    box-shadow: 0 30px 60px -30px rgba(0,0,0,.4), 0 2px 6px rgba(0,0,0,.05);
}

/* ─── Botón guardar principal ─────────────────────────────── */
.sgp-btn-guardar {
    background: #2563eb; color: #fff;
    font-weight: 800; font-size: 13px;
    padding: 9px 18px; border-radius: 9px;
    border: none; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background .15s;
}
.sgp-btn-guardar:hover { background: #1d4ed8; }
.sgp-btn-guardar:active { transform: translateY(1px); }

/* ─── Botón cerrar modal con tooltip ─────────────────────── */
.sgp-btn-cerrar {
    position: relative; color: #9ca3af; font-size: 22px;
    line-height: 1; cursor: pointer; background: none; border: none; padding: 4px;
    transition: color .12s;
}
.sgp-btn-cerrar:hover { color: #6b7280; }
.sgp-btn-cerrar .tip {
    position: absolute; top: 130%; right: 0; white-space: nowrap;
    background: #111827; color: #fff; font-size: 11px; font-weight: 600;
    padding: 5px 9px; border-radius: 7px;
    opacity: 0; pointer-events: none;
    transform: translateY(-3px); transition: opacity .15s, transform .15s;
    box-shadow: 0 6px 16px -6px rgba(0,0,0,.5); z-index: 100;
}
.sgp-btn-cerrar .tip::after {
    content: ''; position: absolute; bottom: 100%; right: 9px;
    border: 5px solid transparent; border-bottom-color: #111827;
}
.sgp-btn-cerrar:hover .tip { opacity: 1; transform: translateY(0); }

/* ─── Alpine.js: ocultar hasta inicializar ───────────────── */
[x-cloak] { display: none !important; }

/* ─── Foco accesible ─────────────────────────────────────── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--tema-primario);
    outline-offset: 2px;
    border-radius: 4px;
}
