/* =====================================================================
   EDS PRO - Hoja de estilos principal
   Paleta: Azul marino (#0B2545) + Naranja (#FF7A00)
   Enfoque: mobile-first, botones y texto grandes, fácil de usar en
   celular/tableta dentro de la estación de servicio.
   ===================================================================== */

:root {
    --azul: #0B2545;
    --azul-claro: #13385f;
    --azul-mas-claro: #1b4a7a;
    --naranja: #FF7A00;
    --naranja-oscuro: #e56900;
    --verde: #16a34a;
    --rojo: #dc2626;
    --gris-50: #f8f9fb;
    --gris-100: #f2f4f7;
    --gris-200: #e5e7eb;
    --gris-400: #9ca3af;
    --gris-600: #6b7280;
    --gris-800: #1f2937;
    --blanco: #ffffff;
    --radio: 14px;
    --radio-sm: 8px;
    --sombra: 0 2px 14px rgba(11, 37, 69, 0.08);
    --sombra-lg: 0 8px 30px rgba(11, 37, 69, 0.14);
    --font: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    background: var(--gris-100);
    color: var(--gris-800);
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body { padding-bottom: env(safe-area-inset-bottom); }

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

h1, h2, h3, h4 { color: var(--azul); margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { line-height: 1.55; }

.container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 16px;
}

.container-sm {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ---------- Topbar / marca ---------- */
.topbar {
    background: var(--azul);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--sombra);
}
.topbar img.logo { height: 36px; display: block; }
.topbar .topbar-title { font-weight: 700; font-size: 1.05rem; }
.topbar .topbar-right { display: flex; align-items: center; gap: 10px; font-size: .85rem; }
.topbar .btn-icon {
    background: rgba(255,255,255,.12);
    border: none;
    color: #fff;
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
}

/* ---------- Tarjetas / paneles ---------- */
.card {
    background: var(--blanco);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    padding: 20px;
    margin-bottom: 16px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--azul) 0%, var(--azul-claro) 55%, #0a1f38 100%);
    padding: 24px 16px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 18px;
    box-shadow: var(--sombra-lg);
    padding: 32px 26px;
}
.auth-logo { text-align: center; margin-bottom: 20px; }
.auth-logo img { height: 56px; }

/* ---------- Formularios ---------- */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: var(--azul); }
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=tel], input[type=date], input[type=search], select, textarea {
    width: 100%;
    padding: 14px 15px;
    font-size: 1rem;
    border: 2px solid var(--gris-200);
    border-radius: var(--radio-sm);
    background: var(--blanco);
    font-family: var(--font);
    transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--naranja);
}
textarea { resize: vertical; min-height: 90px; }
small.help { color: var(--gris-600); font-size: .8rem; display: block; margin-top: 4px; }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 22px;
    font-size: 1.02rem;
    font-weight: 700;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
    transition: transform .08s ease, box-shadow .15s ease, opacity .15s;
    min-height: 52px;
}
.btn:active { transform: scale(.98); }
.btn-block { width: 100%; }
.btn-primary { background: var(--naranja); color: #fff; box-shadow: 0 4px 14px rgba(255,122,0,.35); }
.btn-primary:hover { background: var(--naranja-oscuro); }
.btn-azul { background: var(--azul); color: #fff; box-shadow: 0 4px 14px rgba(11,37,69,.25); }
.btn-azul:hover { background: var(--azul-claro); }
.btn-outline { background: transparent; color: var(--azul); border: 2px solid var(--azul); }
.btn-outline-naranja { background: transparent; color: var(--naranja-oscuro); border: 2px solid var(--naranja); }
.btn-verde { background: var(--verde); color: #fff; }
.btn-rojo { background: var(--rojo); color: #fff; }
.btn-sm { padding: 9px 14px; font-size: .85rem; min-height: 38px; border-radius: 9px; }
.btn-lg { padding: 20px 26px; font-size: 1.2rem; min-height: 64px; border-radius: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-wa { background: #25D366; color: #fff; }

/* Grid de botones grandes (menú principal EDS - uso en celular) */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}
@media (min-width: 640px) {
    .menu-grid { grid-template-columns: repeat(3, 1fr); }
}
.menu-btn {
    background: var(--blanco);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    padding: 22px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    color: var(--azul);
    font-weight: 700;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    min-height: 120px;
    transition: transform .1s;
}
.menu-btn:active { transform: scale(.97); }
.menu-btn .icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    background: var(--azul);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
}
.menu-btn.naranja .icon { background: var(--naranja); }
.menu-btn .badge-count {
    background: var(--naranja);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    border-radius: 20px;
    padding: 2px 9px;
}

/* ---------- Layout con sidebar (escritorio) / bottom-nav (móvil) ---------- */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px;
    background: var(--azul);
    color: #fff;
    flex-shrink: 0;
    display: none;
    flex-direction: column;
    padding: 20px 0;
}
.sidebar .brand { padding: 0 20px 20px; }
.sidebar .brand img { height: 38px; }
.sidebar nav a {
    display: flex; align-items: center; gap: 12px;
    color: #cdd9e8; padding: 13px 22px; font-weight: 600; font-size: .95rem;
}
.sidebar nav a.active, .sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; border-right: 3px solid var(--naranja); }
.main-content { flex: 1; min-width: 0; padding-bottom: 90px; }

@media (min-width: 900px) {
    .sidebar { display: flex; }
    .main-content { padding-bottom: 24px; }
    .bottom-nav { display: none !important; }
}

.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #fff;
    display: flex;
    justify-content: space-around;
    box-shadow: 0 -2px 14px rgba(0,0,0,.08);
    padding: 6px 4px env(safe-area-inset-bottom);
    z-index: 60;
}
.bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--gris-600); font-size: .68rem; font-weight: 600;
    padding: 6px 8px; flex: 1;
}
.bottom-nav a .ico { font-size: 1.3rem; }
.bottom-nav a.active { color: var(--naranja-oscuro); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radio); box-shadow: var(--sombra); }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { padding: 12px 14px; text-align: left; font-size: .9rem; border-bottom: 1px solid var(--gris-100); }
th { background: var(--gris-50); color: var(--azul); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: none; }

