/* ============================================================
   EcuaCourier 2026 — Estilos globales
   Archivo : assets/css/app.css
   ============================================================ */

/* ------------------------------------------------------------
   VARIABLES
   ------------------------------------------------------------ */
:root {
    --color-primary:       #15243e;
    --color-accent:        #e8932a;
    --color-topbar-bg:     #e5e9f4;
    --color-topbar-border: #e5e9f4;
    --color-content-bg:    #f4f6fb;
    --color-sidebar-bg:    #15243e;
    --color-sidebar-dark:  #0c1627;
    --color-card-border:   #e8edf3;
    --sidebar-width:       250px;
    --sidebar-collapsed:   56px;
    --navbar-height:       54px;
}

/* ------------------------------------------------------------
   RESET BASE
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

body {
    background-color: var(--color-content-bg);
    padding-top: var(--navbar-height);
    font-size: 0.875rem;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #334155;
}

/* ------------------------------------------------------------
   NAVBAR / TOPBAR
   ------------------------------------------------------------ */
#navbar-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--color-topbar-bg);
    border-bottom: 0.5px solid var(--color-topbar-border);
    display: flex;
    align-items: center;
    padding: 0;
    z-index: 1050;
    gap: 0;
}

/* ------------------------------------------------------------
   LOGO AREA (parte del navbar, fondo oscuro)
   ------------------------------------------------------------ */
#nav-logo-area {
    background: #0c1627;
    display: flex;
    align-items: center;
    height: var(--navbar-height);
    width: var(--sidebar-width);
    overflow: hidden;
    flex-shrink: 0;
    padding: 0 20px;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

#nav-logo-area.sidebar-collapsed {
    width: var(--sidebar-collapsed);
    padding: 0;
    justify-content: center;
}

.logo-full {
    display: flex;
    align-items: center;
    white-space: nowrap;
    width: 100%;
}

.logo-icon {
    width: 28px;
    height: 28px;
    background: var(--color-accent);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    font-weight: 800;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.logo-text {
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: -0.3px;
}

.logo-text span { color: var(--color-accent); }

.logo-mini {
    display: none;
    align-items: center;
    justify-content: center;
}

.logo-mini-icon {
    width: 30px;
    height: 30px;
    background: var(--color-accent);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    font-weight: 800;
}

#nav-logo-area.sidebar-collapsed .logo-full { display: none; }
#nav-logo-area.sidebar-collapsed .logo-mini { display: flex; }

/* ------------------------------------------------------------
   TOGGLE BUTTON
   ------------------------------------------------------------ */
#sidebar-toggle {
    width: 36px;
    height: 36px;
    border-radius: 7px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
    transition: background 0.15s;
    margin: 0 12px;
}

#sidebar-toggle:hover { background: #e8edf3; }

.toggle-bar {
    width: 14px;
    height: 1.5px;
    background: #64748b;
    border-radius: 2px;
    transition: all 0.25s;
}

.toggle-bar.mid { width: 10px; }

/* ------------------------------------------------------------
   TOPBAR — TÍTULO DE PÁGINA
   ------------------------------------------------------------ */
.nav-divider {
    width: 0.5px;
    height: 24px;
    background: var(--color-topbar-border);
    flex-shrink: 0;
}

#nav-page-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-primary);
    padding-left: 14px;
    white-space: nowrap;
}

/* ------------------------------------------------------------
   TOPBAR — ZONA DERECHA
   ------------------------------------------------------------ */
#nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 14px;
}

.nav-sep {
    width: 0.5px;
    height: 20px;
    background: var(--color-topbar-border);
}

/* Círculo ícono — mismo estilo para fullscreen y usuario */
.nav-icon-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
    text-decoration: none;
}

.nav-icon-circle:hover {
    background: #eef2f7;
    border-color: #cbd5e1;
}

.nav-icon-circle svg {
    width: 17px;
    height: 17px;
    stroke: #64748b;
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Botón usuario: texto + círculo ícono */
#nav-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 4px 10px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s;
}

#nav-user-btn:hover { background: #eef2f7; }

.nav-user-info { text-align: right; }

.nav-user-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary);
    line-height: 1.2;
    white-space: nowrap;
}

.nav-user-rol {
    font-size: 10.5px;
    color: #94a3b8;
    line-height: 1.2;
}

/* ------------------------------------------------------------
   DROPDOWN USUARIO
   ------------------------------------------------------------ */
