/* ============================================================
   base.css — InnovTEC Design System
   Compartido por: InnovTEC, DentiControl, MediControl,
                   NutriControl, PsiControl
   
   PALETA OFICIAL:
   Azul    #1B5DAE → identidad, estructura, confianza
   Naranja #E84B1A → acción, CTA, urgencia
   Amarillo #F5C400 → acento puntual (badges, íconos)
   ============================================================ */

/* ── Variables ────────────────────────────────────────────── */
:root {
    /* Azul — color principal */
    --azul:           #1B5DAE;
    --azul-dark:      #0D3A72;
    --azul-light:     #E8F0FB;
    --azul-grad:      linear-gradient(135deg, #1B5DAE, #0D3A72);

    /* Naranja — acción y conversión */
    --naranja:        #E84B1A;
    --naranja-dark:   #9E3210;
    --naranja-light:  #FDEEE9;

    /* Amarillo — acento puntual */
    --amarillo:       #F5C400;
    --amarillo-light: #FEF7D6;

    /* Neutros */
    --blanco:         #ffffff;
    --gris-claro:     #f7f9fa;
    --gris:           #e2e8ea;
    --gris-medio:     #cbd5e1;
    --texto:          #1a2e35;
    --texto-suave:    #6b7280;

    /* Sistema */
    --radio:          14px;
    --radio-sm:       8px;
    --radio-lg:       20px;
    --sombra:         0 2px 16px rgba(27,93,174,0.08);
    --sombra-md:      0 4px 24px rgba(27,93,174,0.12);
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: 'Nunito', sans-serif;
    background: var(--gris-claro);
    color: var(--texto);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── Tipografía ───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    line-height: 1.25;
    color: var(--texto);
}

p { line-height: 1.7; }

a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Botones ──────────────────────────────────────────────── */

/* Primario — azul (identidad / estructura) */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--azul-grad);
    color: var(--blanco);
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.65rem 1.4rem;
    border-radius: var(--radio-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.btn-primary:hover { opacity: 0.88; color: var(--blanco); text-decoration: none; }

/* CTA — naranja (acción / conversión) */
.btn-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--naranja);
    color: var(--blanco);
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.65rem 1.4rem;
    border-radius: var(--radio-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}
.btn-cta:hover { background: var(--naranja-dark); color: var(--blanco); text-decoration: none; }

/* Secundario — outline azul */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    color: var(--azul);
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.63rem 1.4rem;
    border-radius: var(--radio-sm);
    border: 2px solid var(--azul);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}
.btn-secondary:hover { background: var(--azul-light); text-decoration: none; }

/* Danger */
.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #dc2626;
    color: var(--blanco);
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.65rem 1.4rem;
    border-radius: var(--radio-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.btn-danger:hover { background: #b91c1c; color: var(--blanco); text-decoration: none; }

/* WhatsApp */
.btn-wa {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #25d366;
    color: var(--blanco);
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.65rem 1.4rem;
    border-radius: var(--radio-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s;
}
.btn-wa:hover { opacity: 0.88; color: var(--blanco); text-decoration: none; }

/* Tamaños */
.btn-sm { padding: 0.4rem 0.9rem !important; font-size: 0.8rem !important; }
.btn-lg { padding: 0.85rem 2rem !important; font-size: 1rem !important; }
.btn-block { width: 100%; justify-content: center; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

/* Azul — disponible / activo */
.badge-azul    { background: var(--azul-light);    color: var(--azul-dark); }

/* Naranja — próximamente / pendiente */
.badge-naranja { background: var(--naranja-light); color: var(--naranja-dark); }

/* Amarillo — acento puntual (usar con moderación) */
.badge-amarillo { background: var(--amarillo-light); color: #7A6000; }

/* Verde — éxito / completado */
.badge-verde   { background: #ecfdf5; color: #065f46; }

/* Rojo — error / cancelado */
.badge-rojo    { background: #fef2f2; color: #991b1b; }

/* Gris — inactivo / neutral */
.badge-gris    { background: var(--gris); color: var(--texto-suave); }

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--blanco);
    border-radius: var(--radio);
    padding: 1.25rem;
    box-shadow: var(--sombra);
    border: 1px solid var(--gris);
    margin-bottom: 1rem;
}

.card-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--azul);
    margin-bottom: 1rem;
}

/* Card con acento naranja (CTA, destacado) */
.card-cta {
    border-top: 4px solid var(--naranja);
}

/* Card con acento azul */
.card-featured {
    border: 2px solid var(--azul);
}

/* ── Stats ────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--blanco);
    border-radius: var(--radio);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--sombra);
    border: 1px solid var(--gris);
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--azul-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Amarillo solo en íconos de stat — acento puntual */
.stat-icon-amarillo {
    background: var(--amarillo-light);
    color: #7A6000;
}

.stat-val {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--azul);
    line-height: 1;
}

.stat-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--texto-suave);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* ── Tablas ───────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radio);
    border: 1px solid var(--gris);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: var(--blanco);
}

