/* WMS 3PL Refined Style System */
:root {
    /* Color Palette - Simplified, High-Contrast & Refined */
    --bg-base: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f8fafc;
    --border-color: #cbd5e1;
    
    --primary: #4338ca;
    --primary-hover: #3730a3;
    --primary-light: rgba(67, 56, 202, 0.08);
    
    --secondary: #475569;
    --secondary-hover: #334155;
    
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-inverse: #ffffff;
    
    --success: #059669;
    --success-bg: #dcfce7;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --info: #2563eb;
    --info-bg: #dbeafe;
    
    --font-sans: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --sidebar-width: 260px;
    --glass-blur: 12px;
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 4px;
    --transition-smooth: all 0.2s ease-in-out;
    
    --bg-hover-tint: rgba(15, 23, 42, 0.03);
    --scrollbar-thumb: rgba(15, 23, 42, 0.2);
    --scrollbar-thumb-hover: rgba(15, 23, 42, 0.4);
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --bg-details: #f8fafc;
}

html[data-theme="dark"] {
    --bg-base: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-hover: #334155;
    --border-color: rgba(255, 255, 255, 0.1);
    
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-light: rgba(99, 102, 241, 0.15);
    
    --secondary: #94a3b8;
    --secondary-hover: #cbd5e1;
    
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-inverse: #0f172a;
    
    --success: #34d399;
    --success-bg: rgba(52, 211, 153, 0.12);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.12);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.12);
    --info: #60a5fa;
    --info-bg: rgba(96, 165, 250, 0.12);

    --bg-hover-tint: rgba(255, 255, 255, 0.06);
    --scrollbar-thumb: rgba(255, 255, 255, 0.15);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.3);
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --bg-details: rgba(0, 0, 0, 0.25);
}

/* Base Styles & Typography (Light Text Priority) */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-weight: 300;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

p, span, label, input, select, textarea, button, td, th {
    font-weight: 300;
}

.font-light { font-weight: 300 !important; }
.font-regular { font-weight: 400 !important; }
.font-medium { font-weight: 500 !important; }

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Layout Structure */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition-smooth);
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.brand-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 400;
    color: white;
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
    font-weight: 300;
    font-size: 0.9rem;
}

.nav-item.active a, .nav-item a:hover {
    color: var(--text-main);
    background: var(--bg-hover-tint);
}

.nav-item.active a {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 400;
}

.nav-item.active a i {
    color: var(--primary);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 400;
    font-size: 0.85rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 400;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 300;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100%;
    transition: var(--transition-smooth);
}

/* Top Navbar / Header */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
    position: sticky;
    top: 0;
    z-index: 90;
    backdrop-filter: blur(var(--glass-blur));
}

.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: var(--radius-sm);
}

.mobile-nav-toggle:hover {
    background: var(--bg-hover-tint);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-title h1 {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 0.25rem;
}

.header-title p {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 300;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn-premium, .btn-primary {
    background: var(--primary);
    color: #ffffff;
    border: 1px solid transparent;
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-md);
    font-weight: 400;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.btn-premium:hover, .btn-primary:hover {
    background: var(--primary-hover);
    color: #ffffff;
}

.btn-secondary-outline, .btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-md);
    font-weight: 400;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.btn-secondary-outline:hover, .btn-outline:hover {
    background: var(--bg-hover-tint);
    border-color: var(--text-muted);
}

/* Cards */
.glass-card, .card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: var(--transition-smooth);
}

.glass-card:hover, .card:hover {
    border-color: rgba(15, 23, 42, 0.15);
}

html[data-theme="dark"] .glass-card:hover, 
html[data-theme="dark"] .card:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.metric-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.metric-val {
    font-size: 1.35rem;
    font-weight: 400;
}

.metric-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 300;
}