#user-dropdown {
    position: fixed;
    top: calc(var(--navbar-height) + 4px);
    right: 12px;
    width: 224px;
    background: #fff;
    border-radius: 12px;
    border: 0.5px solid #e2e8f0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
    z-index: 1060;
    overflow: hidden;
    display: none;
}

#user-dropdown.open { display: block; }

.ud-header {
    background: var(--color-primary);
    padding: 16px;
}

.ud-rol {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 3px;
}

.ud-name {
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

.ud-body { padding: 8px; }

.ud-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 7px;
    color: #475569;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

.ud-item:hover { background: #f4f6f9; }

.ud-item svg {
    width: 16px;
    height: 16px;
    stroke: #94a3b8;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.ud-divider {
    height: 0.5px;
    background: #f1f5f9;
    margin: 4px 0;
}

.ud-item.danger { color: #ef4444; }
.ud-item.danger svg { stroke: #ef4444; }
.ud-item.danger:hover { background: #fef2f2; }

/* ------------------------------------------------------------
   LAYOUT PRINCIPAL
   ------------------------------------------------------------ */
#wrapper {
    display: flex;
    min-height: calc(100vh - var(--navbar-height));
}

/* ------------------------------------------------------------
   SIDEBAR
   ------------------------------------------------------------ */
#sidebar {
    background: linear-gradient(180deg, #0c1627 0%, #15243e 100%);
    width: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    position: sticky;
    top: var(--navbar-height);
    height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

#sidebar.sidebar-collapsed { width: var(--sidebar-collapsed); }

/* Scrollbar sutil — visible pero discreto */
#sidebar {
    scrollbar-width: thin;
    scrollbar-color: #3a4354 transparent;
}
#sidebar::-webkit-scrollbar { width: 5px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb {
    background: #3a4354;
    border-radius: 3px;
}
#sidebar::-webkit-scrollbar-thumb:hover { background: #505c71; }

/* Sidebar móvil */
/* Logo dentro del sidebar — solo en móvil */
.sidebar-mobile-logo {
    display: none;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}

@media (max-width: 991.98px) {

    #nav-clock { display: none !important; }
    #fs-btn    { display: none !important; }

    /* Logo en topbar oculto en móvil */
    #nav-logo-area { display: none !important; }

    /* Logo dentro del sidebar visible en móvil */
    .sidebar-mobile-logo { display: block; }
    #sidebar.sidebar-collapsed .sidebar-mobile-logo { display: block; }

    /* Sidebar fijo, oculto por defecto */
    #sidebar {
        position: fixed;
        top: var(--navbar-height);
        left: 0;
        width: var(--sidebar-width) !important;
        transform: translateX(-100%);
        z-index: 1045;
        box-shadow: 4px 0 20px rgba(0,0,0,.2);
        transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
    }
    #sidebar.sidebar-open { transform: translateX(0); }

    /* Cuando abierto en móvil — forzar modo expandido completo */
    #sidebar.sidebar-open,
    #sidebar.sidebar-open.sidebar-collapsed {
        width: var(--sidebar-width) !important;
    }
    #sidebar.sidebar-open .nav-section,
    #sidebar.sidebar-open.sidebar-collapsed .nav-section {
        opacity: 1 !important;
        height: auto !important;
        padding: 16px 16px 4px !important;
    }
    #sidebar.sidebar-open .nav-item,
    #sidebar.sidebar-open.sidebar-collapsed .nav-item {
        justify-content: flex-start !important;
        padding: 11px 16px !important;
        font-size: 16px !important;
        gap: 12px !important;
    }
    #sidebar.sidebar-open .nav-icon,
    #sidebar.sidebar-open.sidebar-collapsed .nav-item .nav-icon {
        width: 18px !important;
        font-size: 1rem !important;
        opacity: .85 !important;
    }
    #sidebar.sidebar-open .nav-label,
    #sidebar.sidebar-open.sidebar-collapsed .nav-label {
        opacity: 1 !important;
        width: auto !important;
        overflow: visible !important;
    }
    #sidebar.sidebar-open .sb-info,
    #sidebar.sidebar-open.sidebar-collapsed .sb-info {
        opacity: 1 !important;
        width: auto !important;
        overflow: visible !important;
    }
    #sidebar.sidebar-open .nav-arrow,
    #sidebar.sidebar-open.sidebar-collapsed .nav-arrow {
        display: flex !important;
    }
    #sidebar.sidebar-open.sidebar-collapsed .nav-submenu {
        display: block !important;
    }
    #sidebar.sidebar-open .sb-logout,
    #sidebar.sidebar-open.sidebar-collapsed .sb-logout {
        justify-content: flex-start !important;
        padding: 14px 16px !important;
    }
    #sidebar.sidebar-open .sb-logout-label,
    #sidebar.sidebar-open.sidebar-collapsed .sb-logout-label {
        display: block !important;
    }
}


