/* ============================================================
   FIDELIZAPY - SISTEMA DE DISEÑO
   Motivo visual: "tarjeta de sello" (stamp card) de fidelización
   ============================================================ */

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

/* ---------- TOKENS DE DISEÑO ---------- */
/* Paleta derivada del logo: navy/negro + azul + verde */
:root {
    /* Paleta - Modo claro */
    --fp-bg: #F4F8FB;
    --fp-bg-soft: #E9F1F8;
    --fp-surface: #FFFFFF;
    --fp-border: #DCE6F0;
    --fp-text: #05070F;
    --fp-text-muted: #5B6472;

    --fp-primary: #05070F;      /* navy / negro del logo */
    --fp-secondary: #0091FA;    /* azul del logo */
    --fp-accent: #5FD13A;       /* verde del logo */
    --fp-accent-dark: #379420;
    --fp-success: #22C55E;
    --fp-danger: #E5484D;
    --fp-warning: #F2994A;

    --fp-radius-sm: 8px;
    --fp-radius-md: 14px;
    --fp-radius-lg: 22px;
    --fp-radius-pill: 999px;

    --fp-shadow-sm: 0 2px 8px rgba(5, 7, 15, 0.06);
    --fp-shadow-md: 0 8px 24px rgba(5, 7, 15, 0.10);
    --fp-shadow-lg: 0 16px 40px rgba(5, 7, 15, 0.14);

    --fp-font-display: 'Sora', sans-serif;
    --fp-font-body: 'Inter', sans-serif;

    --fp-sidebar-w: 264px;
    --fp-navbar-h: 72px;

    --fp-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Paleta - Modo oscuro */
[data-theme="dark"] {
    --fp-bg: #05070F;
    --fp-bg-soft: #0B0F1A;
    --fp-surface: #10141F;
    --fp-border: #232A3A;
    --fp-text: #F2F5FA;
    --fp-text-muted: #8B93A5;

    --fp-primary: #00C1FC;
    --fp-secondary: #0091FA;
    --fp-accent: #5FD13A;
    --fp-accent-dark: #8CE85C;
    --fp-success: #34D399;

    --fp-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --fp-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --fp-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: var(--fp-font-body);
    background: var(--fp-bg);
    color: var(--fp-text);
    transition: background var(--fp-transition), color var(--fp-transition);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--fp-font-display);
    font-weight: 700;
    color: var(--fp-text);
    margin: 0;
}

a { text-decoration: none; color: inherit; }
button { font-family: var(--fp-font-body); }

::selection { background: var(--fp-accent); color: var(--fp-primary); }

:focus-visible {
    outline: 2px solid var(--fp-accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

/* ---------- ELEMENTO DE FIRMA: ANILLOS DE SELLO ---------- */
.fp-stamp-rings {
    position: relative;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.fp-stamp-rings::before,
.fp-stamp-rings::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 2px dashed rgba(0, 193, 252, 0.35);
}
.fp-stamp-rings::before { width: 340px; height: 340px; top: -80px; right: -100px; }
.fp-stamp-rings::after { width: 220px; height: 220px; bottom: -60px; right: 40px; border-color: rgba(95, 209, 58, 0.3); }

.fp-logo-mark {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #05070F;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 0 0 3px rgba(0, 145, 250, 0.18);
    flex-shrink: 0;
}
.fp-logo-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------- LOGIN ---------- */
.fp-login-wrap {
    min-height: 100vh;
    display: flex;
    background: var(--fp-primary);
}
.fp-login-side {
    display: none;
    flex: 1.1;
    position: relative;
    background: linear-gradient(160deg, #05070F 0%, #0A2A47 55%, #114A2B 100%);
    color: #F2F5FA;
    padding: 30px 40px;
    overflow: hidden;
}
.fp-login-side-content { position: relative; z-index: 2; max-width: 420px; }
.fp-login-side .fp-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fp-accent);
    font-weight: 600;
    margin-bottom: 12px;
}
.fp-login-side h1 {
    color: #fff;
    font-size: 1.75rem;
    line-height: 1.15;
    margin-bottom: 8px;
}
.fp-login-side p { color: #A9C4DC; font-size: 0.88rem; line-height: 1.42; }
.fp-punch-row { display: flex; gap: 10px; margin-top: 40px; }
.fp-punch {
    width: 34px; height: 34px; border-radius: 50%;
    border: 2px dashed rgba(0,193,252,0.5);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: var(--fp-accent);
}
.fp-punch.filled { background: var(--fp-accent); border-style: solid; color: var(--fp-primary); }

.fp-feature-list { display: flex; flex-direction: column; gap: 5px; margin-top: 12px; }
.fp-feature-item {
    display: flex; align-items: center; gap: 9px;
    font-size: 0.78rem; color: #DCE7F0; font-weight: 500;
}
.fp-feature-ic {
    width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(0,145,250,0.22), rgba(95,209,58,0.22));
    color: var(--fp-accent);
    border: 1px solid rgba(0,193,252,0.25);
}
.fp-feature-ic i { font-size: 0.74rem; }

.fp-login-form-side {
    flex: 1;
    background: var(--fp-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
}
.fp-login-card {
    width: 100%;
    max-width: 380px;
}
.fp-login-card .fp-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
}
.fp-login-card .fp-brand span {
    font-family: var(--fp-font-display);
    font-weight: 800;
    font-size: 1.3rem;
}
.fp-login-card h2 { font-size: 1.6rem; margin-bottom: 6px; }
.fp-login-card .fp-sub { color: var(--fp-text-muted); margin-bottom: 28px; font-size: 0.95rem; }

.fp-field { margin-bottom: 18px; }
.fp-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--fp-text-muted);
    margin-bottom: 6px;
}
.fp-input-group { position: relative; }
.fp-input-group i {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--fp-text-muted);
}
.fp-input-group input {
    width: 100%;
    padding: 13px 14px 13px 42px;
    border-radius: var(--fp-radius-md);
    border: 1.5px solid var(--fp-border);
    background: var(--fp-surface);
    color: var(--fp-text);
    font-size: 0.95rem;
    transition: border-color var(--fp-transition), box-shadow var(--fp-transition);
}
.fp-input-group input:focus {
    outline: none;
    border-color: var(--fp-secondary);
    box-shadow: 0 0 0 4px rgba(45, 27, 94, 0.12);
}

