/* Portal de clientes V&G — estilos compartidos (_LayoutPortal + páginas) */
:root {
    --portal-bg: #f1f5f9;
    --portal-surface: #ffffff;
    --portal-text: #0f172a;
    --portal-muted: #64748b;
    --portal-border: #e2e8f0;
    --portal-nav-bg: #0f172a;
    --portal-nav-border: rgba(148, 163, 184, 0.15);
    --portal-accent: #38bdf8;
    --portal-accent-2: #2563eb;
}

body {
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    background: var(--portal-bg);
    color: var(--portal-text);
    margin: 0;
    min-height: 100vh;
    padding-bottom: 72px;
}

@media (min-width: 769px) {
    body {
        padding-bottom: 0;
    }
}

/* ——— Top navigation ——— */
.portal-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 56px;
    padding: 0 14px;
    background: linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
    border-bottom: 1px solid var(--portal-nav-border);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.nav-left {
    flex-shrink: 0;
}

.nav-left a {
    color: #f1f5f9;
}

.nav-logo {
    height: 34px;
    width: auto;
    object-fit: contain;
}

.nav-brand {
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
    color: #f8fafc;
}

.nav-center-links {
    display: none;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

@media (min-width: 769px) {
    .nav-center-links {
        display: flex;
    }
}

.nav-link-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s, background 0.2s;
}

.nav-link-item:hover {
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.12);
}

.nav-link-item.active {
    color: var(--portal-accent);
    background: rgba(56, 189, 248, 0.12);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #cbd5e1;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.1);
}

.nav-name {
    font-weight: 700;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.desktop-only {
    display: none;
}

@media (min-width: 769px) {
    .desktop-only {
        display: flex;
    }
}

.hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 42px;
    height: 42px;
    padding: 0 10px;
    border: none;
    border-radius: 12px;
    background: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
    cursor: pointer;
    transition: background 0.2s;
}

.hamburger-btn:hover {
    background: rgba(56, 189, 248, 0.2);
}

.hamburger-label {
    font-size: 0.75rem;
    font-weight: 700;
}

@media (min-width: 769px) {
    .hamburger-btn {
        display: none;
    }
}

/* Slide menu */
.slide-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: min(300px, 92vw);
    height: 100vh;
    background: #0f172a;
    z-index: 300;
    transform: translateX(100%);
    transition: transform 0.28s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.35);
    border-left: 1px solid var(--portal-nav-border);
}

.slide-menu.open {
    transform: translateX(0);
}

.slide-menu-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--portal-nav-border);
}

.slide-menu-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.slide-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.slide-menu-item:hover {
    background: rgba(56, 189, 248, 0.08);
    color: #f1f5f9;
}

.slide-menu-item.active {
    color: var(--portal-accent);
    background: rgba(56, 189, 248, 0.1);
    border-left: 3px solid var(--portal-accent);
}

.slide-menu-divider {
    height: 1px;
    margin: 8px 16px;
    background: var(--portal-nav-border);
}

.slide-menu-logout {
    color: #f87171 !important;
}

.slide-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 250;
    opacity: 0;
    transition: opacity 0.25s;
}

.slide-menu-overlay.open {
    display: block;
    opacity: 1;
}

/* Mobile bottom tabs */
.mobile-tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    min-height: 60px;
    padding: 6px 4px env(safe-area-inset-bottom, 8px);
    background: var(--portal-surface);
    border-top: 1px solid var(--portal-border);
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
}

@media (min-width: 769px) {
    .mobile-tab-bar {
        display: none;
    }
}

.mobile-tab-bar .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.6rem;
    font-weight: 700;
    color: #94a3b8;
    text-decoration: none;
    padding: 6px 4px;
    border-radius: 10px;
    transition: color 0.2s, background 0.2s;
}

.mobile-tab-bar .tab-item i {
    font-size: 1.15rem;
}

.mobile-tab-bar .tab-item.active {
    color: var(--portal-accent-2);
    background: rgba(37, 99, 235, 0.08);
}

/* Main content */
.portal-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 14px 24px;
}

