/* ==========================================
   eVendy Distributor Portal - Main CSS
   Modern, responsive design system (Vanilla CSS)
   ========================================== */

/* --- CSS Variables & Design Tokens --- */
:root {
    /* Brand Colors */
    --color-primary: #1f1e5a;       /* Deep Unilever Corporate Blue */
    --color-primary-light: #343286; /* Lighter hover blue */
    --color-primary-soft: #ececf7;  /* Soft blue background tint */
    --color-secondary: #00d2c4;     /* Vibrant Electric Teal */
    --color-secondary-dark: #00b4a9;
    --color-accent: #7b2cbf;        /* Deep Violet */
    
    /* Neutral Palette */
    --color-bg-body: #f4f6fb;       /* Soft light blue-gray background */
    --color-bg-card: #ffffff;
    --color-bg-sidebar: #101037;    /* Very dark navy */
    --color-text-main: #1f2937;     /* Cool Gray 800 */
    --color-text-muted: #6b7280;    /* Cool Gray 500 */
    --color-text-light: #9ca3af;    /* Cool Gray 400 */
    
    /* Semantic Status Colors */
    --color-success: #10b981;       /* Emerald Green */
    --color-success-light: #ecfdf5;
    --color-warning: #f59e0b;       /* Amber Gold */
    --color-warning-light: #fefbeb;
    --color-danger: #ef4444;        /* Crimson Red */
    --color-danger-light: #fef2f2;
    --color-info: #3b82f6;          /* Sky Blue */
    --color-info-light: #eff6ff;
    
    /* Typography */
    --font-heading: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Borders & Shadows */
    --border-radius-sm: 6px;
    --border-radius-md: 10px;
    --border-radius-lg: 16px;
    --border-radius-pill: 9999px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(31, 30, 90, 0.05);
    --shadow-lg: 0 10px 25px rgba(31, 30, 90, 0.08);
    --shadow-inset: inset 0 2px 4px rgba(0,0,0,0.02);
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    
    /* Layout Dimensions */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --topbar-height: 70px;
}

/* --- Base & Reset Rules --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg-body);
    color: var(--color-text-main);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--color-primary);
}

a {
    color: var(--color-info);
    text-decoration: none;
    transition: var(--transition-fast);
}
a:hover {
    color: var(--color-primary-light);
}

button {
    font-family: var(--font-body);
    cursor: pointer;
    border: none;
    background: none;
    outline: none;
    transition: var(--transition-fast);
}

input, select, textarea {
    font-family: var(--font-body);
    outline: none;
}

/* --- Helper Classes & Utilities --- */
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }
.text-muted { color: var(--color-text-muted); }

.bg-success-light { background-color: var(--color-success-light); }
.bg-warning-light { background-color: var(--color-warning-light); }
.bg-danger-light { background-color: var(--color-danger-light); }
.bg-info-light { background-color: var(--color-info-light); }

.hidden { display: none !important; }
.text-center { text-align: center; }

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #c5cbd5;
    border-radius: var(--border-radius-pill);
}
::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}


/* ==========================================
   LOGIN VIEW STYLING
   ========================================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #101037 0%, #1f1e5a 100%);
    position: relative;
    overflow: hidden;
}

/* Background light patterns */
.login-wrapper::before, .login-wrapper::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: 1;
    opacity: 0.15;
}
.login-wrapper::before {
    width: 400px;
    height: 400px;
    background-color: var(--color-secondary);
    top: -100px;
    right: -100px;
}
.login-wrapper::after {
    width: 500px;
    height: 500px;
    background-color: var(--color-accent);
    bottom: -150px;
    left: -150px;
}

.login-card {
    background: var(--color-bg-card);
    width: 100%;
    max-width: 1000px;
    min-height: 600px;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    display: flex;
    overflow: hidden;
    z-index: 5;
    position: relative;
}