/* ---------- DESPLEGABLE DE SUGERENCIAS (buscadores de cliente) ---------- */
.fp-autocomplete-list {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--fp-surface);
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius-md);
    box-shadow: var(--fp-shadow-md);
    max-height: 280px;
    overflow-y: auto;
    z-index: 50;
    padding: 6px;
}
.fp-autocomplete-list.show { display: block; }
.fp-autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--fp-radius-sm);
    cursor: pointer;
    font-size: 0.88rem;
}
.fp-autocomplete-item:hover,
.fp-autocomplete-item.activo {
    background: var(--fp-bg-soft);
}
.fp-autocomplete-item .fp-ac-nombre { font-weight: 600; }
.fp-autocomplete-item .fp-ac-detalle { color: var(--fp-text-muted); font-size: 0.78rem; }
.fp-autocomplete-empty {
    padding: 14px 12px;
    color: var(--fp-text-muted);
    font-size: 0.85rem;
    text-align: center;
}
.fp-toggle-pass {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--fp-text-muted); cursor: pointer;
}

.fp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: var(--fp-radius-md);
    padding: 13px 22px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform var(--fp-transition), box-shadow var(--fp-transition), background var(--fp-transition);
}
.fp-btn:active { transform: scale(0.98); }
.fp-btn-primary {
    background: var(--fp-primary);
    color: #fff;
    width: 100%;
    box-shadow: var(--fp-shadow-sm);
}
[data-theme="dark"] .fp-btn-primary { background: var(--fp-secondary); color: #fff; }
.fp-btn-primary:hover { box-shadow: var(--fp-shadow-md); }
.fp-btn-accent { background: var(--fp-accent); color: var(--fp-primary); }
.fp-btn-accent:hover { background: var(--fp-accent-dark); }
.fp-btn-outline {
    background: transparent;
    border: 1.5px solid var(--fp-border);
    color: var(--fp-text);
}
.fp-btn-outline:hover { border-color: var(--fp-secondary); }
.fp-btn-danger { background: var(--fp-danger); color: #fff; }
.fp-btn-sm { padding: 8px 14px; font-size: 0.85rem; }

.fp-login-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    font-size: 0.85rem;
}
.fp-login-links a { color: var(--fp-secondary); font-weight: 600; }
.fp-login-links a:hover { text-decoration: underline; }

.fp-error-msg {
    display: none;
    background: rgba(229, 72, 77, 0.1);
    color: var(--fp-danger);
    border: 1px solid rgba(229, 72, 77, 0.3);
    padding: 10px 14px;
    border-radius: var(--fp-radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

@media (min-width: 992px) {
    .fp-login-side { display: flex; }
}

/* ---------- APP SHELL (sidebar + navbar) ---------- */
.fp-shell { display: flex; min-height: 100vh; }

.fp-sidebar {
    width: var(--fp-sidebar-w);
    background: #05070F;
    color: #C7D2DE;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform var(--fp-transition);
}
.fp-sidebar.open { transform: translateX(0); }

[data-theme="dark"] .fp-sidebar { background: #030509; }

.fp-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.fp-sidebar-brand span { font-family: var(--fp-font-display); font-weight: 800; color: #fff; font-size: 1.15rem; }

.fp-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
}
.fp-nav-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #4B5A70;
    padding: 14px 10px 6px;
    font-weight: 700;
}
.fp-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--fp-radius-sm);
    color: #A7B6C6;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background var(--fp-transition), color var(--fp-transition);
    cursor: pointer;
}
.fp-nav-item i { font-size: 1.05rem; width: 20px; text-align: center; }
.fp-nav-badge{
    margin-left:auto;background:var(--fp-danger);color:#fff;
    font-size:0.68rem;font-weight:700;min-width:18px;height:18px;
    border-radius:999px;display:flex;align-items:center;justify-content:center;padding:0 5px;
}
.fp-nav-item:hover { background: rgba(0, 145, 250, 0.1); color: #fff; }
.fp-nav-item.active {
    background: linear-gradient(120deg, var(--fp-secondary), var(--fp-accent));
    color: #05070F;
    font-weight: 700;
}

.fp-sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 0.78rem;
    color: #4B5A70;
}

.fp-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 6, 24, 0.55);
    z-index: 999;
}
.fp-overlay.show { display: block; }

