/* ── Brand override for Bootstrap 5 ── */
:root {
    --bs-primary:         #AD0E0B;
    --bs-primary-rgb:     173, 14, 11;
    --bs-link-color:      #AD0E0B;
    --bs-link-hover-color:#8A0B09;
    --sidebar-bg:         #1e293b;
    --sidebar-w:          260px;
    --topbar-h:           60px;
}

/* ── Button primary ── */
.btn-primary {
    --bs-btn-bg:                 #AD0E0B;
    --bs-btn-border-color:       #AD0E0B;
    --bs-btn-hover-bg:           #8A0B09;
    --bs-btn-hover-border-color: #8A0B09;
    --bs-btn-active-bg:          #6D0907;
    --bs-btn-focus-shadow-rgb:   173,14,11;
}
.btn-outline-primary {
    --bs-btn-color:              #AD0E0B;
    --bs-btn-border-color:       #AD0E0B;
    --bs-btn-hover-bg:           #AD0E0B;
    --bs-btn-hover-border-color: #AD0E0B;
}
.text-primary   { color: #AD0E0B !important; }
.bg-primary     { background-color: #AD0E0B !important; }
.border-primary { border-color: #AD0E0B !important; }
a { color: #AD0E0B; }
a:hover { color: #8A0B09; }

/* ── Sidebar ── */
.sidebar {
    position: fixed; top: 0; left: 0; width: var(--sidebar-w);
    height: 100vh; background: var(--sidebar-bg);
    display: flex; flex-direction: column; z-index: 1035;
    overflow-y: auto;
}
.sidebar-logo {
    padding: 20px; border-bottom: 1px solid rgba(255,255,255,.07);
    text-align: center;
}
.sidebar-logo img { max-height: 42px; object-fit: contain; }
.sidebar-logo span {
    display: block; font-size: 11px; font-weight: 700;
    letter-spacing: 1.5px; text-transform: uppercase;
    color: rgba(255,255,255,.4); margin-top: 8px;
}
.sidebar-section {
    padding: 18px 18px 6px;
    font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
    text-transform: uppercase; color: rgba(255,255,255,.3);
}
.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-link {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 20px; color: rgba(255,255,255,.65);
    font-size: 14px; font-weight: 500;
    text-decoration: none; border-left: 3px solid transparent;
    transition: all .18s ease;
}
.sidebar-link i { font-size: 17px; width: 20px; }
.sidebar-link:hover  { color: #fff; background: rgba(255,255,255,.06); }
.sidebar-link.active { color: #fff; background: rgba(173,14,11,.25); border-left-color: #AD0E0B; }
.sidebar-footer {
    padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.07);
    font-size: 11px; color: rgba(255,255,255,.25);
}

/* ── Main wrapper ── */
@media (min-width: 992px) { .main-wrapper { margin-left: var(--sidebar-w); } }

/* ── Topbar ── */
.topbar {
    height: var(--topbar-h); background: #fff;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    position: sticky; top: 0; z-index: 1020;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
}

/* ── Cards ── */
.card { border: none; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.card-hover {
    transition: transform .2s ease, box-shadow .2s ease;
    cursor: pointer;
}
.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.10) !important;
}

/* ── KPI cards ── */
.kpi-card { border-radius: 14px; overflow: hidden; position: relative; }
.kpi-card::before {
    content: ''; position: absolute; top: 0; left: 0;
    right: 0; height: 4px;
}
.kpi-red::before    { background: linear-gradient(90deg,#AD0E0B,#ff4d4f); }
.kpi-blue::before   { background: linear-gradient(90deg,#0d6efd,#6ea8fe); }
.kpi-green::before  { background: linear-gradient(90deg,#198754,#75b798); }
.kpi-orange::before { background: linear-gradient(90deg,#fd7e14,#ffda6a); }
.kpi-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
}

/* ── Product cards ── */
.product-card {
    border-radius: 12px; border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: transform .2s ease, box-shadow .2s ease;
    height: 100%;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(0,0,0,.11) !important;
}
.product-price { font-size: 1.35rem; font-weight: 700; color: #AD0E0B; }
.product-code  { font-size: 11px; letter-spacing: .5px; text-transform: uppercase; }

/* ── Status badges ── */
.badge-PENDIENTE  { background: #fef3cd; color: #856404 !important; }
.badge-EN-PROCESO { background: #cff4fc; color: #055160 !important; }
.badge-SURTIDO    { background: #d1e7dd; color: #0f5132 !important; }
.badge-ERROR      { background: #f8d7da; color: #842029 !important; }
.badge-CANCELADO  { background: #e2e3e5; color: #41464b !important; }
.badge-status { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; }

/* ── Table ── */
.table-hover tbody tr { transition: background .12s; }
.table thead th { font-size: 11px; font-weight: 700; text-transform: uppercase;
                  letter-spacing: .5px; color: #6c757d; border-bottom: 2px solid #e9ecef; }

/* ── Cart ── */
.qty-control { display: inline-flex; align-items: center; gap: 0; }
.qty-control input {
    width: 56px; text-align: center; border-left: 0; border-right: 0;
    border-radius: 0; padding: 4px 0; font-weight: 600;
}
.qty-control .btn { padding: 4px 10px; line-height: 1.4; }

/* ── Pagination ── */
.page-link { color: #AD0E0B; border-color: #dee2e6; }
.page-link:hover { color: #8A0B09; background: #f8f9fa; }
.page-item.active .page-link { background: #AD0E0B; border-color: #AD0E0B; }

/* ── Auth page ── */
.auth-wrapper {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    background: linear-gradient(135deg, #2d0b0a 0%, #AD0E0B 50%, #1e293b 100%);
    padding: 20px;
}
.auth-card {
    background: rgba(255,255,255,.97);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    max-width: 420px; width: 100%;
}

/* ── Animations ── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp .35s ease both; }
.animate-in-delay-1 { animation-delay: .06s; }
.animate-in-delay-2 { animation-delay: .12s; }
.animate-in-delay-3 { animation-delay: .18s; }
.animate-in-delay-4 { animation-delay: .24s; }

/* ── Misc ── */
.empty-state { text-align: center; padding: 60px 20px; color: #adb5bd; }
.empty-state i { font-size: 52px; display: block; margin-bottom: 16px; }
.form-control:focus, .form-select:focus {
    border-color: #AD0E0B;
    box-shadow: 0 0 0 .2rem rgba(173,14,11,.15);
}
.catalog-filters-card { position: sticky; top: 76px; }
.sidebar-link.active i { color: #ff6b6b; }

/* ── Movil layout ── */
.movil-header {
    position: sticky; top: 0; z-index: 1020;
    background: var(--sidebar-bg);
    height: 56px; padding: 0 12px 0 8px;
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.movil-header-logo img { height: 32px; object-fit: contain; border-radius: 4px; }
.movil-header-title {
    font-size: 12px; font-weight: 700; letter-spacing: .8px;
    text-transform: uppercase; color: rgba(255,255,255,.55);
    text-align: center; flex: 1; padding: 0 8px;
}
.movil-header-title strong { display: block; font-size: 13px; color: #fff; letter-spacing: .3px; }
.movil-main {
    padding: 16px;
    min-height: calc(100vh - 56px);
    background: #f1f5f9;
}
.movil-kpi {
    border-radius: 14px; padding: 16px;
    background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.07);
    display: flex; align-items: center; gap: 12px;
}
.movil-kpi-icon {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.movil-kpi-val { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.movil-kpi-lbl { font-size: 11px; color: #6c757d; margin-top: 2px; }

/* ── Visor 360° (assets/js/viewer360.js) + botón APS (aplicaciones) ── */
.product-badges {
    position: absolute; bottom: 8px; right: 8px; z-index: 2;
    display: flex; align-items: center; gap: 6px;
}
.viewer360-badge, .aps-badge {
    display: flex; align-items: center; gap: 4px;
    background: rgba(0,0,0,.6); color: #fff;
    font-size: 11px; font-weight: 700; letter-spacing: .3px;
    padding: 4px 10px; border-radius: 999px; border: none;
    transition: background .15s ease;
}
.viewer360-badge:hover, .aps-badge:hover { background: rgba(0,0,0,.8); }
.aps-badge { background: rgba(194,102,10,.9); }
.aps-badge:hover { background: #c2660a; }
.viewer360-frame {
    position: relative;
    width: 100%; aspect-ratio: 1 / 1;
    background: #f8f9fa; border-radius: 10px; overflow: hidden;
    cursor: grab; touch-action: none; user-select: none;
}
.viewer360-frame.dragging { cursor: grabbing; }
.viewer360-img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.viewer360-empty {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; color: #adb5bd; text-align: center; padding: 0 24px;
}
.viewer360-empty i { font-size: 2.2rem; }
.viewer360-empty span { font-size: 12px; font-weight: 600; }

/* ── Modal de modelos compatibles (COMP) ── */
.aps-modal .modal-dialog { max-width: 680px; }
.aps-modal .modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.25), 0 4px 14px rgba(0,0,0,.1);
    animation: apsModalPop .22s cubic-bezier(.34,1.56,.64,1);
}
@keyframes apsModalPop {
    from { transform: scale(.94); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.aps-modal .modal-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 16px 22px 20px;
    border-bottom: none;
    gap: 14px;
}
.aps-modal .modal-title {
    display: flex; align-items: center; color: #fff;
    flex: 1 1 auto; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.aps-modal .modal-title i {
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
    width: 32px; height: 32px; border-radius: 10px;
    background: rgba(255,255,255,.12); color: #ff6b68 !important;
    font-size: 16px; margin-right: 10px !important;
}
.aps-modal .modal-body { padding: 20px 18px 18px; }
.aps-modal .btn-close {
    transition: transform .18s ease; filter: invert(1) grayscale(100%) brightness(200%);
    flex: 0 0 auto;
}
.aps-modal .btn-close:hover { transform: rotate(90deg); }

/* Insignia con icono animado + contador, pegada al título a la izquierda */
.aps-header-left { display: flex; align-items: center; gap: 14px; flex: 0 1 auto; min-width: 0; overflow: hidden; }
.aps-header-badge {
    display: none; align-items: center; gap: 8px;
    padding: 3px 12px 3px 3px; border-radius: 999px;
    background: rgba(255,255,255,.08);
    flex: 0 0 auto;
}
.aps-header-badge.show { display: flex; }
.aps-header-badge-icon {
    position: relative;
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(173,14,11,.35); color: #ff6b68; font-size: 13px;
}
.aps-header-badge-icon::before {
    content: ''; position: absolute; inset: -5px; border-radius: 50%;
    border: 2px solid rgba(173,14,11,.45);
    animation: apsPulseRing 2.2s ease-out infinite;
}
.aps-header-badge-icon i { display: block; animation: apsIconFloat 2.6s ease-in-out infinite; }
.aps-header-badge-count {
    color: rgba(255,255,255,.85); font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .3px; white-space: nowrap;
}

.aps-list { max-height: 60vh; overflow-y: auto; padding-right: 4px; }

.aps-item {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 8px; border-radius: 8px;
    animation: apsItemIn .28s ease backwards;
    transition: background .15s ease;
}
.aps-item:hover { background: rgba(173,14,11,.05); }
.aps-item + .aps-item { margin-top: 1px; }
@keyframes apsItemIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}
.aps-item:nth-child(1) { animation-delay: .02s; }
.aps-item:nth-child(2) { animation-delay: .05s; }
.aps-item:nth-child(3) { animation-delay: .08s; }
.aps-item:nth-child(4) { animation-delay: .11s; }
.aps-item:nth-child(5) { animation-delay: .14s; }
.aps-item:nth-child(6) { animation-delay: .17s; }
.aps-item:nth-child(7) { animation-delay: .2s; }
.aps-item:nth-child(n+8) { animation-delay: .22s; }

.aps-item-icon {
    flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(30,41,59,.06); color: #1e293b; font-size: 15px;
}
.aps-item-info { min-width: 0; }
.aps-item-main { font-size: 13.5px; font-weight: 700; color: #1e293b; }
.aps-item-sub { font-size: 12px; color: #6c757d; margin-top: 1px; }
.aps-item-sub b { color: #495057; font-weight: 600; }

@keyframes apsPulseRing {
    0%   { transform: scale(.85); opacity: .9; }
    70%  { transform: scale(1.3); opacity: 0; }
    100% { transform: scale(1.3); opacity: 0; }
}
@keyframes apsIconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
.aps-empty, .aps-error {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; padding: 40px 20px; color: #adb5bd; text-align: center;
    width: 100%;
}
.aps-empty i, .aps-error i { font-size: 2.4rem; color: #AD0E0B; opacity: .45; animation: apsFloat 2.4s ease-in-out infinite; }
.aps-error i { color: #e57373; opacity: .8; }
@keyframes apsFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
@media (prefers-reduced-motion: reduce) {
    .aps-modal .modal-content, .aps-item, .aps-header-badge-icon i, .aps-header-badge-icon::before, .aps-empty i, .aps-error i { animation: none !important; }
}

/* ── Movil offcanvas menu ── */
.movil-offcanvas {
    background: var(--sidebar-bg);
    width: 260px;
}
.movil-offcanvas .offcanvas-header { background: var(--sidebar-bg); }
.movil-offcanvas-nav {
    display: flex; flex-direction: column; padding: 8px 0;
}
.movil-offcanvas-link {
    display: flex; align-items: center; gap: 11px;
    padding: 12px 20px; color: rgba(255,255,255,.65);
    font-size: 14px; font-weight: 500;
    text-decoration: none; border-left: 3px solid transparent;
    transition: all .18s ease;
}
.movil-offcanvas-link i { font-size: 18px; width: 20px; }
.movil-offcanvas-link:hover  { color: #fff; background: rgba(255,255,255,.06); }
.movil-offcanvas-link.active { color: #fff; background: rgba(173,14,11,.25); border-left-color: #AD0E0B; }
.offcanvas-footer {
    border-top: 1px solid rgba(255,255,255,.08);
    padding: 8px 0;
}

/* ── Movil header (updated) ── */
.movil-menu-btn {
    background: none; border: none; padding: 6px 8px;
    color: rgba(255,255,255,.8); font-size: 24px; line-height: 1;
    cursor: pointer; border-radius: 8px;
    transition: background .15s ease;
}
.movil-menu-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