/* Left panel with illustration and brand */
.login-graphic-panel {
    flex: 1;
    background: linear-gradient(rgba(31, 30, 90, 0.85), rgba(16, 16, 55, 0.95)), url('https://images.unsplash.com/photo-1586528116311-ad8dd3c8310d?q=80&width=800&auto=format&fit=crop') no-repeat center center;
    background-size: cover;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #ffffff;
    position: relative;
}

.graphic-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 30%, rgba(0, 210, 196, 0.15), transparent 60%);
    pointer-events: none;
}

.login-logo-img {
    height: 50px;
    object-fit: contain;
}

.graphic-content {
    margin-top: auto;
    margin-bottom: auto;
    max-width: 380px;
}
.graphic-content h2 {
    color: #ffffff;
    font-size: 2rem;
    margin-bottom: 15px;
    line-height: 1.3;
}
.graphic-content p {
    color: rgba(255,255,255,0.75);
    font-size: 0.95rem;
    line-height: 1.6;
}

.partner-tag {
    font-size: 0.8rem;
    color: var(--color-secondary);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 600;
}

/* Right panel containing login form */
.login-form-panel {
    flex: 1.1;
    padding: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.form-header {
    margin-bottom: 30px;
}
.form-header h1 {
    font-size: 1.85rem;
    margin-bottom: 8px;
}
.form-header .subtitle {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

/* Login Tab Switches */
.login-tabs {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 25px;
    gap: 20px;
}

.login-tab-btn {
    padding: 10px 5px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.login-tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}
.login-tab-btn i {
    margin-right: 5px;
    font-size: 1.1rem;
    vertical-align: text-bottom;
}

/* Inputs and Forms */
.form-fields-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.input-wrapper label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-primary);
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.forgot-pass-link {
    font-size: 0.8rem;
    font-weight: 500;
}

.input-field-container {
    position: relative;
    display: flex;
    align-items: center;
}

.input-field-container input, .form-control {
    width: 100%;
    height: 48px;
    padding: 10px 16px 10px 44px;
    border: 1.5px solid #d1d5db;
    border-radius: var(--border-radius-md);
    font-size: 0.95rem;
    color: var(--color-text-main);
    background-color: #fafafa;
    transition: var(--transition-fast);
}
.input-field-container input:focus, .form-control:focus {
    border-color: var(--color-primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(31, 30, 90, 0.08);
}

.input-icon {
    position: absolute;
    left: 15px;
    font-size: 1.3rem;
    color: var(--color-text-muted);
    pointer-events: none;
}

.password-toggle-btn {
    position: absolute;
    right: 15px;
    color: var(--color-text-muted);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

/* OTP Request Link styling */
.otp-request-row {
    display: flex;
    justify-content: flex-end;
    margin-top: -10px;
    margin-bottom: 5px;
}

/* Form Checkbox and Button */
.form-actions {
    margin: 20px 0;
}

.checkbox-container {
    display: block;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    user-select: none;
}
.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}
.checkmark {
    position: absolute;
    top: 1px;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: #eee;
    border-radius: 4px;
    border: 1px solid #c5cbd5;
    transition: var(--transition-fast);
}
.checkbox-container:hover input ~ .checkmark {
    background-color: #e5e7eb;
}
.checkbox-container input:checked ~ .checkmark {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}
.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}
.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}
.checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #171647 100%);
    color: #ffffff;
    padding: 12px 24px;
    border-radius: var(--border-radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(31, 30, 90, 0.15);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(31, 30, 90, 0.2);
}

.btn-secondary {
    background-color: #e5e7eb;
    color: var(--color-text-main);
    padding: 12px 24px;
    border-radius: var(--border-radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-secondary:hover {
    background-color: #d1d5db;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--border-radius-sm);
}

.btn-block {
    width: 100%;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

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


/* ==========================================
   APP MAIN LAYOUT STYLING
   ========================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--color-bg-sidebar);
    color: #a3a3d2;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: var(--transition-normal);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo {
    height: 38px;
    object-fit: contain;
    transition: var(--transition-normal);
}

.sidebar-collapse-btn {
    width: 26px;
    height: 26px;
    background-color: rgba(255,255,255,0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}
.sidebar-collapse-btn:hover {
    background-color: var(--color-secondary);
    color: var(--color-primary);
}

/* Sidebar Menu */
.sidebar-menu-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 15px 0;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 10px;
}

.menu-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.3);
    padding: 12px 15px 5px;
}

