/* ============================================================
   ESTILOS PRINCIPALES - Aldo Cargo Express
   Powered by Agdala 2026
   Diseño moderno con animaciones, sombras y efectos hover.
   ============================================================ */

:root {
    --color-principal: #0D6EFD;
    --color-principal-oscuro: #084298;
    --color-exito: #198754;
    --color-advertencia: #ffc107;
    --color-error: #dc3545;
    --sombra-suave: 0 10px 30px rgba(0, 0, 0, 0.08);
    --sombra-media: 0 15px 40px rgba(13, 110, 253, 0.18);
    --radio: 16px;
}

* {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f6f9ff;
    color: #1f2937;
    overflow-x: hidden;
}

/* ---------- Animaciones globales ---------- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

@keyframes floaty {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

.animate-fadeInUp { animation: fadeInUp 0.7s ease both; }
.animate-fadeIn   { animation: fadeIn 0.8s ease both; }
.animate-float    { animation: floaty 4s ease-in-out infinite; }

.delay-1 { animation-delay: .15s; }
.delay-2 { animation-delay: .3s; }
.delay-3 { animation-delay: .45s; }

/* ---------- Barra superior fija ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
}

.topbar .navbar-brand img {
    height: 46px;
    width: 46px;
    object-fit: contain;
    border-radius: 12px;
}

.topbar .nav-link {
    font-weight: 600;
    color: #334155;
    padding: 0.5rem 1rem !important;
    border-radius: 10px;
    transition: all 0.25s ease;
}

.topbar .nav-link:hover,
.topbar .nav-link.active {
    color: var(--color-principal);
    background: rgba(13, 110, 253, 0.08);
}

.topbar .nav-link i {
    margin-right: 6px;
}

/* ---------- Hero / Banner ---------- */
.hero {
    position: relative;
    background: linear-gradient(135deg, var(--color-principal) 0%, var(--color-principal-oscuro) 100%);
    color: #fff;
    padding: 90px 0 110px;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    width: 480px;
    height: 480px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    top: -160px;
    right: -120px;
}

.hero::after {
    content: '';
    position: absolute;
    width: 320px;
    height: 320px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    bottom: -140px;
    left: -100px;
}

.hero h1 {
    font-weight: 800;
    font-size: clamp(1.9rem, 4vw, 3.1rem);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.hero .lead {
    opacity: 0.92;
}

/* ---------- Buscador (Card flotante) ---------- */
.tracking-card {
    margin-top: -70px;
    background: #fff;
    border-radius: var(--radio);
    box-shadow: var(--sombra-media);
    padding: 30px;
    position: relative;
    z-index: 5;
}

.tracking-input {
    height: 56px;
    font-size: 1.15rem;
    border-radius: 14px;
    border: 2px solid #e2e8f0;
    padding-left: 46px;
    transition: all 0.25s ease;
}

.tracking-input:focus {
    border-color: var(--color-principal);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.15);
}

.input-icon {
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.2rem;
}

/* ---------- Botones ---------- */
.btn {
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.25s ease;
}

.btn-primary {
    background: var(--color-principal);
    border-color: var(--color-principal);
}

.btn-primary:hover {
    background: var(--color-principal-oscuro);
    border-color: var(--color-principal-oscuro);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(13, 110, 253, 0.35);
}

.btn-outline-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(13, 110, 253, 0.25);
}