/* ------------------------------------------------------------
   SIDEBAR — USUARIO
   ------------------------------------------------------------ */
.sidebar-user {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    white-space: nowrap;
    height: 52px;
    flex-shrink: 0;
}

.sb-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--color-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.sb-info {
    overflow: hidden;
    transition: opacity 0.15s;
}

#sidebar.sidebar-collapsed .sb-info {
    opacity: 0;
    width: 0;
}

.sb-name {
    color: #fff;
    font-weight: 500;
    font-size: 12px;
}

.sb-rol {
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
}

/* ------------------------------------------------------------
   SIDEBAR — SECCIONES Y MENÚ
   ------------------------------------------------------------ */
.nav-section {
    padding: 16px 16px 4px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    flex-shrink: 0;
    transition: opacity 0.15s, height 0.2s, padding 0.2s;
}

#sidebar.sidebar-collapsed .nav-section {
    opacity: 0;
    height: 0;
    padding: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    margin: 0;
    border-radius: 0;
    border-left: 3px solid transparent;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
    flex-shrink: 0;
    text-decoration: none;
    font-size: 16px;
    background: transparent;
}

.nav-item:hover {
    background: #0c1627;
    border-left-color: #f2f2f2;
    color: #ffffff;
    text-decoration: none;
}

.nav-item.active {
    background: #0c1627;
    border-left-color: #ffb612;
    color: #ffffff;
    font-weight: 500;
}

.nav-icon {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.85;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

.nav-label {
    overflow: hidden;
    transition: opacity 0.15s;
}

#sidebar.sidebar-collapsed .nav-label { opacity: 0; width: 0; }

#sidebar.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 11px 0;
    border-left: 3px solid transparent;
}

#sidebar.sidebar-collapsed .nav-item .nav-icon {
    width: 28px;
    font-size: 1.05rem;
    opacity: 0.8;
}

#sidebar.sidebar-collapsed .nav-item.active {
    border-left-color: #ffb612;
}

#sidebar.sidebar-collapsed .nav-item:hover {
    border-left-color: #f2f2f2;
}

/* ------------------------------------------------------------
   SIDEBAR — FOOTER
   ------------------------------------------------------------ */
.sidebar-footer {
    margin-top: auto;
    padding: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.sb-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: 0;
    border-left: 3px solid transparent;
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-left-color 0.15s;
    margin: 0;
}

.sb-logout:hover {
    background: #0c1627;
    border-left-color: #ef4444;
    color: #fca5a5;
    text-decoration: none;
}

#sidebar.sidebar-collapsed .sb-logout {
    justify-content: center;
    padding: 11px 0;
    border-left: 3px solid transparent;
}

#sidebar.sidebar-collapsed .sb-logout-label { display: none; }

/* ------------------------------------------------------------
   ÁREA DE CONTENIDO
   ------------------------------------------------------------ */
#content {
    flex: 1;
    background: var(--color-content-bg);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Flash messages */
.flash-container { padding: 16px 16px 0; }

/* Padding de contenido de página */
.page-content { padding: 16px; }

/* ------------------------------------------------------------
   CARDS
   ------------------------------------------------------------ */
.card {
    border: 0.5px solid var(--color-card-border);
    box-shadow: none;
    border-radius: 10px;
}

.card-header {
    background: #fff;
    border-bottom: 0.5px solid var(--color-card-border);
    font-weight: 600;
    font-size: 13px;
    color: var(--color-primary);
    padding: 12px 16px;
}

