/* ==========================================================================
   LARMARIES — AERO LIQUID GLASS (CORE / BASE SYSTEM)
   Zero-Bloat Modular Architecture · Larmaries Design System
   ========================================================================== */

:root {
    /* ==== Paleta Corporativa Larmaries (con ROLES explícitos) ====
       Contrastes WCAG calculados contra #ffffff:
         purple-700 10.10:1 · purple-600 7.45:1 · purple-500 5.80:1
         magenta-600  5.20:1 · magenta-500 4.20:1
         orange-800   ~6.0:1 · orange-500  2.10:1 (NO usable como texto) */
    --brand-purple-700: #5b2d75;   /* Ancla: fondo de botón, activos, títulos */
    --brand-purple-600: #743c94;   /* Corporativo: marca y textos */
    --brand-purple-500: #8a49ab;   /* Luz superior del botón primario */
    --brand-magenta-600: #c2317f;  /* Magenta legible (AA con blanco) */
    --brand-magenta-500: #d64090;  /* Acento interactivo vivo */
    --brand-orange-500: #f89f32;   /* SOLO señal de estado (nunca texto/fondo) */
    --brand-orange-800: #8a5200;   /* Naranja legible como texto */

    /* Alias de marca (compatibilidad) */
    --brand-orange: var(--brand-orange-500);
    --brand-purple: var(--brand-purple-600);
    --brand-pink: var(--brand-magenta-500);

    /* ==== Tokens heredados: corrección sistémica de gradientes ====
       El tema anterior tenía --corp-navy y --corp-cyan en el MISMO hue (azul),
       así que todos los degradados eran monocromáticos y armónicos. Al remapear
       a púrpura + naranja el recorrido de hue pasó a 255° y ~10 degradados
       cruzaban la zona desaturada (marrón). Ahora el compañero de gradiente del
       púrpura es el magenta (45° de recorrido) y el naranja queda solo como
       señal de estado. Ver README → "Paleta y gradientes". */
    --corp-navy: #5b2d75;
    --corp-cyan: #d64090;
    --corp-magenta: #d64090;
    --corp-ice: #f6eef9;
    --corp-dark: #1e1329;
    --corp-slate: #3b3047;
    --corp-muted: #8d809a;
    --corp-bg: #fdfafc;
    --corp-surface: #f4edf7;
    --corp-border: rgba(116, 60, 148, 0.16);

    /* Interruptor único de la propuesta visual de botones (Opción A) */
    --btn-grad-top: #8a49ab;
    --btn-grad-bottom: #5b2d75;
    --btn-grad-top-hover: #9553b6;
    --btn-grad-bottom-hover: #66337f;
    --btn-fg: #ffffff;
    --btn-shadow: 0 4px 15px rgba(91, 45, 117, 0.30);
    --btn-shadow-hover: 0 6px 20px rgba(91, 45, 117, 0.40);
    --focus-ring: 0 0 0 4px rgba(214, 64, 144, 0.20);

    /* Variables de Cristal Líquido (Aero Glassmorphism) */
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-sidebar: rgba(253, 250, 252, 0.86);
    --glass-card: rgba(255, 255, 255, 0.88);
    --glass-border: rgba(255, 255, 255, 0.88);
    --glass-border-light: rgba(116, 60, 148, 0.14);
    --glass-blur: blur(28px) saturate(180%);
    --glass-blur-sm: blur(16px) saturate(160%);
    --glass-shadow: 0 8px 32px 0 rgba(116, 60, 148, 0.08);
    --glass-shadow-sm: 0 4px 16px -2px rgba(116, 60, 148, 0.05);
    --glow-accent: 0 0 20px rgba(248, 159, 50, 0.35);
    --glow-pink: 0 0 20px rgba(214, 64, 144, 0.35);
    --glow-purple: 0 0 20px rgba(116, 60, 148, 0.35);

    /* Tipografía y Espaciado */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
}

/* ==================== ICONOS MATERIAL SYMBOLS ROUNDED ====================
   Iconografía unificada (sin sprite SVG) mediante ligaduras de Google:
   https://fonts.google.com/icons?icon.style=Rounded
   Uso:  <span class="aero-icon" aria-hidden="true">refresh</span>
   Tamaño: heredado por font-size (1em) o forzado con style="font-size:Npx".
   Color: heredado por CSS currentColor. */
.material-symbols-rounded,
.material-symbols-outlined {
    font-family: 'Material Symbols Rounded' !important;
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'liga';
    user-select: none;
}

.aero-icon {
    font-family: 'Material Symbols Rounded' !important;
    font-weight: normal;
    font-style: normal;
    font-size: 1em;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'liga';
    vertical-align: -0.15em;
    color: inherit;
    flex-shrink: 0;
    user-select: none;
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    background: linear-gradient(135deg, #fdfafc 0%, #f7eff9 50%, #f0e4f5 100%);
    color: var(--corp-slate);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== UTILIDADES AERO GLASS ==================== */
.aero-glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-top: 1px solid rgba(255, 255, 255, 0.95);
    box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
}

.aero-card {
    background: var(--glass-card);
    backdrop-filter: var(--glass-blur-sm);
    -webkit-backdrop-filter: var(--glass-blur-sm);
    border: 1px solid var(--glass-border-light);
    border-top: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow-sm);
}

