/* ── PuntoNexo — Portal de fidelización y catálogo público ── */

:root {
    --primary:     #12715b;
    --primary-dk:  #0f5a48;
    --accent:      #1dc48c;
    --success:     #16a34a;
    --gold:        #b45309;
    --silver:      #64748b;
    --bronze:      #92400e;
    --danger:      #dc2626;
    --bg:          #f0f4ff;
    --card-bg:     #ffffff;
    --text:        #111827;
    --muted:       #6b7280;
    --text-muted:  #6b7280;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.portal-shell { min-height: 100vh; display: flex; flex-direction: column; }

.navbar {
    background: var(--primary);
    color: white;
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    position: relative;
    flex-wrap: wrap;
}
.navbar .brand { font-size: 1.2rem; font-weight: 700; }
.navbar a { color: rgba(255,255,255,.8); text-decoration: none; font-size: .9rem; }
.navbar a:hover { color: white; }
.nav-links { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.nav-links a { padding: .55rem .85rem; min-height: 44px; display: inline-flex; align-items: center; border-radius: 6px; transition: background .2s; }
.nav-links a:hover { background: rgba(255,255,255,.15); color: white; }
.nav-links a.nav-active { background: rgba(255,255,255,.25); color: white; font-weight: 600; }
.nav-toggle {
    display: none;
    background: rgba(255,255,255,.15);
    border: none;
    color: white;
    font-size: 1.35rem;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.hosted-banner { background:#eff6ff;border-bottom:1px solid #bfdbfe;padding:0.6rem 1rem;font-size:0.9rem;color:#1e40af;text-align:center; }
.hosted-banner-short { display: none; }
@media(max-width:768px) {
    .portal-content { padding: 1.25rem 1rem; }
    .hosted-banner-long { display: none; }
    .hosted-banner-short { display: inline; }
}
@media(max-width:560px) {
    .nav-toggle { display: inline-flex; }
    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        background: var(--primary-dk);
        border-radius: 8px;
        padding: .5rem;
        margin-top: .25rem;
    }
    .nav-links.open { display: flex; }
    .nav-links a { width: 100%; }
    .portal-content { padding: 1rem .85rem; }
}

.portal-content { flex: 1; padding: 2rem 1.5rem; max-width: 860px; margin: 0 auto; width: 100%; }

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 6px rgba(0,0,0,.08);
}

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi { background: var(--card-bg); border-radius: 12px; padding: 1.25rem 1.5rem; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.kpi-label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .25rem; }
.kpi-val { font-size: 2rem; font-weight: 800; }
.kpi-sub { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.kpi-points .kpi-val { color: var(--primary); }
.kpi-tier-Oro .kpi-val    { color: var(--gold); }
.kpi-tier-Plata .kpi-val  { color: var(--silver); }
.kpi-tier-Bronce .kpi-val { color: var(--bronze); }
.kpi-tier-Base .kpi-val   { color: var(--muted); }

.progress-bar-wrap { background: #e2e8f0; border-radius: 99px; height: 12px; margin: .5rem 0 .25rem; }
.progress-bar-fill { background: var(--accent); border-radius: 99px; height: 12px; transition: width .4s ease; }

.mov-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mov-table th { text-align: left; padding: .5rem .75rem; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid #e2e8f0; }
.mov-table td { padding: .6rem .75rem; border-bottom: 1px solid #f1f5f9; }
.mov-table tr:last-child td { border-bottom: none; }
.pts-pos { color: var(--accent); font-weight: 700; }
.pts-neg { color: var(--danger); font-weight: 700; }
.badge-type { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .72rem; font-weight: 600; }
.badge-Accrual          { background: #dcfce7; color: #15803d; }
.badge-BonusHighTicket  { background: #fef9c3; color: #92400e; }
.badge-Redemption       { background: #fee2e2; color: #b91c1c; }
.badge-ManualAdjustment { background: #e0e7ff; color: #4338ca; }
.badge-Expiry           { background: #f1f5f9; color: #64748b; }

.login-box { max-width: 420px; margin: 3rem auto; background: var(--card-bg); border-radius: 16px; padding: 2rem; box-shadow: 0 4px 24px rgba(0,0,0,.1); border: 1px solid #e2e8f0; }
.login-box h2 { margin: 0 0 .25rem; font-size: 1.5rem; font-family: Archivo, 'Segoe UI', sans-serif; }
.login-box p  { color: var(--muted); font-size: .9rem; margin: 0 0 1rem; }
.login-box .form-group input.phone-suffix { font-size: 1.25rem; letter-spacing: 0.2em; text-align: center; }
.login-box .btn-primary { width: 100%; }
.login-box .login-footer { margin-top: 1rem; font-size: .85rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .4rem; }
.form-group input { width: 100%; padding: .65rem .9rem; border: 1px solid #d1d5db; border-radius: 8px; font-size: 1rem; outline: none; transition: border-color .2s; }
.form-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(18,113,91,.2); }
.btn-primary { width: 100%; padding: .75rem; background: var(--primary); color: white; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background .2s; }
.btn-primary:hover { background: var(--primary-dk); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.alert-error { background: #fee2e2; color: #991b1b; border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1rem; font-size: .9rem; }
.alert-info  { background: #dbeafe; color: #1e40af; border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1rem; font-size: .9rem; }

.client-card { background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%); color: white; border-radius: 16px; padding: 1.5rem 2rem; margin-bottom: 1.5rem; }
.client-card .name { font-size: 1.4rem; font-weight: 700; margin: 0 0 .2rem; }
.client-card .sub  { font-size: .85rem; opacity: .75; margin: 0 0 1rem; }
.client-card .barcode-label { font-family: monospace; font-size: 1rem; background: rgba(255,255,255,.15); padding: .3rem .8rem; border-radius: 6px; display: inline-block; letter-spacing: .1em; }

#blazor-error-ui { display: none; }

/* ── Sección de Ofertas ─────────────────────────────────────────────── */
.section-header { margin-bottom: 1.5rem; }
.section-header h2 { margin: 0 0 .25rem; font-size: 1.4rem; }
.section-sub { color: var(--muted); font-size: .9rem; margin: 0; }
.portal-home-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.btn-portal-primary, .btn-portal-secondary, .btn-portal-ghost {
  display: inline-flex; align-items: center; padding: .6rem 1.1rem; border-radius: 8px;
  font-weight: 600; font-size: .95rem; text-decoration: none;
}
.btn-portal-primary { background: var(--primary); color: #fff; }
.btn-portal-secondary { background: #e8f0ff; color: #1e40af; }
.btn-portal-ghost { border: 1px solid var(--line, #dde5eb); color: var(--text); }
.offer-count { color: var(--muted); font-size: .85rem; margin-bottom: 1rem; }
.loading-msg { text-align: center; margin-top: 3rem; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.loading-spinner {
    width: 36px; height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: portal-spin .8s linear infinite;
}
@keyframes portal-spin { to { transform: rotate(360deg); } }

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 6px rgba(0,0,0,.08);
    border: 1px solid #e2e8f0;
}
.stat-card.stat-ok { border-color: #bbf7d0; background: #f0fdf4; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.stat-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-top: .35rem; }

.table-wrapper { overflow-x: auto; background: var(--card-bg); border-radius: 12px; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 480px; }
.data-table th { text-align: left; padding: .65rem .85rem; color: var(--text-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid #e2e8f0; background: #f8fafc; }
.data-table td { padding: .65rem .85rem; border-bottom: 1px solid #f1f5f9; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .text-right { text-align: right; }

.empty-state { text-align: center; background: var(--card-bg); border-radius: 12px; padding: 3rem 1.5rem; color: var(--text); box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.empty-state .empty-cta { margin-top: 1rem; }

.offers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.offer-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 6px rgba(0,0,0,.08);
    position: relative;
    overflow: hidden;
    border-top: 4px solid var(--primary);
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.offer-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
    background: #e2e8f0;
    margin: 0 0 .35rem;
}
.offer-image-placeholder {
    background: linear-gradient(135deg, #e2e8f0, #f1f5f9);
}
.offer-category { font-size: .7rem; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; }
.offer-name { margin: 0; font-size: 1rem; font-weight: 700; color: var(--text); }
.offer-desc { margin: 0; font-size: .82rem; color: var(--muted); }
.offer-prices { display: flex; align-items: baseline; gap: .75rem; margin-top: .4rem; }
.price-normal { font-size: .9rem; color: var(--muted); text-decoration: line-through; }
.price-offer  { font-size: 1.5rem; font-weight: 800; color: #dc2626; }
.offer-badge {
    position: absolute; top: .75rem; right: .75rem;
    background: #dc2626; color: white;
    font-size: .75rem; font-weight: 700;
    padding: .25rem .55rem; border-radius: 99px;
}
.offer-until { margin: 0; font-size: .78rem; color: var(--muted); margin-top: .25rem; }

.reward-card { border-top-color: var(--accent); }
.reward-cost { font-size: 1.6rem; font-weight: 800; color: var(--accent); margin-top: .35rem; }

@media (max-width: 560px) {
    .portal-content { padding: 1rem .85rem; }
    .offers-grid { grid-template-columns: 1fr; gap: .85rem; }
    .offer-card { padding: 1rem; }
    .offer-name { font-size: .95rem; }
    .price-offer, .reward-cost { font-size: 1.35rem; }
    .login-box { margin: 1.5rem auto; padding: 1.5rem; }
    .client-card { padding: 1.1rem 1.25rem; }
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
    .mov-table { font-size: .82rem; }
    .mov-table th, .mov-table td { padding: .45rem .5rem; }
}