.menu-item-link {
    display: flex;
    align-items: center;
    padding: 11px 15px;
    border-radius: var(--border-radius-md);
    color: #b1b1d8;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
    cursor: pointer;
}
.menu-item-link:hover {
    color: #ffffff;
    background-color: rgba(255,255,255,0.04);
}
.menu-item-link.active {
    color: #ffffff;
    background-color: var(--color-primary-light);
    font-weight: 600;
}
.menu-item-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 4px;
    background-color: var(--color-secondary);
    border-radius: 0 4px 4px 0;
}

.menu-item-link i {
    font-size: 1.25rem;
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.menu-item-link .arrow-icon {
    margin-left: auto;
    margin-right: 0;
    font-size: 1rem;
    transition: transform var(--transition-fast);
}

/* Expandable submenu item link state */
.submenu-parent.expanded > .menu-item-link .arrow-icon {
    transform: rotate(90deg);
}

/* Submenu layout */
.submenu {
    list-style: none;
    padding-left: 32px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
    max-height: 0;
    transition: max-height var(--transition-normal) ease-out;
}
.submenu-parent.expanded .submenu {
    max-height: 350px; /* Large enough to fit subitems */
}

.submenu-item-link {
    display: block;
    padding: 8px 15px;
    color: #9292bd;
    font-size: 0.85rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
    cursor: pointer;
}
.submenu-item-link:hover, .submenu-item-link.active {
    color: #ffffff;
    background-color: rgba(255,255,255,0.03);
}
.submenu-item-link.active {
    font-weight: 600;
    color: var(--color-secondary);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: rgba(0,0,0,0.15);
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: var(--color-secondary);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-secondary);
}

.user-info-sm {
    display: flex;
    flex-direction: column;
    transition: var(--transition-normal);
}
.user-name-sm {
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
}
.user-role-sm {
    font-size: 0.7rem;
    color: var(--color-text-light);
}

/* Collapsed sidebar styling overrides */
.app-layout.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
}
.app-layout.sidebar-collapsed .sidebar-logo {
    opacity: 0;
    width: 0;
    overflow: hidden;
}
.app-layout.sidebar-collapsed #collapse-icon {
    transform: rotate(180deg);
}
.app-layout.sidebar-collapsed .menu-title,
.app-layout.sidebar-collapsed .menu-item-link span,
.app-layout.sidebar-collapsed .arrow-icon,
.app-layout.sidebar-collapsed .submenu,
.app-layout.sidebar-collapsed .user-info-sm {
    display: none !important;
}
.app-layout.sidebar-collapsed .menu-item-link {
    justify-content: center;
    padding: 12px 0;
}
.app-layout.sidebar-collapsed .menu-item-link i {
    margin-right: 0;
}


/* --- Main Wrapper & Topbar --- */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-left: var(--sidebar-width);
    transition: var(--transition-normal);
}
.app-layout.sidebar-collapsed .main-wrapper {
    padding-left: var(--sidebar-collapsed-width);
}