/* Tarjeta de estadística */
.stat-card { background: #fff; border-radius: 10px; padding: 14px; border: 0.5px solid var(--color-card-border); }
.stat-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.stat-label { font-size: 11px; color: #94a3b8; font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--color-primary); line-height: 1; }

/* ------------------------------------------------------------
   TABLAS
   ------------------------------------------------------------ */
.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    white-space: nowrap;
    background: #f8fafc;
    border-bottom: 0.5px solid var(--color-card-border);
}

.table td {
    vertical-align: middle;
    font-size: 0.875rem;
    border-color: #f1f5f9;
}

.table-hover tbody tr:hover td { background-color: #f8fafc; }

/* ------------------------------------------------------------
   BADGES
   ------------------------------------------------------------ */
.badge-rol-superadmin { background: #ede9fe; color: #6d28d9; }
.badge-rol-oficina    { background: #dbeafe; color: #1e40af; }
.badge-rol-agencia    { background: #dcfce7; color: #166534; }
.badge-rol-casillero  { background: #fef3c7; color: #92400e; }
.badge-activo         { background: #dcfce7; color: #166534; }
.badge-inactivo       { background: #fee2e2; color: #991b1b; }

/* ------------------------------------------------------------
   FORMULARIOS
   ------------------------------------------------------------ */
.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.3rem;
}

.form-control, .form-select {
    font-size: 0.875rem;
    border: 0.5px solid #cbd5e1;
    border-radius: 7px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(21, 36, 62, 0.08);
}

/* ------------------------------------------------------------
   BOTONES
   ------------------------------------------------------------ */
.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    font-size: 0.875rem;
}

.btn-primary:hover {
    background: #1e3a5f;
    border-color: #1e3a5f;
}

/* ------------------------------------------------------------
   AVATAR
   ------------------------------------------------------------ */
.avatar-circle {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

/* ------------------------------------------------------------
   ESTADO VACÍO
   ------------------------------------------------------------ */
.estado-vacio {
    text-align: center;
    padding: 3rem 1rem;
    color: #cbd5e1;
}

.estado-vacio i { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; }

/* ------------------------------------------------------------
   MODALES
   ------------------------------------------------------------ */
.modal-header {
    border-bottom: 0.5px solid var(--color-card-border);
    padding: 14px 20px;
}

.modal-footer {
    border-top: 0.5px solid var(--color-card-border);
    padding: 12px 20px;
}

.modal-title { font-size: 14px; font-weight: 600; color: var(--color-primary); }

/* ------------------------------------------------------------
   PAGINACIÓN
   ------------------------------------------------------------ */
.pagination { font-size: 0.8rem; }
.page-link { color: var(--color-primary); border-color: var(--color-card-border); }
.page-item.active .page-link { background: var(--color-primary); border-color: var(--color-primary); }

/* ------------------------------------------------------------
   UTILIDADES
   ------------------------------------------------------------ */
.fs-085 { font-size: 0.85rem; }
.fs-075 { font-size: 0.75rem; }
.cursor-pointer { cursor: pointer; }

/* ------------------------------------------------------------
   RELOJ TOPBAR
   ------------------------------------------------------------ */
#nav-clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
    padding: 0 4px;
}

#nav-clock-hora {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.3px;
    white-space: nowrap;
}

#nav-clock-fecha {
    font-size: 10px;
    color: #94a3b8;
    white-space: nowrap;
}

/* Sidebar hover-expand (temporal, solo cuando está contraído) */
#sidebar:not(.sidebar-collapsed) {
    box-shadow: none;
}
#sidebar.sidebar-hover-shadow {
    box-shadow: 4px 0 16px rgba(0,0,0,0.15);
}

/* ------------------------------------------------------------
   SUBMENÚ SIDEBAR
   ------------------------------------------------------------ */
.nav-parent {
    cursor: pointer;
}

.nav-arrow {
    font-size: 11px;
    opacity: 0.5;
    transition: transform 0.25s ease, opacity 0.15s;
    flex-shrink: 0;
}

.nav-parent.open .nav-arrow,
.nav-submenu.open ~ .nav-parent .nav-arrow {
    transform: rotate(90deg);
    opacity: 0.9;
}

.nav-submenu {
    display: none;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.nav-submenu.open {
    display: flex;
}

.submenu-line {
    width: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin-left: 27px;
    flex-shrink: 0;
}

.submenu-items {
    flex: 1;
    padding: 4px 0;
}

.nav-subitem {
    display: block;
    padding: 9px 16px 9px 20px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
}

.nav-subitem:hover {
    color: #ffffff;
    background: #0c1627;
    text-decoration: none;
    border-left-color: #f2f2f2;
}

.nav-subitem.active {
    color: #ffb612;
    font-weight: 500;
    border-left-color: #ffb612;
    background: #0c1627;
    text-decoration: none;
}

/* Sidebar contraído — ocultar submenús */
#sidebar.sidebar-collapsed .nav-submenu { display: none !important; }
#sidebar.sidebar-collapsed .nav-arrow  { display: none; } 