/* ==========================================================================
   TUNA WAREHOUSE HQ COMMAND CENTER - WEB APPLICATION DESIGN SYSTEM
   ========================================================================== */

:root {
    /* Color Tokens */
    --primary-blue: #2563EB;
    --primary-blue-hover: #1D4ED8;
    --primary-blue-light: rgba(37, 99, 235, 0.12);

    --dark-navy-bg: #0B0F19;
    --sidebar-bg: #0F172A;
    --card-bg: #1E293B;
    --card-border: #334155;
    
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;

    --accent-emerald: #10B981;
    --accent-amber: #F59E0B;
    --accent-rose: #EF4444;
    --accent-purple: #8B5CF6;
    --accent-cyan: #06B6D4;

    --badge-pending-bg: rgba(245, 158, 11, 0.15);
    --badge-pending-text: #F59E0B;
    --badge-transit-bg: rgba(37, 99, 235, 0.15);
    --badge-transit-text: #60A5FA;
    --badge-delivered-bg: rgba(16, 185, 129, 0.15);
    --badge-delivered-text: #34D399;
    --badge-low-bg: rgba(239, 68, 68, 0.15);
    --badge-low-text: #F87171;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --shadow-subtle: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-elevated: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--dark-navy-bg);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   1. APP LAYOUT STRUCTURE
   -------------------------------------------------------------------------- */
.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 20;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--card-border);
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.brand-title-group h1 {
    font-size: 14px;
    font-weight: 700;
    color: #FFF;
    line-height: 1.2;
}

.brand-title-group span {
    font-size: 11px;
    color: var(--primary-blue);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 12px 12px 6px 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-bottom: 3px;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-link.active {
    background-color: var(--primary-blue);
    color: #FFFFFF;
    font-weight: 600;
    box-shadow: 0 4px 12px var(--primary-blue-light);
}

.nav-link i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top Header Bar */
.top-bar {
    height: 64px;
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 10;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--dark-navy-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    width: 340px;
}

.search-box i {
    color: var(--text-muted);
    font-size: 14px;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 13px;
    width: 100%;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.branch-selector-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(37, 99, 235, 0.12);
    border: 1px solid var(--primary-blue);
    color: #60A5FA;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.icon-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    color: var(--text-primary);
    border-color: var(--primary-blue);
}

.icon-btn .badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-rose);
}

.user-profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563EB, #8B5CF6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #FFF;
}

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

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 10px;
    color: var(--text-muted);
}

/* Screen Content Area */
.content-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* --------------------------------------------------------------------------
   2. DASHBOARD & UI COMPONENTS
   -------------------------------------------------------------------------- */

.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title-group h2 {
    font-size: 20px;
    font-weight: 700;
    color: #FFF;
}

.page-title-group p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Primary Action Buttons */
.btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--primary-blue);
    color: #FFF;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px var(--primary-blue-light);
}

.btn-primary:hover {
    background-color: var(--primary-blue-hover);
    transform: translateY(-1px);
}

.btn-outline {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--primary-blue);
}

/* Metric Cards Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-subtle);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--accent-color, var(--primary-blue));
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.metric-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.metric-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background-color: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color, var(--primary-blue));
}

.metric-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.metric-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

/* Data Tables */
.card-table-wrapper {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-subtle);
    margin-bottom: 24px;
}

.table-header-bar {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--card-border);
}

.table-header-bar h3 {
    font-size: 14px;
    font-weight: 700;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.custom-table th, .custom-table td {
    padding: 12px 18px;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
}

.custom-table th {
    background-color: var(--sidebar-bg);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.custom-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.status-badge.pending { background-color: var(--badge-pending-bg); color: var(--badge-pending-text); }
.status-badge.in-transit { background-color: var(--badge-transit-bg); color: var(--badge-transit-text); }
.status-badge.delivered, .status-badge.fulfilled { background-color: var(--badge-delivered-bg); color: var(--badge-delivered-text); }
.status-badge.low, .status-badge.cancelled { background-color: var(--badge-low-bg); color: var(--badge-low-text); }

/* --------------------------------------------------------------------------
   3. MULTI-STEP WIZARD MODALS & OVERLAYS
   -------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background-color: #FFFFFF;
    color: #0F172A;
    width: 660px;
    max-width: 90vw;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-elevated);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #EFF6FF;
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #64748B;
    cursor: pointer;
}

/* Stepper Progress Bar */
.wizard-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background-color: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #E2E8F0;
    color: #64748B;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-item.active .step-number {
    background-color: var(--primary-blue);
    color: #FFFFFF;
}

.step-item.completed .step-number {
    background-color: var(--accent-emerald);
    color: #FFFFFF;
}

.step-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748B;
}

.step-item.active .step-label {
    color: var(--primary-blue);
}

.step-divider {
    flex: 1;
    height: 2px;
    background-color: #E2E8F0;
    margin: 0 10px;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    background-color: #F8FAFC;
    border-top: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

/* Form Controls */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #CBD5E1;
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    color: #0F172A;
}

.form-control:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Option Cards (Radios/Checkboxes) */
.option-card {
    border: 1px solid #E2E8F0;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.option-card:hover, .option-card.selected {
    border-color: var(--primary-blue);
    background-color: #EFF6FF;
}

/* Drawers */
.drawer-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    height: 100%;
    background-color: var(--sidebar-bg);
    border-left: 1px solid var(--card-border);
    box-shadow: var(--shadow-elevated);
    z-index: 90;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.drawer-overlay.active {
    transform: translateX(0);
}

.drawer-header {
    padding: 20px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