/* Page header block */
.portal-header {
    margin-bottom: 1rem;
}

.portal-header h1 {
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.portal-header h1 i {
    color: var(--portal-accent-2);
}

.greeting {
    font-size: 0.82rem;
    color: var(--portal-muted);
}

.greeting strong {
    color: var(--portal-text);
}

/* Stats row */
.stats-row {
    display: grid;
    gap: 10px;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: 14px;
    padding: 12px 14px;
    text-align: center;
    border-top: 3px solid var(--portal-border);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.stat-card.active {
    border-top-color: var(--portal-accent);
}

.stat-card.delivered {
    border-top-color: #16a34a;
}

.stat-card.total {
    border-top-color: #6366f1;
}

.stat-icon {
    font-size: 1.25rem;
    color: var(--portal-accent-2);
    margin-bottom: 4px;
}

.stat-card.delivered .stat-icon {
    color: #16a34a;
}

.stat-card.total .stat-icon {
    color: #6366f1;
}

.stat-num {
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--portal-text);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--portal-muted);
    margin-top: 4px;
}

/* Search bar */
.search-bar {
    position: relative;
    margin-bottom: 12px;
}

.search-bar i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.95rem;
    pointer-events: none;
}

.search-bar input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--portal-border);
    border-radius: 12px;
    font-size: 0.85rem;
    background: var(--portal-surface);
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
}

.search-bar input:focus {
    border-color: var(--portal-accent-2);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Filter tabs */
.filter-tabs-wrap {
    margin-bottom: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: -4px;
    margin-right: -4px;
    padding-bottom: 4px;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: min-content;
    padding: 4px;
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 8px 12px;
    border: 1px solid var(--portal-border);
    border-radius: 999px;
    background: var(--portal-surface);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--portal-muted);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-tab:hover {
    border-color: #cbd5e1;
    color: var(--portal-text);
}

.filter-tab.active {
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.filter-tab .tab-count {
    font-size: 0.62rem;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    font-weight: 800;
}

.filter-tab.active .tab-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* Estado tab accents */
.filter-tab.tab-recibido i {
    color: #0ea5e9;
}
.filter-tab.tab-registrado i {
    color: #6366f1;
}
.filter-tab.tab-procesado i {
    color: #d97706;
}
.filter-tab.tab-asignado i {
    color: #ea580c;
}
.filter-tab.tab-enruta i {
    color: #2563eb;
}
.filter-tab.tab-encasillero i {
    color: #9333ea;
}
.filter-tab.tab-ensucursal i {
    color: #db2777;
}
.filter-tab.tab-entregado i {
    color: #16a34a;
}
.filter-tab.tab-pagado i {
    color: #ca8a04;
}
.filter-tab.tab-noretirado i {
    color: #dc2626;
}
.filter-tab.tab-devuelto i {
    color: #64748b;
}
.filter-tab.tab-anulado i {
    color: #6b7280;
}

/* Package list */
.pkg-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pkg-card {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: 14px;
    padding: 12px 14px;
    cursor: pointer;
    transition: border 0.2s, box-shadow 0.2s, opacity 0.2s;
    position: relative;
    overflow: hidden;
}

.pkg-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 14px 0 0 14px;
    background: #cbd5e1;
}

.pkg-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.08);
}

.pkg-card.estado-recibido::before {
    background: #38bdf8;
}
.pkg-card.estado-registrado::before {
    background: #818cf8;
}
.pkg-card.estado-procesado::before {
    background: #f59e0b;
}
.pkg-card.estado-asignado::before {
    background: #fb923c;
}
.pkg-card.estado-enruta::before {
    background: #2563eb;
}
.pkg-card.estado-encasillero::before {
    background: #c084fc;
}
.pkg-card.estado-ensucursal::before {
    background: #e879f9;
}
.pkg-card.estado-entregado::before {
    background: #16a34a;
}
.pkg-card.estado-pagado::before {
    background: #16a34a;
}
.pkg-card.estado-noretirado::before {
    background: #ef4444;
}
.pkg-card.estado-devuelto::before {
    background: #64748b;
}
.pkg-card.estado-anulado::before {
    background: #6b7280;
}