/* ---------- Badges / estados ---------- */
.badge { display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: .75rem; font-weight: 700; }
.badge-verde { background: #dcfce7; color: #15803d; }
.badge-naranja { background: #ffedd5; color: #c2410c; }
.badge-rojo { background: #fee2e2; color: #b91c1c; }
.badge-azul { background: #dbeafe; color: #1e40af; }
.badge-gris { background: var(--gris-200); color: var(--gris-600); }

/* ---------- Stats / KPIs ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(4,1fr); } }
.stat-box {
    background: #fff; border-radius: var(--radio); padding: 18px; box-shadow: var(--sombra);
    border-left: 5px solid var(--naranja);
}
.stat-box .stat-label { color: var(--gris-600); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat-box .stat-value { font-size: 1.7rem; font-weight: 800; color: var(--azul); margin-top: 4px; }

/* ---------- Alertas / flash ---------- */
.alert { padding: 13px 16px; border-radius: var(--radio-sm); margin-bottom: 14px; font-size: .92rem; font-weight: 500; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.alert-info { background: #eff6ff; color: #1e40af; }

/* ---------- Licencia banner ---------- */
.licencia-banner {
    padding: 12px 16px; border-radius: var(--radio-sm); margin-bottom: 16px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
    font-weight: 600; font-size: .9rem;
}
.licencia-banner.ok { background: #ecfdf5; color: #047857; }
.licencia-banner.aviso { background: #fff7ed; color: #9a3412; }
.licencia-banner.urgente { background: #fef2f2; color: #b91c1c; }

/* ---------- Página pública / QR cliente ---------- */
.public-hero {
    background: linear-gradient(160deg, var(--azul), #0a1f38);
    color: #fff;
    text-align: center;
    padding: 40px 20px 60px;
    border-radius: 0 0 28px 28px;
}
.public-hero img.logo { height: 60px; margin-bottom: 14px; }
.public-actions { margin-top: -36px; padding: 0 16px; }
.points-result {
    text-align: center;
    background: linear-gradient(145deg, var(--naranja), var(--naranja-oscuro));
    color: #fff;
    border-radius: var(--radio);
    padding: 30px 20px;
    box-shadow: var(--sombra-lg);
}
.points-result .numero { font-size: 3rem; font-weight: 900; line-height: 1; }
.points-result .etiqueta { font-size: .95rem; opacity: .9; margin-top: 6px; }

/* ---------- Utilidades ---------- */
.text-center { text-align: center; }
.text-muted { color: var(--gris-600); }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 8px; } .mb-1 { margin-bottom: 8px; }
.mt-2 { margin-top: 16px; } .mb-2 { margin-bottom: 16px; }
.mt-3 { margin-top: 24px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.loading-spinner {
    width: 20px; height: 20px; border: 3px solid rgba(255,255,255,.4);
    border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer.app-footer { text-align: center; color: var(--gris-400); font-size: .78rem; padding: 20px 16px 90px; }
@media (min-width: 900px) { footer.app-footer { padding-bottom: 20px; } }