.fp-main {
    flex: 1;
    margin-left: 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.fp-navbar {
    height: var(--fp-navbar-h);
    background: var(--fp-surface);
    border-bottom: 1px solid var(--fp-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    position: sticky;
    top: 0;
    z-index: 900;
}
.fp-navbar-left { display: flex; align-items: center; gap: 14px; }
.fp-burger {
    background: none; border: none; font-size: 1.3rem; color: var(--fp-text); cursor: pointer;
    width: 38px; height: 38px; border-radius: var(--fp-radius-sm); display: flex; align-items: center; justify-content: center;
}
.fp-burger:hover { background: var(--fp-bg-soft); }
.fp-page-title { font-size: 1.15rem; }
.fp-navbar-right { display: flex; align-items: center; gap: 10px; }

.fp-icon-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1px solid var(--fp-border);
    background: var(--fp-surface);
    display: flex; align-items: center; justify-content: center;
    color: var(--fp-text);
    cursor: pointer;
    transition: background var(--fp-transition);
    position: relative;
}
.fp-icon-btn:hover { background: var(--fp-bg-soft); }

.fp-user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: var(--fp-radius-pill);
    background: var(--fp-bg-soft);
    cursor: pointer;
}
.fp-user-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--fp-secondary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700;
}
.fp-user-chip .fp-user-name { font-size: 0.85rem; font-weight: 600; }
.fp-user-chip .fp-user-role { font-size: 0.72rem; color: var(--fp-text-muted); display: block; }

.fp-content { padding: 22px; flex: 1; }

@media (min-width: 992px) {
    .fp-sidebar { transform: translateX(0); position: fixed; }
    .fp-main { margin-left: var(--fp-sidebar-w); }
    .fp-burger { display: none; }
}

/* ---------- CARDS / KPIs ---------- */
.fp-card {
    background: var(--fp-surface);
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius-lg);
    box-shadow: var(--fp-shadow-sm);
}
.fp-kpi {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
}
.fp-kpi-icon {
    width: 42px; height: 42px; border-radius: var(--fp-radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
}
.fp-kpi-value { font-family: var(--fp-font-display); font-size: 1.7rem; font-weight: 800; }
.fp-kpi-label { color: var(--fp-text-muted); font-size: 0.85rem; }
.fp-kpi-trend { font-size: 0.78rem; font-weight: 600; }
.fp-kpi-trend.up { color: var(--fp-success); }
.fp-kpi-trend.down { color: var(--fp-danger); }

.fp-bg-violet { background: rgba(0,145,250,0.1); color: var(--fp-secondary); }
.fp-bg-gold { background: rgba(95,209,58,0.15); color: var(--fp-accent-dark); }
.fp-bg-teal { background: rgba(34,197,94,0.12); color: var(--fp-success); }
.fp-bg-rose { background: rgba(229,72,77,0.1); color: var(--fp-danger); }

.fp-section-title {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.fp-section-title h3 { font-size: 1.05rem; }

/* ---------- TABLA ---------- */
.fp-table-wrap { overflow-x: auto; }
.fp-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.fp-table th {
    text-align: left;
    padding: 12px 14px;
    color: var(--fp-text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--fp-border);
    white-space: nowrap;
}
.fp-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--fp-border);
    vertical-align: middle;
}
.fp-table tr:last-child td { border-bottom: none; }
.fp-table tr:hover td { background: var(--fp-bg-soft); }

.fp-avatar-sm {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--fp-bg-soft); color: var(--fp-secondary);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; overflow: hidden;
}
.fp-avatar-sm img { width: 100%; height: 100%; object-fit: cover; }