.pkg-estado {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 8px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-recibido {
    background: #e0f2fe;
    color: #0369a1;
}
.badge-registrado {
    background: #e0e7ff;
    color: #4338ca;
}
.badge-procesado {
    background: #fef3c7;
    color: #b45309;
}
.badge-asignado {
    background: #ffedd5;
    color: #c2410c;
}
.badge-enruta {
    background: #dbeafe;
    color: #1d4ed8;
}
.badge-encasillero {
    background: #f3e8ff;
    color: #7e22ce;
}
.badge-ensucursal {
    background: #fce7f3;
    color: #be185d;
}
.badge-entregado {
    background: #dcfce7;
    color: #15803d;
}
.badge-pagado {
    background: #fef9c3;
    color: #a16207;
}
.badge-noretirado {
    background: #fee2e2;
    color: #dc2626;
}
.badge-devuelto {
    background: #f1f5f9;
    color: #475569;
}
.badge-anulado {
    background: #f1f5f9;
    color: #64748b;
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--portal-muted);
    background: var(--portal-surface);
    border: 1px dashed var(--portal-border);
    border-radius: 16px;
}

.empty-state i {
    font-size: 3rem;
    color: rgba(37, 99, 235, 0.15);
    display: block;
    margin-bottom: 12px;
}

.empty-state h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    color: var(--portal-text);
}

.empty-state p {
    margin: 0;
    font-size: 0.85rem;
}

/* Tracking modal detail */
.tracking-modal .modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
}

.pkg-detail-header {
    margin-bottom: 16px;
}

.pkg-detail-rastreo {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--portal-text);
    margin-bottom: 6px;
}

.pkg-detail-dest {
    font-size: 0.8rem;
    color: var(--portal-muted);
}

.timeline {
    position: relative;
    margin: 16px 0;
    padding-left: 8px;
}

.timeline-step {
    display: flex;
    gap: 12px;
    margin-bottom: 4px;
    position: relative;
}

.timeline-step:not(:last-child) .timeline-dot::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    width: 2px;
    height: calc(100% + 8px);
    background: #e2e8f0;
}

.timeline-step.completed .timeline-dot::after {
    background: #86efac;
}

.timeline-dot {
    position: relative;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    background: #f1f5f9;
    color: #94a3b8;
    border: 2px solid #e2e8f0;
}

.timeline-dot.completed {
    background: #dcfce7;
    color: #16a34a;
    border-color: #86efac;
}

.timeline-dot.current {
    background: #dbeafe;
    color: #2563eb;
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.timeline-dot.pending {
    background: #f8fafc;
    color: #cbd5e1;
}

.timeline-content {
    padding-bottom: 14px;
    flex: 1;
}

.timeline-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--portal-text);
}

.timeline-desc {
    font-size: 0.72rem;
    color: var(--portal-muted);
    margin-top: 2px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.detail-item {
    background: #f8fafc;
    border: 1px solid var(--portal-border);
    border-radius: 10px;
    padding: 8px 10px;
}

.detail-item .label {
    font-size: 0.67rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
}

.detail-item .value {
    font-size: 0.78rem;
    font-weight: 600;
    color: #1e293b;
    margin-top: 4px;
    word-break: break-word;
}

/* Dark mode */
body.dark-mode {
    --portal-bg: #0b1220;
    --portal-surface: #111827;
    --portal-text: #f1f5f9;
    --portal-muted: #94a3b8;
    --portal-border: rgba(148, 163, 184, 0.2);
}

body.dark-mode .stat-card,
body.dark-mode .pkg-card,
body.dark-mode .filter-tab,
body.dark-mode .search-bar input,
body.dark-mode .detail-item {
    background: #111827;
    border-color: var(--portal-border);
}

body.dark-mode .filter-tab {
    color: #94a3b8;
}

body.dark-mode .filter-tab.active {
    color: #fff;
}

body.dark-mode .mobile-tab-bar {
    background: #111827;
    border-top-color: var(--portal-border);
}

body.dark-mode .mobile-tab-bar .tab-item {
    color: #64748b;
}

body.dark-mode .mobile-tab-bar .tab-item.active {
    color: var(--portal-accent);
    background: rgba(56, 189, 248, 0.1);
}

body.dark-mode #notifPanel {
    background: #1e293b !important;
    border-color: var(--portal-border) !important;
    color: #e2e8f0 !important;
}

