/**
 * Custom CSS - TransLogistik Pro
 * Modern UI for Logistics & Freight Management System
 */

:root {
    --tl-primary: #1e3a8a;
    --tl-primary-hover: #1e40af;
    --tl-primary-dark: #0f172a;
    --tl-accent: #0284c7;
    --tl-sidebar-bg: #0b1329;
    --tl-sidebar-text: #94a3b8;
    --tl-sidebar-active: #38bdf8;
    --tl-body-bg: #f8fafc;
    --tl-card-border: #e2e8f0;
    --tl-sidebar-width: 270px;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--tl-body-bg);
    color: #1e293b;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Sidebar Wrapper */
#sidebar-wrapper {
    min-height: 100vh;
    width: var(--tl-sidebar-width);
    background-color: var(--tl-sidebar-bg);
    color: var(--tl-sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, margin-left;
}

/* Custom Scrollbar for Sidebar */
#sidebar-wrapper::-webkit-scrollbar {
    width: 5px;
}
#sidebar-wrapper::-webkit-scrollbar-track {
    background: transparent;
}
#sidebar-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.sidebar-brand {
    padding: 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand a {
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb, #0284c7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    flex-shrink: 0;
}

.sidebar-heading {
    padding: 1.1rem 1.25rem 0.4rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #64748b;
}

.sidebar-nav {
    list-style: none;
    padding: 0.5rem 0.75rem;
    margin: 0;
}

.sidebar-nav .nav-item {
    margin-bottom: 3px;
}

.sidebar-nav .nav-link {
    color: var(--tl-sidebar-text);
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    color: #64748b;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.07);
}

.sidebar-nav .nav-link:hover i {
    color: var(--tl-sidebar-active);
}

.sidebar-nav .nav-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.28), rgba(2, 132, 199, 0.28));
    border-left: 3px solid var(--tl-sidebar-active);
    font-weight: 600;
}

.sidebar-nav .nav-link.active i {
    color: var(--tl-sidebar-active);
}

/* Page Content Wrapper */
#page-content-wrapper {
    margin-left: var(--tl-sidebar-width);
    width: calc(100% - var(--tl-sidebar-width));
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* DESKTOP SIDEBAR COLLAPSE / HIDE */
@media (min-width: 992px) {
    body.sidebar-collapsed #sidebar-wrapper {
        transform: translateX(-100%);
    }

    body.sidebar-collapsed #page-content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* MOBILE OFF-CANVAS DRAWER (< 992px) */
@media (max-width: 991.98px) {
    #sidebar-wrapper {
        transform: translateX(-100%);
        box-shadow: none;
    }

    #sidebar-wrapper.show {
        transform: translateX(0);
        box-shadow: 6px 0 30px rgba(0, 0, 0, 0.4);
    }

    #page-content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* Mobile Sidebar Backdrop Overlay */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(11, 19, 41, 0.65);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 1035;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* Top Navbar */
.top-navbar {
    background-color: #ffffff;
    border-bottom: 1px solid var(--tl-card-border);
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

#sidebarToggle {
    transition: all 0.2s ease;
}
#sidebarToggle:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    transform: scale(1.04);
}
#sidebarToggle:active {
    transform: scale(0.96);
}

/* Cards */
.card-custom {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--tl-card-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-custom:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.card-custom .card-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--tl-card-border);
    padding: 1.1rem 1.25rem;
    font-weight: 600;
}

/* Stat KPI Cards */
.stat-card {
    border-radius: 12px;
    padding: 1.25rem;
    background: #ffffff;
    border: 1px solid var(--tl-card-border);
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

/* Timeline Tracking */
.tracking-timeline {
    position: relative;
    padding-left: 30px;
}

.tracking-timeline::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 11px;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #2563eb;
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 2px #2563eb;
}

.timeline-item.completed::before {
    background: #10b981;
    box-shadow: 0 0 0 2px #10b981;
}

/* Print Styles */
@media print {
    #sidebar-wrapper,
    #sidebar-backdrop,
    .top-navbar,
    .no-print,
    .btn,
    footer {
        display: none !important;
    }

    #page-content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 0 !important;
    }

    body {
        background-color: #ffffff !important;
        color: #000000 !important;
    }

    .print-sheet {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        width: 100% !important;
    }
}
