@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Source+Serif+4:wght@500;600;700&display=swap');

/* =========================================================
   RESET
========================================================= */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =========================================================
   DESIGN TOKENS
   Paleta derivada de los colores reales del logo (medidos con
   Pillow desde AppFpichardo/static/img/logo.png y logo.jpg):
     - Azul dominante del logo: #7ca0b3 (steel blue apagado, no
       un azul marino saturado — H=201° S=27% L=59%).
     - Tinta del trazo: negro puro.
     - Fondo del isotipo: blanco roto.
    --violet/--violet-* son variantes de luminosidad de ESE mismo
    azul (no un azul distinto inventado). --coral/--coral-* usan
    tonos azules coordinados con el logo. Todos los tonos usados como texto están verificados
   contra WCAG AA (4.5:1 mínimo) — ver notas en cada variable.
========================================================= */
:root {
    /* --- Fondos --- */
    --bg: #f5f7fb;
    --bg-warm: #ffffff;
    --bg-cool: #eef4fb;
    --bg-card: #ffffff;
    --surface: #f1f5f9;
    --surface-2: #dbe4ee;

    /* --- Azul del logo (referencia real, uso decorativo: bordes,
       íconos, glows — NO usar como texto, solo 2.8:1 de contraste) --- */
    --logo-blue: #7ca0b3;

    /* --- Acento azul coordinado con el logo --- */
    --coral: #7ca0b3;                 /* fondos/badges decorativos */
    --coral-light: #b6d0dc;           /* texto sobre fondos oscuros */
    --coral-dark: #4f7488;            /* botones sólidos con texto blanco */
    --coral-glow: rgba(124, 160, 179, 0.14);

    /* Variante para texto sobre fondo claro (7.1:1 sobre blanco, pasa AA) */
    --coral-text: #25377e;

    /* Alias históricos usados en algunas plantillas (misma familia cálida) */
    --amber: var(--coral);
    --amber-light: var(--coral-light);
    --amber-glow: var(--coral-glow);

    /* --- Color de marca: azul del logo, oscurecido para uso como
       ancla (botones, navbar, footer) --- */
    --violet: #293d47;                /* fondos/botones, texto blanco 11.3:1 */
    --violet-light: #4f7488;          /* hover/acentos, pasa AA en ambas direcciones (~5:1) */
    --violet-dark: #1a272d;           /* footer, gradientes, el más oscuro */
    --violet-glow: rgba(41, 61, 71, 0.10);

    /* Alias históricos (misma familia azul, sin introducir tonos nuevos) */
    --teal: var(--violet-light);
    --teal-glow: var(--violet-glow);
    --sky: var(--violet-light);

    /* --- Texto --- */
    --text: #142436;
    --text-secondary: #445467;
    --text-muted: #586675;

    --border: rgba(20, 36, 54, 0.08);

    /* --- Sombras (derivadas del azul y del acento cálido nuevos) --- */
    --shadow-sm: 0 4px 14px rgba(15, 35, 58, 0.06);
    --shadow: 0 10px 28px rgba(15, 35, 58, 0.08);
    --shadow-lg: 0 18px 44px rgba(15, 35, 58, 0.12);
    --shadow-violet: 0 14px 32px rgba(41, 61, 71, 0.20);
    --shadow-color: 0 12px 28px rgba(51, 94, 153, 0.28);

    /* Sombra muy suave y difusa, poco opaca pero de mucho alcance —
       para tarjetas que deben sentirse "flotando" sobre el fondo en
       vez de pegadas a él (panel de administración). */
    --shadow-float: 0 30px 60px -12px rgba(41, 61, 71, 0.12), 0 8px 20px -8px rgba(41, 61, 71, 0.06);

    /* --- Radios --- */
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 22px;
    --radius-xl: 28px;

    /* --- Tipografía --- */
    --font-display: 'Source Serif 4', serif;
    --font-body: 'Inter', sans-serif;
    --font-accent: var(--font-display);

    /* --- Espaciado (escala consistente para todo el sitio) --- */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;

    /* --- Transiciones --- */
    --ease: cubic-bezier(.25,.46,.45,.94);
    --ease-soft: cubic-bezier(.22,.61,.36,1);
}