.fp-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px;
    border-radius: var(--fp-radius-pill);
    font-size: 0.72rem;
    font-weight: 700;
}
.fp-badge-bronce { background: rgba(180,120,60,0.15); color: #B4783C; }
.fp-badge-plata { background: rgba(140,140,160,0.18); color: #6E6E85; }
.fp-badge-oro { background: rgba(212,160,23,0.18); color: #B8860B; }
.fp-badge-platino { background: rgba(0,145,250,0.15); color: var(--fp-secondary); }
.fp-badge-activo { background: rgba(0,194,168,0.15); color: var(--fp-success); }
.fp-badge-inactivo { background: rgba(229,72,77,0.1); color: var(--fp-danger); }

/* ---------- FORMULARIOS ---------- */
.fp-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.fp-form-group label {
    display: block; font-size: 0.82rem; font-weight: 600; color: var(--fp-text-muted); margin-bottom: 6px;
}
.fp-form-group input, .fp-form-group select, .fp-form-group textarea {
    width: 100%;
    padding: 11px 13px;
    border-radius: var(--fp-radius-sm);
    border: 1.5px solid var(--fp-border);
    background: var(--fp-surface);
    color: var(--fp-text);
    font-size: 0.9rem;
    font-family: var(--fp-font-body);
}
.fp-form-group input:focus, .fp-form-group select:focus, .fp-form-group textarea:focus {
    outline: none; border-color: var(--fp-secondary);
}

/* ---------- MODAL ---------- */
.fp-modal-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(10,6,24,0.5);
    z-index: 1200;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.fp-modal-backdrop.show { display: flex; }
.fp-modal {
    background: var(--fp-surface);
    border-radius: var(--fp-radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--fp-shadow-lg);
    animation: fp-modal-in 220ms ease;
}
@keyframes fp-modal-in {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.fp-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--fp-border);
}
.fp-modal-body { padding: 22px; }
.fp-modal-footer {
    display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
    padding: 16px 22px; border-top: 1px solid var(--fp-border);
}
.fp-modal-close { background: none; border: none; font-size: 1.2rem; color: var(--fp-text-muted); cursor: pointer; }

/* ---------- TOAST ---------- */
.fp-toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 1400; display: flex; flex-direction: column; gap: 10px; }
.fp-toast {
    background: var(--fp-surface);
    border-left: 4px solid var(--fp-success);
    border-radius: var(--fp-radius-sm);
    box-shadow: var(--fp-shadow-md);
    padding: 13px 18px;
    font-size: 0.88rem;
    display: flex; align-items: center; gap: 10px;
    animation: fp-toast-in 220ms ease;
    min-width: 240px;
}
.fp-toast.error { border-color: var(--fp-danger); }
@keyframes fp-toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ---------- TARJETA DIGITAL DE CLIENTE ---------- */
.fp-digital-card {
    width: 100%;
    max-width: 340px;
    border-radius: 20px;
    padding: 24px;
    color: #fff;
    background: linear-gradient(135deg, var(--fp-dc-c1, #05070F) 0%, var(--fp-dc-c2, #0A3B66) 55%, var(--fp-dc-c3, #1B7A42) 100%);
    position: relative;
    overflow: hidden;
    box-shadow: var(--fp-shadow-lg);
    align-self: flex-start; /* evita que el flex del modal la estire y le recorte el contenido */
    flex-shrink: 0;
}
.fp-digital-card .fp-dc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; position: relative; z-index: 2; }
.fp-digital-card .fp-dc-name { font-family: var(--fp-font-display); font-size: 1.2rem; margin-bottom: 2px; }
.fp-digital-card .fp-dc-level { font-size: 0.75rem; color: var(--fp-accent); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.fp-digital-card .fp-dc-points { font-size: 2.1rem; font-weight: 800; font-family: var(--fp-font-display); position: relative; z-index: 2; }
.fp-digital-card .fp-dc-qr { background: #fff; padding: 10px; border-radius: 12px; margin-top: 18px; display: inline-block; position: relative; z-index: 2; }

/* ---------- EMPTY STATE ---------- */
.fp-empty { text-align: center; padding: 50px 20px; color: var(--fp-text-muted); }
.fp-empty i { font-size: 2.4rem; color: var(--fp-border); margin-bottom: 12px; display: block; }

/* ---------- UTILIDADES ---------- */
.fp-flex-between { display: flex; align-items: center; justify-content: space-between; }
.fp-gap-2 { display: flex; gap: 8px; }
.fp-text-muted { color: var(--fp-text-muted); }
.fp-mt-3 { margin-top: 20px; }

@keyframes fp-fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.fp-animate { animation: fp-fade-up 320ms ease both; }