.app-topbar {
    height: var(--topbar-height);
    background-color: var(--color-bg-card);
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.menu-toggle-btn {
    font-size: 1.5rem;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dropdowns in Topbar */
.dropdown {
    position: relative;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-main);
    background-color: #f3f4f6;
    transition: var(--transition-fast);
}
.dropdown-trigger:hover {
    background-color: #e5e7eb;
}

.dropdown-menu {
    position: absolute;
    top: 105%;
    left: 0;
    background-color: var(--color-bg-card);
    border: 1px solid #e5e7eb;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    padding: 8px 0;
    display: none;
    z-index: 120;
    animation: dropFade 0.2s ease;
}
.dropdown-menu.show {
    display: block;
}

@keyframes dropFade {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-right {
    left: auto;
    right: 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.88rem;
    color: var(--color-text-main);
    transition: var(--transition-fast);
}
.dropdown-item:hover {
    background-color: #f3f4f6;
}
.dropdown-item.active {
    background-color: var(--color-primary-soft);
    color: var(--color-primary);
    font-weight: 600;
}
.dropdown-item i {
    font-size: 1.15rem;
}

.dropdown-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 6px 0;
}

/* Tool Switcher Details */
.tool-switcher .dropdown-trigger {
    font-family: var(--font-heading);
    font-weight: 600;
    background-color: var(--color-primary-soft);
    color: var(--color-primary);
}

/* Global Search */
.topbar-search {
    flex: 1;
    max-width: 420px;
    margin: 0 30px;
}
.search-box-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.search-box-wrapper input {
    width: 100%;
    height: 38px;
    padding: 5px 35px 5px 35px;
    border: 1.5px solid #e5e7eb;
    background-color: #f9fafb;
    border-radius: var(--border-radius-pill);
    font-size: 0.88rem;
    color: var(--color-text-main);
    transition: var(--transition-fast);
}
.search-box-wrapper input:focus {
    border-color: var(--color-primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(31, 30, 90, 0.05);
}
.search-icon {
    position: absolute;
    left: 12px;
    font-size: 1.1rem;
    color: var(--color-text-muted);
}
.clear-search-btn {
    position: absolute;
    right: 12px;
    font-size: 1.1rem;
    color: var(--color-text-muted);
}

/* Topbar Notification Bell */
.notification-btn {
    background: transparent;
    padding: 8px;
    font-size: 1.3rem;
    color: var(--color-text-muted);
    border-radius: 50%;
    position: relative;
}
.notification-btn:hover {
    color: var(--color-primary);
    background-color: #f3f4f6;
}
.notification-btn .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: var(--color-danger);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-bg-card);
}

.notification-menu {
    width: 320px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
}
.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
}
.notif-header h3 {
    font-size: 0.95rem;
    color: var(--color-primary);
}
.notif-header a {
    font-size: 0.75rem;
    font-weight: 500;
}
.notif-list {
    overflow-y: auto;
    flex: 1;
}
.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    transition: var(--transition-fast);
    cursor: pointer;
}
.notif-item:hover {
    background-color: #f9fafb;
}
.notif-item.unread {
    background-color: var(--color-primary-soft);
}
.notif-icon-box {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}
.notif-info h4 {
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--color-text-main);
}
.notif-info p {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    line-height: 1.4;
    margin-bottom: 4px;
}
.notif-time {
    font-size: 0.7rem;
    color: var(--color-text-light);
}

/* User profile button layout */
.profile-btn {
    background: transparent;
    padding: 4px 8px;
    border-radius: var(--border-radius-pill);
    gap: 10px !important;
}
.profile-btn:hover {
    background-color: #f3f4f6;
}
.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}
.profile-username {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-text-main);
}
.profile-menu-header {
    padding: 12px 16px;
}
.profile-menu-header h4 {
    font-size: 0.9rem;
    margin-bottom: 2px;
}
.profile-menu-header p {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}


/* ==========================================
   APP CONTENT VIEWPORTS & CARDS
   ========================================== */
.app-content-area {
    flex: 1;
    padding: 30px;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}
.view-header-title h1 {
    font-size: 1.6rem;
    margin-bottom: 5px;
}
.view-header-title p {
    color: var(--color-text-muted);
    font-size: 0.88rem;
}

.view-actions {
    display: flex;
    gap: 12px;
}

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

.metric-card {
    background-color: var(--color-bg-card);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-fast);
}
.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.metric-info h3 {
    font-size: 0.82rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.metric-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 4px;
    font-family: var(--font-heading);
}

