/* ═══════════════════════════════════════════════════════════════════
   PUNTO X · Drugstore 24hs — identidad visual (se carga después de ui.css)
   ═══════════════════════════════════════════════════════════════════ */
:root {
    --px: #5529c4;
    --px-rgb: 85, 41, 196;
    --px-oscuro: #3d1c93;
    --px-vivo: #7c4dff;
    --px-suave: #efeaff;
    --px-noche: #0d0819;
    --px-noche2: #180f2e;

    --acento: #9d7bff;
    --acento-ia: #c084fc;
    --sb-bg: #120b24;
    --sb-bg2: #1c1236;
    --sb-texto: #cfc6e8;
    --radio-card: 18px;
    --sombra-suave: 0 1px 2px rgba(23, 10, 60, .05), 0 10px 28px rgba(23, 10, 60, .07);

    --bs-primary: #5529c4;
    --bs-primary-rgb: 85, 41, 196;
    --bs-link-color: #5529c4;
    --bs-link-color-rgb: 85, 41, 196;
    --bs-link-hover-color: #3d1c93;
    --bs-primary-bg-subtle: #efeaff;
    --bs-primary-text-emphasis: #3d1c93;
}

body { background: #f5f3fb; }
h1, h2, h3, h4, .pag-titulo h2, .px-titulo { font-family: 'Montserrat', 'Segoe UI', Roboto, sans-serif; letter-spacing: -.015em; }

/* ── Botones y controles en violeta ── */
.btn-primary, .btn-celeste {
    --bs-btn-bg: #5529c4; --bs-btn-border-color: #5529c4; --bs-btn-hover-bg: #4720a8; --bs-btn-hover-border-color: #4720a8;
    --bs-btn-active-bg: #3d1c93; --bs-btn-active-border-color: #3d1c93; --bs-btn-disabled-bg: #8f76d6; --bs-btn-disabled-border-color: #8f76d6;
    background: linear-gradient(135deg, #6a35e0, #5529c4); border: 0; color: #fff; box-shadow: 0 4px 14px rgba(var(--px-rgb), .28);
}
.btn-primary:hover, .btn-celeste:hover { background: linear-gradient(135deg, #5c2bcb, #4720a8); color: #fff; }
.btn-outline-primary { --bs-btn-color: #5529c4; --bs-btn-border-color: #5529c4; --bs-btn-hover-bg: #5529c4; --bs-btn-hover-border-color: #5529c4; --bs-btn-active-bg: #3d1c93; --bs-btn-active-border-color: #3d1c93; }
.text-primary { color: #5529c4 !important; }
.bg-primary { background-color: #5529c4 !important; }
.border-primary { border-color: #5529c4 !important; }
.form-control:focus, .form-select:focus { border-color: #7c4dff; box-shadow: 0 0 0 .22rem rgba(var(--px-rgb), .2); }
.form-check-input:checked { background-color: #5529c4; border-color: #5529c4; }
.nav-tabs .nav-link { color: #5529c4; }
.nav-pills { --bs-nav-pills-link-active-bg: #5529c4; }
.pagination { --bs-pagination-active-bg: #5529c4; --bs-pagination-active-border-color: #5529c4; --bs-pagination-color: #5529c4; }
.table-hover > tbody > tr:hover > * { --bs-table-hover-bg: rgba(var(--px-rgb), .055); }
.btn:focus-visible, .sb-link:focus-visible, .sb-icon:focus-visible, a:focus-visible { outline-color: rgba(var(--px-rgb), .55); }
.drop-zona { border-color: #c9bbf2; background: rgba(var(--px-rgb), .035); }
.drop-zona:hover, .drop-zona.arrastrando { border-color: #5529c4; background: rgba(var(--px-rgb), .09); }
.drop-zona .bi { color: #5529c4; }
.resumen-caja > div { background: rgba(var(--px-rgb), .07); }
.pag-titulo .pag-ico { background: linear-gradient(135deg, #8b5cf6, #5529c4); }

/* ── Menú lateral nocturno ── */
.sidebar { background: radial-gradient(120% 60% at 0% 0%, #2a1660 0%, var(--sb-bg) 45%, var(--px-noche) 100%); }
.sb-link.activo { background: linear-gradient(90deg, rgba(124, 77, 255, .42), rgba(124, 77, 255, .08)); box-shadow: inset 3px 0 0 #a78bfa; }
.sb-group { color: #7f6fae; }
.sb-vender { background: linear-gradient(135deg, #8b5cf6, #5b27d6); box-shadow: 0 8px 20px rgba(124, 77, 255, .4); }
.topbar { background: linear-gradient(100deg, #24124f, var(--px-noche)); }

.px-marca { display: flex; align-items: center; flex: 1; min-width: 0; text-decoration: none; }
.px-marca .px-logo { width: 150px; max-width: 100%; height: auto; }
.px-marca .px-icono { width: 40px; height: 40px; display: none; }
@media (min-width: 992px) {
    .sb-colapsado .px-marca { flex: 0; }
    .sb-colapsado .px-marca .px-logo { display: none; }
    .sb-colapsado .px-marca .px-icono { display: block; }
}
.topbar-brand .px-logo { height: 28px; width: auto; }

/* ── Sucursal actual / selector ── */
.px-suc { margin: 2px 12px 6px; }
.px-suc-btn {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; color: #fff; border: 1px solid rgba(167, 139, 250, .28);
    background: rgba(124, 77, 255, .14); border-radius: 14px; padding: 9px 11px; line-height: 1.2;
}
button.px-suc-btn:hover { background: rgba(124, 77, 255, .26); }
.px-suc-btn > i:first-child { font-size: 1.15rem; color: #c4b5fd; width: 22px; text-align: center; flex-shrink: 0; }
.px-suc-btn small { display: block; font-size: .6rem; letter-spacing: .14em; font-weight: 800; color: #a996e0; text-transform: uppercase; }
.px-suc-btn strong { display: block; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.px-suc .dropdown-menu { width: 224px; min-width: 224px; background: #1c1236; border-radius: 14px; overflow: hidden; }
.px-suc .dropdown-item { color: #e8e2fa; display: flex; align-items: center; gap: 9px; padding: .55rem .9rem; }
.px-suc .dropdown-item:hover { background: rgba(124, 77, 255, .25); color: #fff; }
.px-suc .dropdown-item.activa { background: #5529c4; color: #fff; }
@media (min-width: 992px) {
    .sb-colapsado .px-suc { margin: 2px 8px 6px; }
    .sb-colapsado .px-suc-btn { justify-content: center; padding: 9px 0; }
    .sb-colapsado .px-suc-btn > i.bi-chevron-expand { display: none; }
    .sb-colapsado .px-suc .dropdown-menu { width: 250px; }
}
.px-pill { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700; padding: .28rem .6rem; border-radius: 999px; background: rgba(124, 77, 255, .25); color: #fff; max-width: 40vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── IA en violeta ── */
.ia-fab, .ia-enviar, .ia-bienvenida .ia-ico { background: linear-gradient(135deg, #a855f7, #5529c4); }
.ia-head { background: linear-gradient(135deg, #2a1366, #6a35e0); }
.ia-msg.user { background: #5529c4; }
.ia-entrada textarea:focus { border-color: #7c4dff; box-shadow: 0 0 0 .2rem rgba(var(--px-rgb), .2); }
/* en el punto de venta el botón de la IA no tapa el título */
@media (min-width: 768px) { body:has(.pos-row) .ia-fab { left: calc(var(--sb-w-chico) + 385px); } }

/* ── Pantalla de inicio ── */
.px-hero {
    position: relative; overflow: hidden; border-radius: 26px; color: #fff; padding: clamp(20px, 3.4vw, 38px);
    background: radial-gradient(90% 140% at 100% 0%, #7c4dff 0%, rgba(124, 77, 255, 0) 55%), linear-gradient(120deg, #0d0819 0%, #2a1366 62%, #5529c4 100%);
    box-shadow: 0 20px 44px rgba(43, 17, 110, .28);
}
.px-hero::after { content: ''; position: absolute; right: -50px; bottom: -70px; width: 270px; height: 270px; background: url('../marca/icono.png') center/contain no-repeat; opacity: .13; transform: rotate(-8deg); pointer-events: none; }
.px-hero h1 { font-weight: 800; font-size: clamp(1.45rem, 3.4vw, 2.35rem); margin: 0; }
.px-hero .px-sub { color: #cdbfff; font-weight: 500; }
.px-24 { display: inline-flex; align-items: center; gap: 7px; font-size: .72rem; font-weight: 800; letter-spacing: .14em; border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px; padding: .3rem .75rem; margin-bottom: .8rem; }
.px-punto { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 4px rgba(74, 222, 128, .22); }
.px-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 22px; position: relative; z-index: 1; }
.px-kpis > div { background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .13); border-radius: 18px; padding: 12px 16px; }
.px-kpis small { display: block; font-size: .66rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; color: #c9bbf7; }
.px-kpis strong { font-family: 'Montserrat', sans-serif; font-size: clamp(1.15rem, 2.2vw, 1.6rem); }

.px-sucursales { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 18px; }
.px-card { background: var(--bs-body-bg, #fff); border-radius: 22px; overflow: hidden; box-shadow: var(--sombra-suave); border: 1px solid rgba(var(--px-rgb), .1); display: flex; flex-direction: column; transition: transform .18s, box-shadow .18s; }
.px-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px rgba(43, 17, 110, .15); }
.px-card.elegida { border: 2px solid #5529c4; }
.px-card-top { padding: 18px 20px 14px; background: linear-gradient(135deg, #5529c4, #2a1366); color: #fff; }
.px-card-top h3 { font-size: 1.08rem; font-weight: 800; margin: 0; }
.px-card-top small { color: #d3c6ff; }
.px-card-body { padding: 16px 20px; flex: 1; }
.px-venta { font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 1.9rem; color: #5529c4; line-height: 1.1; }
.px-datos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; text-align: center; }
.px-datos > div { background: rgba(var(--px-rgb), .07); border-radius: 14px; padding: 8px 4px; }
.px-datos b { display: block; font-size: 1.2rem; }
.px-datos span { font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: #7a6f96; }
.px-chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(34, 197, 94, .13); color: #15803d; border-radius: 999px; padding: .25rem .65rem; font-size: .76rem; font-weight: 700; margin: 0 4px 4px 0; }

.px-acciones { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.px-accion { display: flex; flex-direction: column; gap: 10px; padding: 20px 18px; border-radius: 20px; background: var(--bs-body-bg, #fff); text-decoration: none; color: inherit; box-shadow: var(--sombra-suave); border: 1px solid rgba(var(--px-rgb), .1); transition: transform .16s, box-shadow .16s; min-height: 130px; }
.px-accion:hover { transform: translateY(-4px); box-shadow: 0 18px 34px rgba(43, 17, 110, .15); color: inherit; }
.px-accion i { width: 46px; height: 46px; border-radius: 15px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; background: var(--px-suave); color: #5529c4; }
.px-accion strong { font-family: 'Montserrat', sans-serif; font-size: .98rem; }
.px-accion small { color: #7a6f96; line-height: 1.25; }
.px-accion.principal { background: linear-gradient(135deg, #7c4dff, #4a1fb8); color: #fff; }
.px-accion.principal i { background: rgba(255, 255, 255, .18); color: #fff; }
.px-accion.principal small { color: #ded4ff; }
.px-accion.principal:hover { color: #fff; }
.px-seccion { font-size: .72rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; color: #8a7fac; margin: 26px 0 12px; }

/* ── Acceso ── */
.px-login { position: fixed; inset: 0; z-index: 10; overflow: auto; display: grid; grid-template-columns: 1.15fr 1fr; background: var(--bs-body-bg, #fff); }
.px-login-marca { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 34px; padding: 48px; color: #fff; text-align: center;
    background: radial-gradient(70% 60% at 50% 40%, rgba(124, 77, 255, .42), rgba(124, 77, 255, 0) 70%), #07040f; }
.px-login-marca img { width: min(440px, 82%); height: auto; filter: drop-shadow(0 0 34px rgba(124, 77, 255, .55)); }
.px-login-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.px-login-chips span { border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px; padding: .4rem .85rem; font-size: .8rem; font-weight: 600; color: #d9ceff; }
.px-login-form { display: flex; align-items: center; justify-content: center; padding: 32px 22px; }
.px-login-form > div { width: 100%; max-width: 380px; }
.px-login-form .form-control { padding: .8rem 1rem; border-radius: 14px; }
@media (max-width: 991.98px) {
    .px-login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .px-login-marca { padding: 34px 20px 26px; gap: 16px; }
    .px-login-marca img { width: min(300px, 80%); }
    .px-login-chips { display: none; }
}

/* ── Modo oscuro ── */
[data-bs-theme="dark"] { --bs-primary-bg-subtle: #251848; --bs-primary-text-emphasis: #cbb8ff; }
[data-bs-theme="dark"] body { background: #0b0714; }
[data-bs-theme="dark"] .sidebar { background: radial-gradient(120% 60% at 0% 0%, #211150 0%, #0e0920 45%, #07040f 100%); }
[data-bs-theme="dark"] .text-primary, [data-bs-theme="dark"] .px-venta { color: #b39bff !important; }
[data-bs-theme="dark"] .nav-tabs .nav-link { color: #b39bff; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #b39bff; --bs-btn-border-color: #7c4dff; --bs-btn-hover-bg: #5529c4; --bs-btn-hover-color: #fff; }
[data-bs-theme="dark"] .px-card, [data-bs-theme="dark"] .px-accion:not(.principal) { background: #171026; border-color: #2c2147; }
[data-bs-theme="dark"] .px-accion:not(.principal) i { background: #2a1c52; color: #c4b0ff; }
[data-bs-theme="dark"] .px-accion small, [data-bs-theme="dark"] .px-datos span { color: #a99fc6; }
[data-bs-theme="dark"] .px-chip { color: #6ee7a0; }
@media (prefers-reduced-motion: reduce) { .px-card, .px-accion { transition: none; } }

/* etiquetas suaves sobre el color de marca: texto legible */
.badge.bg-primary.bg-opacity-25.text-dark { color: var(--bs-primary-text-emphasis) !important; }