body.dark-mode #notifPanel #notifList,
body.dark-mode #notifPanel #notifList div {
    color: #cbd5e1 !important;
}

body.dark-mode #notifPanel div[style*="border-bottom:1px solid #f1f5f9"] {
    border-bottom-color: #334155 !important;
}

body.dark-mode #modalAlertaRoja .modal-content,
body.dark-mode #modalAlertaVerde .modal-content {
    background: #111827 !important;
    color: #e5e7eb !important;
}

body.dark-mode #modalAlertaRoja .modal-body,
body.dark-mode #modalAlertaVerde .modal-body {
    color: #e5e7eb !important;
}

body.dark-mode .timeline-dot::after {
    background: #334155 !important;
}

body.dark-mode .timeline-step.completed .timeline-dot::after {
    background: #166534 !important;
}

/* === V&G ANIMATIONS FALLBACK === */
.vyg-anim-container{display:flex;align-items:center;justify-content:center;margin:0 auto}
.vyg-anim-sm{width:40px;height:40px}
.vyg-anim-md{width:120px;height:120px}
.vyg-anim-lg{width:200px;height:200px}

/* Spinner profesional */
.vyg-spinner{position:relative;width:64px;height:64px;margin:0 auto}
.vyg-spinner::before,.vyg-spinner::after,.vyg-spinner{content:'';display:block;border-radius:50%;border:3px solid transparent}
.vyg-spinner{border-top-color:#2563eb;animation:spin 1s linear infinite}
.vyg-spinner::before{position:absolute;inset:4px;border-top-color:#0ea5e9;animation:spin 1.5s linear infinite reverse}
.vyg-spinner::after{position:absolute;inset:10px;border-top-color:#16a34a;animation:spin 2s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* Success */
.vyg-success{width:64px;height:64px;margin:0 auto;position:relative}
.vyg-success svg{width:100%;height:100%}
.vyg-success circle{fill:none;stroke:#16a34a;stroke-width:3;stroke-linecap:round;animation:succCircle .5s ease-in-out forwards}
.vyg-success path{fill:none;stroke:#16a34a;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:48;stroke-dashoffset:48;animation:succPath .6s .3s ease forwards}
@keyframes succCircle{from{stroke-dasharray:0 166}to{stroke-dasharray:166 166}}
@keyframes succPath{to{stroke-dashoffset:0}}

/* Error */
.vyg-error{width:64px;height:64px;margin:0 auto;position:relative}
.vyg-error svg{width:100%;height:100%}
.vyg-error circle{fill:none;stroke:#dc2626;stroke-width:3;stroke-linecap:round;animation:errCircle .5s ease-in-out forwards}
.vyg-error path{fill:none;stroke:#dc2626;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:40;stroke-dashoffset:40;animation:errPath .5s .3s ease forwards}
.vyg-error path:nth-child(3){animation-delay:.45s}
@keyframes errCircle{from{stroke-dasharray:0 166}to{stroke-dasharray:166 166}}
@keyframes errPath{to{stroke-dashoffset:0}}

/* Empty */
.vyg-empty{text-align:center;padding:20px;color:var(--portal-muted)}
.vyg-empty-icon{font-size:3.5rem;display:block;margin-bottom:12px;opacity:.6;animation:floatBox 3s ease-in-out infinite}
@keyframes floatBox{0%,100%{transform:translateY(0)}50%{transform:translateY(-8px)}}

/* Loading overlay */
.vyg-loading-overlay{position:absolute;inset:0;background:rgba(255,255,255,.92);display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:50;border-radius:inherit;backdrop-filter:blur(4px)}
.vyg-loading-overlay .vyg-anim-container{margin-bottom:8px}