.metric-trend {
    display: inline-flex;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--border-radius-pill);
}
.metric-trend.up {
    background-color: var(--color-success-light);
    color: var(--color-success);
}
.metric-trend.down {
    background-color: var(--color-danger-light);
    color: var(--color-danger);
}
.metric-trend i {
    margin-right: 2px;
}

.metric-icon-box {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}


/* --- Dashboard Main Content Area --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

.card {
    background-color: var(--color-bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid #e5e7eb;
    padding: 24px;
    margin-bottom: 25px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.card-header h2 {
    font-size: 1.1rem;
    color: var(--color-primary);
}

/* Charts Placeholders using styled SVG */
.chart-container {
    position: relative;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.svg-chart {
    width: 100%;
    height: 100%;
}

.chart-line {
    fill: none;
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.chart-line-1 {
    stroke: var(--color-primary);
    filter: drop-shadow(0px 5px 5px rgba(31, 30, 90, 0.25));
}
.chart-line-2 {
    stroke: var(--color-secondary);
    filter: drop-shadow(0px 5px 5px rgba(0, 210, 196, 0.25));
}

.chart-grid-line {
    stroke: #f3f4f6;
    stroke-width: 1.5;
}
.chart-axis-line {
    stroke: #e5e7eb;
    stroke-width: 1.5;
}
.chart-label {
    font-size: 10px;
    fill: var(--color-text-muted);
    font-family: var(--font-body);
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}
.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* Circular Chart styling */
.chart-donut {
    transform: rotate(-90deg);
    transform-origin: center;
}
.donut-segment {
    fill: none;
    stroke-linecap: round;
    transition: stroke-dasharray 0.3s ease;
}
.donut-center {
    font-family: var(--font-heading);
    fill: var(--color-primary);
    text-anchor: middle;
}
.donut-center-val {
    font-size: 18px;
    font-weight: 700;
}
.donut-center-lbl {
    font-size: 8px;
    fill: var(--color-text-muted);
}

/* Lists and Details widgets */
.widget-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.widget-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
}
.widget-list-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.widget-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.widget-item-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}
.widget-item-desc h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-main);
}
.widget-item-desc p {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}
.widget-item-meta {
    text-align: right;
}
.widget-item-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-primary);
}


/* ==========================================
   TABLES & LIST VIEWS
   ========================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

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

.custom-table th {
    background-color: #f8fafc;
    padding: 14px 16px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-primary);
    border-bottom: 2px solid #e2e8f0;
    letter-spacing: 0.5px;
}

.custom-table td {
    padding: 14px 16px;
    font-size: 0.88rem;
    color: var(--color-text-main);
    border-bottom: 1px solid #e2e8f0;
    transition: var(--transition-fast);
}

.custom-table tbody tr:hover td {
    background-color: #f1f5f9;
}

/* Status Badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: var(--border-radius-pill);
    text-transform: capitalize;
}
.badge-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
}

.badge-status.delivered, .badge-status.in-stock, .badge-status.active {
    background-color: var(--color-success-light);
    color: var(--color-success);
}
.badge-status.delivered::before, .badge-status.in-stock::before, .badge-status.active::before {
    background-color: var(--color-success);
}

.badge-status.pending, .badge-status.low-stock {
    background-color: var(--color-warning-light);
    color: var(--color-warning);
}
.badge-status.pending::before, .badge-status.low-stock::before {
    background-color: var(--color-warning);
}

.badge-status.shipped, .badge-status.assigned {
    background-color: var(--color-info-light);
    color: var(--color-info);
}
.badge-status.shipped::before, .badge-status.assigned::before {
    background-color: var(--color-info);
}

.badge-status.cancelled, .badge-status.out-of-stock, .badge-status.inactive {
    background-color: var(--color-danger-light);
    color: var(--color-danger);
}
.badge-status.cancelled::before, .badge-status.out-of-stock::before, .badge-status.inactive::before {
    background-color: var(--color-danger);
}

/* Action controls */
.action-btn-group {
    display: flex;
    gap: 8px;
}
.action-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f1f5f9;
    color: var(--color-text-muted);
    font-size: 1.05rem;
}
.action-btn:hover {
    background-color: var(--color-primary-soft);
    color: var(--color-primary);
}