.btn-lg-rounded {
    height: 56px;
    border-radius: 14px;
    padding: 0 32px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ---------- Tarjetas ---------- */
.card-modern {
    background: #fff;
    border: 0;
    border-radius: var(--radio);
    box-shadow: var(--sombra-suave);
    transition: all 0.3s ease;
}

.card-modern:hover {
    transform: translateY(-6px);
    box-shadow: var(--sombra-media);
}

/* ---------- Tarjetas de estado ---------- */
.estado-card {
    border-radius: var(--radio);
    padding: 34px;
    color: #fff;
    text-align: center;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
    animation: fadeInUp 0.6s ease both;
}

.estado-card .icono {
    font-size: 3.6rem;
    margin-bottom: 14px;
    display: block;
    animation: pulse 2s infinite;
}

.estado-bodega   { background: linear-gradient(135deg, #0d6efd, #0b5ed7); }
.estado-salvador { background: linear-gradient(135deg, #198754, #157347); }
.estado-error    { background: linear-gradient(135deg, #dc3545, #bb2d3b); }

.estado-card .tracking-titulo {
    font-size: 1.15rem;
    opacity: 0.9;
}

.estado-card .tracking-numero {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: 2px;
    word-break: break-all;
}

.estado-card .estado-mensaje {
    font-size: 1.05rem;
    margin-top: 10px;
}

/* ---------- Timeline (historial) ---------- */
.timeline {
    position: relative;
    padding-left: 34px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 4px;
    background: linear-gradient(180deg, var(--color-principal), #cbd5e1);
}

.timeline-item {
    position: relative;
    padding: 14px 0 14px 24px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -28px;
    top: 22px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-principal);
    border: 3px solid #fff;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.2);
}

.timeline-item .accion {
    font-weight: 700;
}

.timeline-item .fecha {
    color: #64748b;
    font-size: 0.85rem;
}

/* ---------- Panel administrativo ---------- */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0b1526, #0d1b33);
    color: #fff;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar .sidebar-header {
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar .sidebar-header img {
    height: 46px;
    width: 46px;
    object-fit: contain;
    border-radius: 12px;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.75);
    font-weight: 600;
    padding: 12px 20px;
    margin: 4px 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.25s ease;
}

.sidebar .nav-link i {
    width: 22px;
    text-align: center;
    font-size: 1.05rem;
}

.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.sidebar .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--color-principal), var(--color-principal-oscuro));
    box-shadow: 0 8px 20px rgba(13, 110, 253, 0.35);
}

.admin-main {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    min-width: 0;
}

.admin-topbar {
    background: #fff;
    border-radius: 14px;
    padding: 12px 20px;
    box-shadow: var(--sombra-suave);
    margin-bottom: 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1039;
}

/* ---------- Estadísticas dashboard ---------- */
.stat-card {
    border-radius: var(--radio);
    border: 0;
    overflow: hidden;
    color: #fff;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18);
}

.stat-card .icono-circulo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
}

.stat-card .valor {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
}

.bg-stat-total    { background: linear-gradient(135deg, #0d6efd, #0a58ca); }
.bg-stat-bodega   { background: linear-gradient(135deg, #0dcaf0, #0aa2c0); }
.bg-stat-transito { background: linear-gradient(135deg, #ffc107, #e6a300); color:#212529; }
.bg-stat-salvador { background: linear-gradient(135deg, #198754, #146c43); }
.bg-stat-entregado{ background: linear-gradient(135deg, #6f42c1, #59359d); }

/* ---------- Tablas ---------- */
.table-modern thead th {
    background: #f1f6ff;
    color: var(--color-principal-oscuro);
    font-weight: 700;
    white-space: nowrap;
}

.table-modern tbody tr {
    transition: background 0.2s ease;
}

.table-modern tbody tr:hover {
    background: #f6faff;
}

.badge-estado {
    padding: 6px 12px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.78rem;
}

/* ---------- Checkbox de estados ---------- */
.checkbox-estado {
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
}

.checkbox-estado:hover {
    border-color: var(--color-principal);
    background: #f1f6ff;
}

.checkbox-estado.activo {
    border-color: var(--color-principal);
    background: rgba(13, 110, 253, 0.07);
    box-shadow: 0 6px 18px rgba(13, 110, 253, 0.12);
}

.checkbox-estado .form-check-input {
    width: 22px;
    height: 22px;
    cursor: pointer;
}

.checkbox-estado .estado-titulo {
    font-weight: 700;
    margin: 0;
}

.checkbox-estado .estado-fecha {
    font-size: 0.82rem;
    color: #64748b;
}

/* ---------- Campo escáner de código de barras ---------- */
.scanner-field {
    font-size: 1.25rem;
    letter-spacing: 1px;
    font-family: 'Courier New', monospace;
    height: 70px;
    border-radius: 14px;
    border: 2px dashed var(--color-principal);
    background: rgba(13, 110, 253, 0.04);
    text-transform: uppercase;
}

.scanner-field:focus {
    background: #fff;
    box-shadow: 0 0 0 5px rgba(13, 110, 253, 0.18);
}

/* ---------- Login ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-principal) 0%, #050d1f 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 440px;
    padding: 40px;
    animation: fadeInUp 0.7s ease both;
}

/* ---------- Loader ---------- */
.loader {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.94);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.loader .spinner {
    width: 64px;
    height: 64px;
    border: 6px solid rgba(13, 110, 253, 0.15);
    border-top-color: var(--color-principal);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader.hidden {
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

/* ---------- Footer ---------- */
.footer-ald {
    background: #0b1526;
    color: #cbd5e1;
    padding: 26px 0;
    margin-top: 60px;
}

.footer-ald a {
    color: #93c5fd;
    text-decoration: none;
}

.footer-ald .brand-footer {
    font-weight: 700;
    color: #fff;
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.show {
        display: block;
    }
    .admin-main {
        margin-left: 0;
        padding: 20px 16px;
    }
}

@media (max-width: 575.98px) {
    .tracking-card { padding: 22px; }
    .estado-card { padding: 26px; }
    .hero { padding: 60px 0 90px; }
}