.aero-glow-accent {
    box-shadow: var(--glow-accent), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* ==================== CONTENEDOR PRINCIPAL & SHELL ==================== */
.app-wrapper {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 0;
    background: transparent;
    overflow: hidden;
}

.main-content-container {
    max-width: 100% !important;
    padding: 16px !important;
    margin: 0 !important;
    width: 100% !important;
    height: calc(100vh - 64px) !important;
    box-sizing: border-box !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.tab-pane {
    height: 100%;
    width: 100%;
    display: none;
    overflow: hidden;
}

.tab-pane.active {
    display: flex !important;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ==================== TOPBAR HEADER COMPACTA ==================== */
.top-bar {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(24px) saturate(170%);
    -webkit-backdrop-filter: blur(24px) saturate(170%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.85);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-shrink: 0;
    height: 64px;
    box-sizing: border-box;
    z-index: 30;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.page-title {
    color: var(--corp-navy);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

/* Hamburguesa movil: oculto en escritorio, visible y estilado solo en movil */
.mobile-toggle {
    display: none;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--glass-border-light);
    color: var(--corp-navy);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.mobile-toggle:hover {
    background: #ffffff;
    border-color: var(--corp-cyan);
}

@media (max-width: 900px) {
    .mobile-toggle {
        display: inline-flex;
    }
}

/* Topbar Stats & Badges */
.top-bar-stats {
    display: flex;
    align-items: center;
    gap: 10px;
}

.aero-waba-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(90deg, rgba(116, 60, 148, 0.12), rgba(255, 255, 255, 0.85));
    border: 1px solid rgba(116, 60, 148, 0.22);
    color: var(--corp-navy);
    padding: 5px 12px;
    border-radius: var(--radius-md);
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(116, 60, 148, 0.10);
}

.aero-pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--brand-orange-500);
    box-shadow: 0 0 8px var(--brand-orange-500);
    animation: aeroPulse 2s ease-in-out infinite;
}

.stat-pill {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border-light);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    color: var(--corp-slate);
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-pill strong {
    color: var(--corp-navy);
    font-weight: 800;
}

/* ==================== FORM CONTROLS ==================== */
.form-input,
.pipeline-select,
.aero-input {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border-light);
    border-radius: var(--radius-md);
    color: var(--corp-navy);
    font-family: inherit;
    font-size: 13px;
    padding: 8px 12px;
    transition: all 0.2s ease;
    outline: none;
    width: 100%;
}

.form-input:focus,
.pipeline-select:focus,
.aero-input:focus {
    background: rgba(255, 255, 255, 0.98);
    border-color: var(--corp-cyan);
    box-shadow: var(--focus-ring);
}

.mini-label {
    color: var(--corp-navy);
    font-weight: 700;
    font-size: 11px;
    margin-bottom: 4px;
    display: block;
}

.help-text {
    color: var(--corp-muted);
    font-size: 11px;
    margin-top: 3px;
}

/* ==================== UTILIDADES ZERO-BLOAT ==================== */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.flex-column { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-1 { flex: 1 1 0% !important; }
.align-center { align-items: center !important; }
.align-start { align-items: flex-start !important; }
.align-end { align-items: flex-end !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }
.justify-start { justify-content: flex-start !important; }

.gap-1 { gap: 4px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.gap-4 { gap: 16px !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }
.m-0 { margin: 0 !important; }
.p-0 { padding: 0 !important; }
.p-10 { padding: 10px !important; }
.p-15 { padding: 15px !important; }
.p-20 { padding: 20px !important; }
.p-25 { padding: 25px !important; }

.mt-5 { margin-top: 5px !important; }
.mt-10 { margin-top: 10px !important; }
.mt-15 { margin-top: 15px !important; }
.mt-20 { margin-top: 20px !important; }
.mt-25 { margin-top: 25px !important; }
.mb-5 { margin-bottom: 5px !important; }
.mb-10 { margin-bottom: 10px !important; }
.mb-15 { margin-bottom: 15px !important; }
.mb-20 { margin-bottom: 20px !important; }
.mb-25 { margin-bottom: 25px !important; }

.text-xs { font-size: 11px !important; }
.text-sm { font-size: 12.5px !important; }
.text-base { font-size: 14px !important; }
.text-lg { font-size: 16px !important; }
.text-xl { font-size: 18px !important; }
.fw-400 { font-weight: 400 !important; }
.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.text-muted { color: var(--corp-muted) !important; }
.text-center { text-align: center !important; }

.border-top-subtle { border-top: 1px solid var(--corp-border, #e5e5ea) !important; }
.border-bottom-subtle { border-bottom: 1px solid var(--corp-border, #e5e5ea) !important; }
.cursor-pointer { cursor: pointer !important; }

/* ==================== BOTONES ==================== */
.btn {
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    font-size: 12.5px;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
}

.btn-primary,
.btn-aero-primary {
    background: linear-gradient(180deg, var(--btn-grad-top) 0%, var(--btn-grad-bottom) 100%);
    color: var(--btn-fg);
    box-shadow: var(--btn-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-primary:hover,
.btn-aero-primary:hover {
    background: linear-gradient(180deg, var(--btn-grad-top-hover) 0%, var(--btn-grad-bottom-hover) 100%);
    transform: translateY(-1px);
    box-shadow: var(--btn-shadow-hover), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--glass-border-light);
    color: var(--corp-navy);
}

.btn-secondary:hover {
    background: #ffffff;
    border-color: var(--corp-cyan);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(180deg, #ff6b6b, #c0392b);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-danger:hover {
    transform: translateY(-1px);
}

.btn-sm {
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    padding: 5px 12px;
}

/* ==================== BADGES & ALERTAS ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-blue { background: rgba(214, 64, 144, 0.12); color: var(--brand-magenta-600); border: 1px solid rgba(214, 64, 144, 0.32); }
.badge-green { background: rgba(52, 199, 89, 0.15); color: #1e7e34; border: 1px solid rgba(52, 199, 89, 0.4); }
.badge-red { background: rgba(220, 38, 38, 0.15); color: #c0392b; border: 1px solid rgba(220, 38, 38, 0.4); }
.badge-orange { background: rgba(255, 149, 0, 0.15); color: #b76400; border: 1px solid rgba(255, 149, 0, 0.4); }

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: rgba(52, 199, 89, 0.15); border: 1px solid rgba(52, 199, 89, 0.4); color: #1e7e34; }
.alert-error { background: rgba(220, 38, 38, 0.15); border: 1px solid rgba(220, 38, 38, 0.4); color: #c0392b; }
.alert-info { background: rgba(214, 64, 144, 0.10); border: 1px solid rgba(214, 64, 144, 0.30); color: var(--brand-magenta-600); }
/* Section Cards & Titles */
.section-card {
    background: var(--glass-card) !important;
    backdrop-filter: var(--glass-blur-sm);
    -webkit-backdrop-filter: var(--glass-blur-sm);
    border: 1px solid var(--glass-border-light) !important;
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--corp-navy);
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(116, 60, 148, 0.6);
    padding-bottom: 12px;
}

.help-text {
    font-size: 12px;
    color: var(--corp-muted);
}

.mini-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--corp-slate);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
    display: block;
}

/* Grids */
.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-card {
    background: var(--glass-card) !important;
    backdrop-filter: var(--glass-blur-sm);
    -webkit-backdrop-filter: var(--glass-blur-sm);
    border: 1px solid var(--glass-border-light) !important;
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow-sm);
    padding: 22px;
    margin-bottom: 20px;
}

/* ==================== STATUS & STATS GRIDS (Aero Liquid Glass) ==================== */
.status-grid, .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.status-card, .stat-card {
    background: var(--glass-card);
    backdrop-filter: var(--glass-blur-sm);
    -webkit-backdrop-filter: var(--glass-blur-sm);
    border: 1px solid var(--glass-border-light);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--glass-shadow-sm);
    transition: all 0.2s ease;
}

.status-card:hover, .stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--corp-cyan);
    box-shadow: 0 8px 24px rgba(214, 64, 144, 0.15);
}

.status-card .status-icon {
    font-size: 26px;
    margin-bottom: 8px;
}

.status-card .status-name, .stat-card h3 {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--corp-muted);
    margin-bottom: 4px;
}

.status-card .status-value, .stat-card .value {
    font-size: 18px;
    font-weight: 800;
    color: var(--corp-navy);
}

.lead-pill {
    background: rgba(116, 60, 148, 0.6);
    color: var(--corp-navy);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 11.5px;
    border: 1px solid rgba(214, 64, 144, 0.3);
}

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

.table-aero, .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.table-aero th, .data-table th {
    background: rgba(116, 60, 148, 0.4);
    color: var(--corp-navy);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.05em;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border-light);
}

.table-aero td, .data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(116, 60, 148, 0.5);
    color: var(--corp-slate);
    vertical-align: middle;
}

.table-aero tr:hover td, .data-table tr:hover td {
    background: rgba(255, 255, 255, 0.7);
}

/* ==================== MODALES AERO GLASS ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(12, 30, 43, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active, .modal.show {
    display: flex !important;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 50px rgba(116, 60, 148, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    width: 100%;
    max-width: 600px;
    max-height: 88vh;
    overflow-y: auto;
    padding: 26px;
    margin: auto;
    animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--corp-navy);
    margin-bottom: 6px;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.94) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ==================== ANIMACIONES & SCROLLBARS ==================== */
@keyframes aeroPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(1.2); }
}

.custom-scrollbar::-webkit-scrollbar,
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.custom-scrollbar::-webkit-scrollbar-track,
::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb,
::-webkit-scrollbar-thumb {
    background: rgba(116, 60, 148, 0.18);
    border-radius: var(--radius-full);
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:hover {
    background: rgba(214, 64, 144, 0.5);
}