/* ==========================================
   DETAILS DRAWER (Sliding panel)
   ========================================== */
.details-drawer-wrapper {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 150;
    display: none;
}
.details-drawer-wrapper.show {
    display: block;
}

.details-drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(16, 16, 55, 0.4);
    backdrop-filter: blur(2px);
    animation: drawerOverlayFade var(--transition-fast) forwards;
}

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

.details-drawer-content {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 460px;
    background-color: var(--color-bg-card);
    box-shadow: -10px 0 30px rgba(16, 16, 55, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform var(--transition-normal) cubic-bezier(0.16, 1, 0.3, 1);
}
.details-drawer-wrapper.show .details-drawer-content {
    transform: translateX(0);
}

.drawer-header {
    height: var(--topbar-height);
    padding: 0 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.drawer-header h3 {
    font-size: 1.15rem;
    color: var(--color-primary);
}
.drawer-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--color-text-muted);
}
.drawer-close-btn:hover {
    background-color: #e5e7eb;
    color: var(--color-primary);
}

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

/* Info List inside Drawer */
.info-details-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.detail-item-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.detail-item-row .lbl {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.detail-item-row .val {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-main);
}
.detail-item-row .val.price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-primary);
    font-family: var(--font-heading);
}

.drawer-divider {
    height: 1px;
    background-color: #f3f4f6;
    margin: 15px 0;
}


/* ==========================================
   MODAL STYLING
   ========================================== */
.modal-wrapper {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(16, 16, 55, 0.5);
    backdrop-filter: blur(3px);
}

.modal-content {
    background-color: var(--color-bg-card);
    width: 100%;
    max-width: 550px;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 50px rgba(16, 16, 55, 0.2);
    position: relative;
    z-index: 210;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
    animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalScale {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-size: 1.15rem;
}
.modal-close-btn {
    font-size: 1.4rem;
    color: var(--color-text-muted);
}
.modal-close-btn:hover {
    color: var(--color-primary);
}

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

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.order-items-selection-section {
    margin: 20px 0;
    padding-top: 15px;
    border-top: 1px solid #f3f4f6;
}
.order-items-selection-section > label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-primary);
    display: block;
    margin-bottom: 12px;
}
.order-items-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 5px;
}
.order-item-picker-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background-color: #f9fafb;
    border-radius: var(--border-radius-md);
    border: 1px solid #e5e7eb;
}
.picker-item-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-main);
}
.picker-item-price {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    display: block;
    margin-top: 2px;
}
.picker-qty-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}
.picker-qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background-color: #e5e7eb;
    color: var(--color-text-main);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}
.picker-qty-btn:hover {
    background-color: var(--color-primary);
    color: #ffffff;
}
.picker-qty-val {
    font-size: 0.85rem;
    font-weight: 600;
    width: 20px;
    text-align: center;
}

.modal-summary-panel {
    background-color: var(--color-primary-soft);
    padding: 15px;
    border-radius: var(--border-radius-md);
    margin-top: 15px;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.summary-row span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-primary);
}
.summary-price {
    font-size: 1.2rem;
    font-family: var(--font-heading);
    color: var(--color-primary);
}


