/* ========================================
   MAIN STYLESHEET — REDESIGNED
   Logistik System | Modern Admin UI
   ======================================== */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ========================================
   DESIGN TOKENS / CSS VARIABLES
   ======================================== */

:root {
    /* Brand Colors */
    --primary:       #2563eb;
    --primary-dark:  #1d4ed8;
    --primary-light: #eff6ff;
    --success:       #16a34a;
    --success-light: #f0fdf4;
    --danger:        #dc2626;
    --danger-light:  #fef2f2;
    --warning:       #d97706;
    --warning-light: #fffbeb;
    --info:          #0891b2;

    /* Neutrals */
    --gray-50:   #f8fafc;
    --gray-100:  #f1f5f9;
    --gray-200:  #e2e8f0;
    --gray-300:  #cbd5e1;
    --gray-400:  #94a3b8;
    --gray-500:  #64748b;
    --gray-600:  #475569;
    --gray-700:  #334155;
    --gray-800:  #1e293b;
    --gray-900:  #0f172a;

    /* Sidebar */
    --sidebar-bg:      #0f172a;
    --sidebar-hover:   rgba(255, 255, 255, 0.06);
    --sidebar-active:  rgba(37, 99, 235, 0.18);
    --sidebar-border:  rgba(255, 255, 255, 0.07);
    --sidebar-width:   260px;

    /* Layout */
    --content-bg:     #f1f5f9;
    --card-bg:        #ffffff;
    --border-color:   #e2e8f0;
    --radius-sm:      8px;
    --radius-md:      12px;
    --radius-lg:      16px;
    --radius-xl:      20px;

    /* Shadows */
    --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md:  0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
    --shadow-lg:  0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.05);
    --shadow-xl:  0 20px 25px rgba(0,0,0,0.1), 0 8px 10px rgba(0,0,0,0.06);

    /* Transitions */
    --transition-fast: all 0.15s ease;
    --transition-base: all 0.2s ease;
    --transition-slow: all 0.3s ease;
}

/* ========================================
   BASE RESET
   ======================================== */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--content-bg);
    color: var(--gray-800);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   SIDEBAR
   ======================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: white;
    transition: var(--transition-slow);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sidebar-border);
}

/* --- Sidebar Header --- */
.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

/* --- Sidebar Menu --- */
.sidebar-menu {
    padding: 0.75rem 0.75rem;
    flex-grow: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-track { background: transparent; }
.sidebar-menu::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.12);
    border-radius: 10px;
}

.menu-section-title {
    color: var(--gray-500);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 1.25rem 0.5rem 0.4rem;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.75rem;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    font-size: 0.875rem;
    font-weight: 500;
    gap: 0.6rem;
    border-left: none;
}

.nav-link:hover {
    background-color: var(--sidebar-hover);
    color: rgba(255,255,255,0.92);
}

.nav-link.active {
    background-color: var(--sidebar-active);
    color: #93c5fd;
    font-weight: 600;
}

.nav-link i {
    font-size: 1rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    margin-right: 0;
}

/* --- Sidebar Sub-menu --- */
.collapse.list-unstyled .nav-link {
    padding-left: 2.5rem;
    font-size: 0.825rem;
    color: rgba(255,255,255,0.55);
}

.collapse.list-unstyled .nav-link:hover,
.collapse.list-unstyled .nav-link.active {
    color: rgba(255,255,255,0.85);
    background-color: var(--sidebar-hover);
}

/* --- Sidebar User --- */
.sidebar-user {
    padding: 0.75rem;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-user .dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: var(--transition-fast);
    font-size: 0.875rem;
    width: 100%;
}

.sidebar-user .dropdown-toggle:hover {
    background: var(--sidebar-hover);
    color: white;
}

.sidebar-user .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    color: white;
}

/* ========================================
   HAMBURGER & OVERLAY
   ======================================== */

.hamburger-menu {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1001;
    background: var(--gray-900);
    color: white;
    border: none;
    padding: 0.4rem 0.55rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: var(--shadow-md);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0,0,0,0.45);
    z-index: 999;
    backdrop-filter: blur(2px);
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
    margin-left: var(--sidebar-width);
    padding: 0;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* --- Content Header / Top Bar --- */
.content-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 998;
    box-shadow: var(--shadow-xs);
}

.content-header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    letter-spacing: -0.3px;
}

.content-header .user-info {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* --- Content Body --- */
.content-body {
    padding: 1.5rem 1.75rem;
    flex: 1;
}

/* Backwards compat: if pages use block content directly */
.main-content > div:not(.content-header):not(.content-body) {
    padding: 1.5rem 1.75rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .sidebar-overlay.active {
        display: block;
    }
    .hamburger-menu {
        display: block;
    }
    .main-content {
        margin-left: 0;
    }
    .content-header {
        padding-left: 4.25rem;
        position: sticky;
        top: 0;
        border-radius: 0;
    }
    .sidebar.active .sidebar-header {
        padding-left: 1rem;
    }
}

@media (max-width: 767px) {
    body { font-size: 13px; }
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        padding: 0.85rem 1rem 0.85rem 4rem;
    }
    .content-header h1 { font-size: 1.05rem; }
    .sidebar { width: 270px; }
    .main-content > div:not(.content-header):not(.content-body) {
        padding: 1rem;
    }
}

@media (max-width: 479px) {
    .content-header {
        padding: 0.75rem 0.75rem 0.75rem 3.75rem;
    }
}

/* ========================================
   UTILITY
   ======================================== */

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   PRINT
   ======================================== */

@media print {
    .sidebar, .hamburger-menu, .content-header { display: none; }
    .main-content { margin-left: 0; padding: 0; }
}

/* ========================================
   ANIMATIONS & TRANSITIONS
   ======================================== */

.btn i, .sidebar-menu a i {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-block;
}
.btn:hover i { transform: scale(1.15); }
.sidebar-menu a:hover i { transform: translateX(2px); }

.card {
    transition: var(--transition-base);
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg) !important;
}

.btn {
    transition: var(--transition-base);
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.table-hover tbody tr {
    transition: background-color 0.15s ease;
}
.table-hover tbody tr:hover {
    background-color: var(--primary-light);
}

/* ========================================
   PAGE TRANSITION OVERLAY
   ======================================== */

.page-transition-overlay {
    position: fixed;
    inset: 0;
    background: #ffffff;
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.page-transition-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loader-logo {
    max-width: 100px;
    height: auto;
    animation: pulse 1.5s infinite ease-in-out;
    margin-bottom: 20px;
}

.loader-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--gray-200);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

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

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

/* ========================================
   CUSTOM SCROLLBAR (GLOBAL)
   ======================================== */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
