/*
 * NEXURA ECR™ — UI Extensions v3.1
 * Complementa layouts partner/admin/app: aliases, page chrome, tienda.
 */

/* ── Icono SVG global ── */
.nx-ui-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ── Icon box — contenedor estilo sidebar para iconos en áreas de contenido ── */
.nx-icon-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    flex-shrink: 0;
    vertical-align: middle;
    background: linear-gradient(145deg, rgba(96,165,250,.22), rgba(124,58,237,.14));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.75), 0 2px 6px rgba(15,23,42,.1);
    color: #4f6af5;
}
.nx-icon-box.sm { width: 24px; height: 24px; border-radius: 7px; }
.nx-icon-box.lg { width: 40px; height: 40px; border-radius: 11px; }
.nx-icon-box .nx-ui-icon { width: 15px; height: 15px; vertical-align: 0; display: block; }

/* ── Badge aliases (vistas legacy) ── */
.nx-badge-green { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.nx-badge-red   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.nx-badge-amber { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* Partner light stat — blue tint */
.nx-stat-blue {
    border-color: rgba(37, 99, 235, .22);
    background: linear-gradient(135deg, #fff 60%, rgba(37, 99, 235, .05));
}
.nx-stat-blue .nx-stat-value { color: #1d4ed8; }

/* Tarjeta KPI — insignia de rango */
.nx-stat--rango::after {
    display: none;
}
.nx-stat-rango-badge {
    position: absolute;
    right: .85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 3px 10px rgba(79, 70, 229, .18));
}
.nx-stat-value--rango {
    padding-right: 4.25rem;
    text-align: left !important;
}

/* Finanzas CTA (módulo verde) */
.btn-partner {
    background: linear-gradient(135deg, #059669, #047857) !important;
    color: #fff !important;
    border: none;
    border-radius: 999px;
    font-weight: 800;
    box-shadow: 0 4px 14px rgba(5, 150, 105, .32);
    transition: transform .15s, box-shadow .15s;
}
.btn-partner:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(5, 150, 105, .42);
    color: #fff !important;
}

/* ── Page header (partner + admin) ── */
.nx-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1.5px solid rgba(124, 58, 237, .08);
}
.nx-page-head--finanzas { border-bottom-color: rgba(5, 150, 105, .15); }
.nx-page-head--admin    { border-bottom-color: rgba(124, 58, 237, .12); }

.nx-page-head-main { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.nx-page-head-icon {
    width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
    display: grid; place-items: center; font-size: 1.35rem;
    background: linear-gradient(135deg, var(--nx-pri, #7c3aed), var(--nx-deep, #5b21b6));
    color: #fff;
    box-shadow: 0 6px 20px rgba(124, 58, 237, .28);
}
.nx-page-head-icon--finanzas {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 6px 20px rgba(5, 150, 105, .28);
}
.nx-page-head-icon--store {
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    box-shadow: 0 6px 20px rgba(37, 99, 235, .25);
}

.nx-page-title {
    font-size: 1.35rem; font-weight: 900; color: var(--nx-ink, #0f172a);
    margin: 0; line-height: 1.2;
}
.nx-page-sub {
    font-size: .84rem; color: #64748b; margin: .2rem 0 0; line-height: 1.45;
}
.nx-page-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.nx-pill-link {
    display: inline-flex; align-items: center; gap: .35rem;
    text-decoration: none !important;
    padding: .45rem .95rem;
    border-radius: 999px;
    font-size: .78rem; font-weight: 800;
    background: rgba(124, 58, 237, .08);
    color: var(--nx-pri2, #5b21b6) !important;
    border: 1px solid rgba(124, 58, 237, .18);
    transition: background .14s;
}
.nx-pill-link:hover { background: rgba(124, 58, 237, .14); }
.nx-pill-link--green {
    background: rgba(5, 150, 105, .08);
    color: #047857 !important;
    border-color: rgba(5, 150, 105, .2);
}
.nx-pill-link--green:hover { background: rgba(5, 150, 105, .14); }

/* Filter pills */
.nx-filter-bar { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.nx-filter-pill {
    display: inline-flex; align-items: center;
    padding: .4rem 1rem;
    border-radius: 999px;
    font-size: .78rem; font-weight: 800;
    text-decoration: none !important;
    border: 1.5px solid #e2e8f0;
    color: #64748b !important;
    background: #fff;
    transition: all .14s;
}
.nx-filter-pill:hover { border-color: rgba(124, 58, 237, .35); color: var(--nx-pri, #7c3aed) !important; }
.nx-filter-pill.is-active {
    background: linear-gradient(135deg, var(--nx-pri, #7c3aed), var(--nx-deep, #5b21b6));
    border-color: transparent;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(124, 58, 237, .3);
}

/* Admin gradient KPI (when admin-premium gradients wanted) */
.nx-kpi-admin .nx-stat { border: none; color: #fff; }
.nx-kpi-admin .nx-stat-label { color: rgba(255,255,255,.85); }
.nx-kpi-admin .nx-stat-sub   { color: rgba(255,255,255,.7); }

/* Legal banner */
.nx-legal-banner {
    border-radius: 16px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border: 1.5px solid #fdba74;
    display: flex; align-items: flex-start; gap: .85rem;
}
.nx-legal-banner-icon { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }
.nx-legal-banner-title { font-weight: 900; font-size: .92rem; color: #9a3412; margin-bottom: .25rem; }
.nx-legal-banner-text  { font-size: .82rem; color: #7c2d12; line-height: 1.55; margin: 0 0 .75rem; }

/* Card section titles */
.nx-card-title {
    font-size: .95rem; font-weight: 900; color: var(--nx-ink, #0f172a);
    padding: 1.15rem 1.25rem .35rem;
}
.nx-card-title--bar {
    padding-bottom: .85rem;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(124, 58, 237, .08);
}

/* Empty state */
.nx-empty {
    text-align: center; padding: 3rem 1.5rem;
}
.nx-empty-icon { font-size: 2.75rem; margin-bottom: .6rem; opacity: .9; }
.nx-empty-icon svg { width: 2.75rem; height: 2.75rem; }
.nx-empty-title { font-weight: 800; color: var(--nx-ink, #0f172a); margin-bottom: .25rem; }
.nx-empty-sub { font-size: .82rem; color: #64748b; }

/* Topbar brand mark */
.nx-brand-mark {
    display: inline-flex; align-items: center; gap: .5rem; min-width: 0;
}
.nx-brand-mark img {
    height: 28px; width: auto; object-fit: contain; flex-shrink: 0;
}
.nx-brand-mark-fallback {
    width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--nx-pri, #7c3aed), #a21caf);
    display: grid; place-items: center;
    font-size: .78rem; font-weight: 900; color: #fff;
}

/* ── Panel de marca — una sola zona, logo protagonista ── */
.sb-brand-panel,
.nx-sb-header.sb-brand-panel {
    padding: .75rem .7rem .6rem !important;
    background: rgba(255,255,255,.06);
    border-bottom: 1px solid rgba(255,255,255,.08) !important;
}

.sb-brand-panel-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: .3rem;
    min-width: 0;
}

.sb-brand-panel--has-logo .sb-brand-text { display: none; }
.sb-brand-panel--has-logo .sb-brand-logo-wrap {
    width: 100%;
    max-width: 210px;
    height: auto;
    min-height: 48px;
    padding: 8px 12px;
    border-radius: 12px;
    box-shadow: 0 4px 18px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.12);
}
.sb-brand-panel--has-logo .sb-brand-logo-img {
    max-height: 48px;
    width: auto;
    max-width: 100%;
}

.sb-brand-logo-wrap {
    flex-shrink: 0;
    width: 44px; height: 44px;
    border-radius: 12px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.14);
    display: grid;
    place-items: center;
    padding: 5px;
}

.sb-brand-logo-img {
    max-height: 36px;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.4)) brightness(1.06);
}

.sb-brand-text { min-width: 0; }

.sb-brand-name {
    font-size: .88rem; font-weight: 900; color: #fff;
    letter-spacing: .03em; line-height: 1.1;
}
.sb-brand-name span {
    color: #93c5fd;
    font-weight: 700;
    font-size: .78rem;
}

.sb-brand-role,
.sb-brand-caption {
    font-size: .5rem; font-weight: 700;
    letter-spacing: .14em; text-transform: uppercase;
    color: rgba(147, 197, 253, .7);
    margin: 0;
}

.sb-footer-minimal {
    padding: .55rem .65rem .75rem !important;
    border-top: 1px solid rgba(255,255,255,.06);
}
.sb-logout-btn {
    width: 100%;
    padding: .42rem .65rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.1);
    background: rgba(255,255,255,.04);
    color: rgba(255,255,255,.45);
    font-size: .7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .14s;
    font-family: inherit;
}
.sb-logout-btn:hover {
    background: rgba(220,38,38,.12);
    color: #fca5a5;
    border-color: rgba(220,38,38,.22);
}

/* Tarjeta perfil sidebar — nombre + pin en una fila */
.nx-sb-profile-head,
.ps-profile-head {
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: .55rem;
    align-items: center;
}

.nx-sb-identity,
.ps-identity {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    column-gap: .45rem;
    row-gap: .15rem;
    align-items: center;
    min-width: 0;
}

.nx-sb-identity--solo,
.ps-identity--solo {
    grid-template-columns: 1fr;
}
.nx-sb-identity--solo .nx-sb-codigo,
.ps-identity--solo .ps-email {
    grid-column: 1;
}

.nx-sb-identity .nx-sb-name,
.ps-identity .ps-name {
    grid-column: 1;
    grid-row: 1;
    font-size: .76rem !important;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
}

.nx-sb-identity .nx-sb-codigo,
.ps-identity .ps-email {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: .62rem !important;
    margin: 0;
    opacity: .75;
}

.nx-sb-memb-inline,
.ps-memb-inline {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-self: end;
    line-height: 0;
}

.nx-sb-memb-inline .nx-badge-pins,
.ps-memb-inline .nx-badge-pins {
    display: block !important;
    line-height: 0;
}

.nx-sb-pin-img {
    width: 34px !important;
    height: 34px !important;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.4));
}

.nx-sb-profile,
.ps-profile {
    padding: .65rem .75rem !important;
}

/* Topbar: pin + membresía (sin repetir marca) */
.nx-topbar-memb {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    text-decoration: none !important;
    color: inherit;
    min-width: 0;
}
.nx-topbar-memb:hover .nx-topbar-memb-name {
    color: var(--nx-pri, #7c3aed);
}
.nx-topbar-pin {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 8px rgba(124, 58, 237, .2));
}
.nx-topbar-memb-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}
.nx-topbar-memb-hint {
    font-size: .58rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #94a3b8;
}
.nx-topbar-memb-name {
    font-size: .92rem;
    font-weight: 900;
    color: var(--nx-ink, #0f172a);
    transition: color .14s;
}
.nx-topbar-page {
    font-size: .78rem;
    font-weight: 600;
    color: #64748b;
    margin-left: .5rem;
    padding-left: .75rem;
    border-left: 1px solid rgba(124, 58, 237, .12);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* Vista previa marca en /admin/marca */
.nx-marca-preview-dark,
.nx-marca-preview-light {
    border-radius: 14px;
    padding: 1.25rem 1rem;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border: 1.5px solid rgba(15,23,42,.08);
}
.nx-marca-preview-dark {
    background: linear-gradient(175deg, #0b1929 0%, #0e2244 50%, #173060 100%);
}
.nx-marca-preview-light {
    background: linear-gradient(135deg, #f8fafc, #ede9fe);
}
.nx-marca-preview-dark img,
.nx-marca-preview-light img {
    max-height: 56px; max-width: 90%;
    object-fit: contain;
}
.nx-marca-preview-dark img {
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.4)) brightness(1.05);
}
.nx-marca-slot-card {
    transition: box-shadow .2s, border-color .2s;
}
.nx-marca-slot-card:hover {
    box-shadow: 0 8px 28px rgba(124,58,237,.12);
    border-color: rgba(124,58,237,.2);
}

/* Admin action stack in tables */
.nx-action-stack { min-width: 200px; }
.nx-action-stack .nx-input,
.nx-action-stack .form-control {
    font-size: .75rem;
    margin-bottom: .4rem;
    border-radius: 10px;
    border: 1.5px solid rgba(124, 58, 237, .12);
}
.nx-action-stack .btn { font-size: .72rem; font-weight: 800; }

/* ── Store / Cart (NEXURA violet + blue) ── */
.store-cart-wrap {
    --sc-pri: #7c3aed;
    --sc-pri2: #2563eb;
    --sc-ink: #0f172a;
    --sc-muted: #64748b;
    --sc-border: rgba(124, 58, 237, .12);
    --sc-shadow: 0 8px 32px rgba(124, 58, 237, .08);
    color: var(--sc-ink);
    max-width: 1140px;
    margin: 0 auto;
}

.store-cart-brand {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: .75rem;
    padding: .85rem 0 1rem;
    margin-bottom: .5rem;
    border-bottom: 1px solid var(--sc-border);
}
.store-cart-brand img { height: 38px; object-fit: contain; }
.store-cart-brand-name {
    font-weight: 900; letter-spacing: .12em; font-size: .72rem;
    color: var(--sc-pri);
    text-transform: uppercase;
}

.store-cart-crumb {
    font-size: .8rem; color: var(--sc-muted); margin-bottom: 1rem;
}
.store-cart-crumb a {
    color: var(--sc-pri2); font-weight: 700; text-decoration: none;
}
.store-cart-crumb a:hover { text-decoration: underline; }

.store-cart-panel {
    background: #fff;
    border: 1.5px solid var(--sc-border);
    border-radius: 18px;
    box-shadow: var(--sc-shadow);
    overflow: hidden;
}
.store-cart-panel-pad { padding: 1.35rem 1.5rem; }

.store-cart-item {
    display: flex; align-items: center; gap: 1rem;
    padding: 1rem 1.25rem;
}
.store-cart-item + .store-cart-item { border-top: 1px solid var(--sc-border); }

.store-cart-thumb {
    width: 64px; height: 64px; border-radius: 12px; overflow: hidden;
    background: #f5f3ff; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}

.store-cart-summary-box {
    background: #faf5ff;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.1rem;
}

.store-cart-input {
    width: 100%;
    padding: .55rem .85rem;
    border: 1.5px solid var(--sc-border);
    border-radius: 10px;
    font-size: .86rem;
    color: var(--sc-ink);
    outline: none;
    transition: border-color .14s, box-shadow .14s;
}
.store-cart-input:focus {
    border-color: var(--sc-pri);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .12);
}

.store-cart-label {
    display: block;
    font-size: .75rem; font-weight: 700;
    color: var(--sc-muted);
    margin-bottom: .25rem;
}

.btn-store-primary {
    background: linear-gradient(135deg, var(--sc-pri), var(--sc-pri2));
    color: #fff !important;
    border: none; border-radius: 12px;
    padding: .7rem 1.25rem;
    font-weight: 800; font-size: .9rem;
    box-shadow: 0 4px 14px rgba(124, 58, 237, .32);
    text-decoration: none;
    display: inline-block;
    transition: transform .15s;
}
.btn-store-primary:hover { transform: translateY(-1px); color: #fff !important; }

.btn-store-stripe {
    width: 100%;
    background: linear-gradient(135deg, #635bff, #4f46e5);
    color: #fff;
    border: none; border-radius: 12px;
    padding: .75rem 1rem;
    font-weight: 800; font-size: .9rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(99, 91, 255, .35);
}

.store-cart-empty {
    text-align: center;
    padding: 4rem 1.5rem;
    background: #fff;
    border: 1.5px solid var(--sc-border);
    border-radius: 20px;
    box-shadow: var(--sc-shadow);
}