thead th {
    background: var(--gris-claro);
    color: var(--texto-suave);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.65rem 0.875rem;
    text-align: left;
    white-space: nowrap;
}

tbody td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--gris);
    color: var(--texto);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: var(--gris-claro); }

/* ── Formularios ──────────────────────────────────────────── */
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--texto);
}

.form-input,
.form-select,
.form-textarea,
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    border: 1px solid var(--gris);
    border-radius: var(--radio-sm);
    padding: 0.6rem 0.875rem;
    font-family: 'Nunito', sans-serif;
    font-size: 0.875rem;
    color: var(--texto);
    background: var(--blanco);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    appearance: auto;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--azul);
    box-shadow: 0 0 0 3px rgba(27,93,174,0.10);
}

.form-textarea,
textarea { resize: vertical; min-height: 100px; }

.form-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.field-error {
    font-size: 0.75rem;
    color: #dc2626;
    margin-top: 2px;
}

/* ── Alertas ──────────────────────────────────────────────── */
.alert {
    padding: 0.875rem 1.1rem;
    border-radius: var(--radio-sm);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-left: 4px solid #10b981;
    color: #065f46;
}

.alert-error {
    background: var(--naranja-light);
    border: 1px solid #fca5a5;
    border-left: 4px solid var(--naranja);
    color: var(--naranja-dark);
}

.alert-info {
    background: var(--azul-light);
    border: 1px solid var(--gris-medio);
    border-left: 4px solid var(--azul);
    color: var(--azul-dark);
}

/* Amarillo solo para avisos tipo "trial" — puntual */
.alert-warning {
    background: var(--amarillo-light);
    border: 1px solid var(--amarillo);
    border-left: 4px solid var(--amarillo);
    color: #7A6000;
}

/* ── Page header ──────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--azul);
}

/* ── Toggle (switch) ──────────────────────────────────────── */
.toggle-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.toggle-input { display: none; }

.toggle-track {
    width: 40px;
    height: 22px;
    background: var(--gris);
    border-radius: 20px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-input:checked + .toggle-track { background: var(--azul); }

.toggle-track::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: left 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.toggle-input:checked + .toggle-track::after { left: 21px; }

/* ── Modales ──────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.50);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.show { display: flex; }

.modal-box {
    background: var(--blanco);
    border-radius: var(--radio-lg);
    max-width: 520px;
    width: 100%;
    box-shadow: 0 24px 80px rgba(0,0,0,0.25);
    overflow: hidden;
}

.modal-header {
    background: var(--azul-grad);
    padding: 1.5rem 1.75rem;
    position: relative;
}

.modal-header h3 {
    color: white;
    font-size: 1.1rem;
    margin: 0;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body    { padding: 1.5rem 1.75rem; }
.modal-footer  { padding: 1rem 1.75rem 1.5rem; display: flex; gap: 0.75rem; justify-content: flex-end; border-top: 1px solid var(--gris); }

/* ── Utilidades ───────────────────────────────────────────── */
.text-azul    { color: var(--azul); }
.text-naranja { color: var(--naranja); }
.text-suave   { color: var(--texto-suave); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-flex   { display: flex; }
.gap-1    { gap: 0.5rem; }
.gap-2    { gap: 1rem; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }

.w-100 { width: 100%; }
.no-print { }

/* ── Print ────────────────────────────────────────────────── */
@media print {
    body { background: #fff; }
    .no-print { display: none !important; }
    .card { box-shadow: none; border-radius: 0; }
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}