/* =========================================================
   ANIMACIONES COMPARTIDAS
   (usadas por casi todas las páginas; antes no existían
   y por eso las animaciones no se veían)
========================================================= */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes popIn {
    from { opacity: 0; transform: scale(.94); }
    to   { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* =========================================================
   BASE
========================================================= */
html {
    scroll-behavior: smooth;
}

body.site-body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* FONDOS DECORATIVOS */
body.site-body::before,
body.site-body::after {
    content: '';
    position: fixed;
    width: 40vw;
    height: 40vw;
    pointer-events: none;
    z-index: -1;
}

body.site-body::before {
    top: -20%;
    right: -15%;
    background: radial-gradient(circle, rgba(41, 61, 71, 0.06), transparent 70%);
}

body.site-body::after {
    bottom: -20%;
    left: -15%;
    background: radial-gradient(circle, rgba(138, 174, 225, 0.08), transparent 70%);
}

/* Accesibilidad: foco visible consistente en todo el sitio */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--violet-light);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* CONTENEDOR PRINCIPAL */
.site-main {
    position: relative;
    width: min(1260px, calc(100% - 40px));
    margin: auto;
    padding: clamp(12px, 3vw, 40px) 0 40px;
}

/* TIPOGRAFÍA */
h1, h2, h3 {
    font-family: var(--font-display);
    line-height: 1.1;
    color: var(--text);
}

h1 { font-size: clamp(1.8rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
h3 { font-size: clamp(1.15rem, 2.6vw, 1.5rem); }

p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--violet-glow);
    color: var(--violet);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* LINKS */
a {
    text-decoration: none;
    color: inherit;
}

/* IMÁGENES */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* IMÁGENES EN CARDS */
.card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--radius);
}

/* CARDS */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: 0.3s;
    padding: 12px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* GRID RESPONSIVE */
.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

/* BOTONES */
button,
.btn {
    border: none;
    padding: 10px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.95rem;
    font-family: var(--font-body);
    transition: 0.2s;
}

.btn {
    background: var(--violet);
    color: #fff;
    font-weight: 500;
}

.btn:hover {
    background: var(--violet-light);
    transform: translateY(-2px);
}

/* MENSAJES / ALERTAS (usadas por app.html, sin estilo propio antes) */
.site-messages {
    display: grid;
    gap: 10px;
    margin-bottom: var(--space-5);
}

.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--violet);
    font-size: 0.9rem;
    color: var(--text);
    animation: slideUp .35s var(--ease-soft) both;
}

.alert-success { border-left-color: #133c76; }
.alert-error    { border-left-color: #1d5cb3; }
.alert-warning  { border-left-color: var(--coral-dark); }
.alert-info     { border-left-color: var(--violet); }

.alert-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.alert-close:hover { color: var(--text); }

/* TABLAS RESPONSIVE */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

@media (max-width: 768px) {
    .table-responsive thead {
        display: none;
    }

    .table-responsive tbody {
        display: grid;
        gap: 16px;
    }

    .table-responsive tr {
        display: block;
        background: #fff;
        padding: 16px;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow);
    }

    .table-responsive td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 6px 0;
        text-align: right;
    }

    .table-responsive td::before {
        content: attr(data-label);
        font-size: 0.75rem;
        color: var(--text-muted);
        text-align: left;
    }
}

/* FORMULARIOS */
.form-grid {
    display: grid;
    gap: 12px;
}

@media (min-width: 768px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* UTILIDADES FLEX */
.flex {
    display: flex;
    gap: 10px;
}

.flex-wrap {
    flex-wrap: wrap;
}

/* SECCIONES */
.section {
    margin-bottom: 40px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: var(--space-5);
}

.section-link {
    color: var(--violet);
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
}

.section-link:hover { color: var(--coral-dark); }

/* =========================================================
   RESPONSIVE — escala móvil general
========================================================= */
@media (max-width: 1080px) {
    .site-main {
        width: min(94%, 900px);
    }
}

@media (max-width: 720px) {
    .site-main {
        width: calc(100% - 24px);
        padding-top: 16px;
    }

    .section-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    button,
    .btn {
        width: 100%;
    }

    h1 { letter-spacing: -0.01em; }
}

@media (max-width: 420px) {
    .site-main {
        width: calc(100% - 16px);
    }

    .eyebrow {
        font-size: 0.68rem;
        padding: 5px 11px;
    }
}

button:disabled,
.btn:disabled,
.is-loading {
    opacity: 0.65;
    cursor: progress !important;
    pointer-events: none;
}

/* AJUSTE HOVER EN MÓVIL (evita estados "pegados" al tocar) */
@media (max-width: 768px) {
    .card:hover {
        transform: none;
        box-shadow: var(--shadow);
    }
}

/* Utilidad para no romper el layout con contenido muy largo (SKU, correos, etc.) */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Botón flotante de WhatsApp */
.whatsapp-float {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #256dd3;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 26px rgba(37, 109, 211, 0.4);
    z-index: 900;
    transition: transform .25s, box-shadow .25s;
}

.whatsapp-float:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 14px 32px rgba(37, 109, 211, 0.5);
}

@media (max-width: 600px) {
    .whatsapp-float {
        width: 50px;
        height: 50px;
        bottom: 16px;
        right: 16px;
    }
}

/* Campo trampa (honeypot) para formularios públicos: oculto para
   personas reales, pero sigue "visible" en el DOM para que un bot que
   rellena automáticamente los campos caiga en la trampa (los bots más
   sofisticados evitan display:none/visibility:hidden a propósito). */
.campo-trampa {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