/* ==========================================
   TOAST NOTIFICATION ENGINE
   ========================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 999;
    max-width: 320px;
}

.toast {
    background-color: #ffffff;
    border-left: 4px solid var(--color-primary);
    box-shadow: 0 10px 20px rgba(16, 16, 55, 0.12);
    border-radius: 4px;
    padding: 14px 18px;
    display: flex;
    align-items: start;
    gap: 12px;
    color: var(--color-text-main);
    font-size: 0.85rem;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.toast.success { border-left-color: var(--color-success); }
.toast.warning { border-left-color: var(--color-warning); }
.toast.danger { border-left-color: var(--color-danger); }
.toast.info { border-left-color: var(--color-info); }

.toast-icon {
    font-size: 1.15rem;
    flex-shrink: 0;
    margin-top: 2px;
}
.toast.success .toast-icon { color: var(--color-success); }
.toast.warning .toast-icon { color: var(--color-warning); }
.toast.danger .toast-icon { color: var(--color-danger); }
.toast.info .toast-icon { color: var(--color-info); }

.toast-text {
    flex: 1;
    line-height: 1.4;
}


/* ==========================================
   APP FOOTER
   ========================================== */
.app-footer {
    height: 50px;
    background-color: var(--color-bg-card);
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    color: var(--color-text-muted);
    font-size: 0.78rem;
    margin-top: auto;
}

.env-tag {
    background-color: #e2e8f0;
    color: var(--color-text-main);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.7rem;
    margin-right: 10px;
}


/* ==========================================
   RESPONSIVE DESIGN BREAKPOINTS
   ========================================== */