/* Interactive Filter Bar */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 240px;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    height: 38px;
    padding: 0 0.85rem 0 2.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 300;
    transition: var(--transition-smooth);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-box i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 16px;
    height: 16px;
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-select {
    height: 38px;
    padding: 0 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 300;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Premium Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    -webkit-overflow-scrolling: touch;
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.premium-table th {
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    background: var(--bg-hover-tint);
}

.premium-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    font-weight: 300;
}

.premium-table tbody tr {
    transition: var(--transition-smooth);
}

.premium-table tbody tr:hover {
    background: var(--bg-hover-tint);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.badge-draft, .badge-pending {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-sent, .badge-picking, .badge-in_progress, .badge-allocated {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-accepted, .badge-received, .badge-putaway, .badge-packed, .badge-shipped, .badge-completed {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-rejected, .badge-quarantine, .badge-damaged, .badge-cancelled {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Action Trigger */
.btn-action-trigger {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-smooth);
}

.btn-action-trigger:hover {
    color: var(--text-main);
    background: var(--bg-hover-tint);
}

/* Detail Row */
.details-row {
    background: var(--bg-details);
}

.details-wrapper {
    padding: 1.25rem;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    margin: 0.5rem 1rem 1rem 1rem;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
}

.details-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    font-weight: 400;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease forwards;
}

/* Sidebar Nav Group (Collapsible) */
.nav-group {
    margin-bottom: 0.25rem;
}

.nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
    font-weight: 400;
    font-size: 0.9rem;
    cursor: pointer;
    background: transparent;
    border: 1px solid transparent;
}

.nav-group-toggle:hover {
    color: var(--text-main);
    background: var(--bg-hover-tint);
}

.nav-group-toggle .chevron {
    margin-left: auto;
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease-in-out;
}

.nav-group.expanded .nav-group-toggle {
    color: var(--text-main);
}

.nav-group.expanded .nav-group-toggle .chevron {
    transform: rotate(180deg);
}

.nav-group-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    list-style: none;
    padding-left: 0.75rem; 
    margin-top: 0;
}

.nav-group.expanded .nav-group-menu {
    max-height: 800px;
    margin-top: 0.15rem;
}

.nav-group-menu .nav-item a {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    position: relative;
    border-left: 2px solid transparent;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.nav-group-menu .nav-item a i {
    width: 15px;
    height: 15px;
}

.nav-group-menu .nav-item.active a {
    border-left: 2px solid var(--primary);
    background: var(--primary-light);
    box-shadow: none;
}

/* Responsiveness (Desktop / Tablet / Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 95;
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar-overlay.mobile-open {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .topbar {
        padding: 0.75rem 1.5rem;
        justify-content: space-between;
    }

    .mobile-nav-toggle {
        display: flex;
        align-items: center;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .topbar {
        padding: 0.5rem 1rem;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: none;
    }

    .filter-actions {
        width: 100%;
        justify-content: space-between;
    }


    .filter-select {
        flex: 1;
    }
}

/* Pagination Styling */
nav[role="navigation"], .pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
}

ul.pagination {
    display: inline-flex;
    list-style: none;
    padding-left: 0;
    margin: 0;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

ul.pagination .page-item {
    display: inline-flex;
    margin: 0;
}

ul.pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    text-decoration: none;
    background: transparent;
    border: none;
    border-right: 1px solid var(--border-color);
    transition: var(--transition-smooth);
}

ul.pagination .page-item:last-child .page-link {
    border-right: none;
}

ul.pagination .page-link:hover {
    background: var(--bg-hover-tint);
    color: var(--primary);
}

ul.pagination .page-item.active .page-link {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
}

ul.pagination .page-item.disabled .page-link {
    color: var(--text-muted);
    opacity: 0.4;
    cursor: not-allowed;
}

/* Fallback for standard Laravel Tailwind pagination container */
nav[role="navigation"] div:first-child p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

nav[role="navigation"] div:first-child p span {
    font-weight: 600;
    color: var(--text-main);
}