/* Tablet layout */
@media (max-width: 992px) {
    /* Login */
    .login-card {
        max-width: 500px;
        flex-direction: column;
    }
    .login-graphic-panel {
        display: none;
    }
    
    /* Layout */
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-layout.sidebar-mobile-visible .app-sidebar {
        transform: translateX(0);
        box-shadow: 10px 0 35px rgba(0,0,0,0.15);
    }
    .main-wrapper, .app-layout.sidebar-collapsed .main-wrapper {
        padding-left: 0;
    }
    .app-layout.sidebar-collapsed .app-sidebar {
        transform: translateX(-100%);
    }
    
    /* Dashboard */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile Phone layout */
@media (max-width: 576px) {
    .login-form-panel {
        padding: 30px 20px;
    }
    
    .app-topbar {
        padding: 0 15px;
    }
    
    .topbar-search {
        display: none; /* Hide search bar in mobile topbar */
    }
    
    .app-content-area {
        padding: 20px 15px;
    }
    
    .view-header {
        flex-direction: column;
        align-items: start;
        gap: 15px;
    }
    .view-actions {
        width: 100%;
    }
    .view-actions button {
        flex: 1;
    }
}

/* ==========================================
   CUSTOM SEARCHABLE SELECT DROPDOWN STYLING
   ========================================== */
.searchable-select-container {
    position: relative;
    width: 100%;
}

.searchable-select-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.searchable-select-input {
    width: 100%;
    height: 42px; /* Standard input height for ERP forms */
    padding: 8px 36px 8px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    color: var(--color-text-main);
    background-color: #fafafa;
    cursor: pointer;
    transition: var(--transition-fast);
}

.searchable-select-input:focus {
    border-color: var(--color-primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(31, 30, 90, 0.08);
    cursor: text;
}

.searchable-select-caret {
    position: absolute;
    right: 12px;
    pointer-events: none;
    color: var(--color-text-muted);
    font-size: 1.25rem;
    transition: transform var(--transition-fast);
}

.searchable-select-container.open .searchable-select-caret {
    transform: rotate(180deg);
}

.searchable-select-dropdown {
    position: absolute;
    top: 105%;
    left: 0;
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    background-color: var(--color-bg-card);
    border: 1.5px solid #d1d5db;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    animation: dropFade 0.15s ease;
}

.searchable-select-container.open .searchable-select-dropdown {
    display: block;
}

.searchable-select-option {
    padding: 10px 14px;
    font-size: 0.9rem;
    color: var(--color-text-main);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.searchable-select-option:hover, 
.searchable-select-option.highlighted {
    background-color: var(--color-primary-soft);
    color: var(--color-primary);
}

.searchable-select-option.selected {
    background-color: var(--color-primary);
    color: #ffffff;
    font-weight: 500;
}

.searchable-select-no-results {
    padding: 12px 14px;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    text-align: center;
}

/* ==========================================
   PRINT ENGINE STYLESHEET (Clean Printing)
   ========================================== */
.print-only {
    display: none !important;
}

@media print {
    /* Hide layout elements & screen controls */
    .app-sidebar,
    .app-topbar,
    .app-footer,
    .view-actions,
    .card-header button,
    .sidebar-collapse-btn,
    .menu-toggle-btn,
    form,
    .form-actions,
    nav,
    .notifications,
    .user-profile,
    .toast-container,
    .modal-overlay,
    .modal-content,
    .view-header .view-actions,
    .card form,
    .card-header form,
    .no-print {
        display: none !important;
    }

    /* Print only helper */
    .print-only {
        display: block !important;
    }

    /* Expand main content container to full page width */
    body, html {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 11pt !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .app-layout,
    .main-wrapper,
    .app-content-area,
    #main-content {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        background: #ffffff !important;
        box-shadow: none !important;
        border: none !important;
        display: block !important;
    }

    /* Headers styling */
    .view-header {
        margin-bottom: 20px !important;
        border-bottom: 2px solid #000000 !important;
        padding-bottom: 10px !important;
    }
    .view-header-title h1 {
        font-size: 18pt !important;
        font-weight: bold !important;
        color: #000000 !important;
        margin: 0 0 5px 0 !important;
    }
    .view-header-title p {
        font-size: 10pt !important;
        color: #555555 !important;
    }

    /* Cards print styling */
    .card, .metric-card {
        box-shadow: none !important;
        border: none !important;
        background: #ffffff !important;
        padding: 10px 0 !important;
        margin-bottom: 20px !important;
        page-break-inside: avoid !important;
    }
    
    .card-header {
        border-bottom: 1.5px solid #000000 !important;
        padding-bottom: 5px !important;
        margin-bottom: 15px !important;
    }
    
    .card-header h2 {
        font-size: 12pt !important;
        font-weight: bold !important;
        color: #000000 !important;
    }

    /* Tables print styling */
    .table-responsive {
        overflow: visible !important;
    }
    
    .custom-table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin-top: 15px !important;
    }
    
    .custom-table th {
        background-color: #f1f5f9 !important;
        color: #000000 !important;
        border-bottom: 2px solid #000000 !important;
        padding: 8px 10px !important;
        font-size: 9pt !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
    }
    
    .custom-table td {
        padding: 8px 10px !important;
        border-bottom: 1px solid #e2e8f0 !important;
        font-size: 9pt !important;
        color: #000000 !important;
    }
    
    .custom-table tr {
        page-break-inside: avoid !important;
    }
    
    .custom-table tbody tr:hover td {
        background-color: transparent !important;
    }

    /* Links shouldn't show colors */
    a {
        text-decoration: none !important;
        color: #000000 !important;
        font-weight: 600 !important;
    }

    /* Status Badges */
    .badge, .badge-status {
        border: 1px solid #000000 !important;
        background: transparent !important;
        color: #000000 !important;
        padding: 2px 6px !important;
        font-size: 8pt !important;
        font-weight: bold !important;
        border-radius: 4px !important;
    }
    .badge::before, .badge-status::before {
        display: none !important;
    }

    /* Flex grids adjustments for printing */
    .dashboard-grid {
        display: block !important;
    }
    
    /* Metric / summary cards display block in print */
    [style*="display:grid; grid-template-columns: repeat(4, 1fr)"],
    [style*="display:grid; grid-template-columns: repeat(4,1fr)"],
    [style*="display:grid; grid-template-columns: 1fr 1fr 1fr"] {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 15px !important;
    }
    
    .metric-card {
        flex: 1 1 calc(25% - 15px) !important;
        border: 1px solid #dddddd !important;
        border-radius: 6px !important;
        padding: 10px !important;
        margin-bottom: 10px !important;
    }
    
    .metric-icon-box {
        display: none !important;
    }
    
    .metric-value {
        font-size: 13pt !important;
        color: #000000 !important;
    }
}
