/* ==========================================================================
   DONGSING PREMIUM LIGHT ERP DESIGN SYSTEM (白底黑字 MATERIAL ADMIN PRO)
   Curated Palette: Pristine White & Slate Grey with Vibrant Company Accents
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    /* Global System Colors (Premium Pristine Light Theme) */
    --bg-base: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-header: rgba(255, 255, 255, 0.85);
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --text-primary: #0f172a;      /* Slate-900 (Black) */
    --text-secondary: #475569;    /* Slate-600 (Dark Grey) */
    --text-muted: #94a3b8;        /* Slate-400 (Light Grey) */
    
    /* Functional Colors */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #06b6d4;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Default Theme Variables */
    --theme-primary: #4f46e5;
    --theme-primary-rgb: 79, 70, 229;
    --theme-accent: #6366f1;
    --theme-glow: rgba(79, 70, 229, 0.08);
    --theme-sidebar-bg: #ffffff;  /* Pure White Sidebar */
}

/* ==========================================
   DYNAMIC COMPANY THEMING TOKENS (LIGHT SYSTEM)
   ========================================== */

/* DSFM - Trading (Slate Blue Theme) */
body.dsfm-theme {
    --theme-primary: #4f46e5;
    --theme-primary-rgb: 79, 70, 229;
    --theme-accent: #6366f1;
    --theme-glow: rgba(79, 70, 229, 0.08);
}

/* UTM - Halal Manufacturing (Halal Green Theme) */
body.utm-theme {
    --theme-primary: #059669;
    --theme-primary-rgb: 5, 150, 105;
    --theme-accent: #10b981;
    --theme-glow: rgba(5, 150, 105, 0.08);
}

/* DSFL - Non-Halal Manufacturing (Amber Orange/Red Theme) */
body.dsfl-theme {
    --theme-primary: #d97706;
    --theme-primary-rgb: 217, 119, 6;
    --theme-accent: #fbbf24;
    --theme-glow: rgba(217, 119, 6, 0.08);
}

/* ==========================================
   CORE BODY & LAYOUT STYLING
   ========================================== */

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow-x: hidden;
    letter-spacing: -0.01em;
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6, .card-title {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary) !important;
}

/* Override text-white bootstrap class to fit Light Theme perfectly */
.text-white {
    color: var(--text-primary) !important;
}
.text-secondary {
    color: var(--text-secondary) !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--theme-primary);
}

/* ==========================================
   AUTHENTICATION VIEW STYLE
   ========================================= */

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, rgba(var(--theme-primary-rgb), 0.04) 0%, rgba(0, 0, 0, 0) 90%), var(--bg-base);
    position: relative;
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
    padding: 40px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--theme-primary), var(--theme-accent));
}

/* ==========================================
   APP SHELL LAYOUT (NAV & SIDEBAR)
   ========================================== */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Premium Light Sidebar Layout */
.app-sidebar {
    width: 260px;
    background: var(--theme-sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition-smooth);
}

.sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    height: 70px;
}

.sidebar-logo {
    height: 32px;
    width: 32px;
    border-radius: 8px;
    margin-right: 10px;
    box-shadow: 0 0 10px var(--theme-glow);
    object-fit: cover;
}

.sidebar-menu {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-label {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    padding: 12px 12px 6px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.menu-item i {
    font-size: 1.2rem;
    margin-right: 12px;
    transition: var(--transition-smooth);
}

.menu-item:hover {
    color: var(--theme-primary);
    background: rgba(var(--theme-primary-rgb), 0.04);
}

.menu-item.active {
    color: var(--theme-primary);
    background: rgba(var(--theme-primary-rgb), 0.08);
    border-color: rgba(var(--theme-primary-rgb), 0.12);
    font-weight: 600;
}

.menu-item.active i {
    color: var(--theme-primary);
    transform: scale(1.1);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
}

/* Main Content Area */
.app-content {
    flex-grow: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Premium Top Header (Light Mode) */
.app-header {
    height: 70px;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 99;
}

/* Entity Context Switcher Dropdown */
.entity-switcher-btn {
    background: rgba(var(--theme-primary-rgb), 0.06);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.15);
    color: var(--text-primary) !important;
    font-weight: 600;
    font-family: var(--font-heading);
    border-radius: 12px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.entity-switcher-btn:hover, .entity-switcher-btn:focus {
    background: rgba(var(--theme-primary-rgb), 0.12);
    border-color: rgba(var(--theme-primary-rgb), 0.3);
    box-shadow: 0 0 10px var(--theme-glow);
}

.entity-dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    padding: 8px;
    min-width: 240px;
}

.entity-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text-secondary) !important;
    transition: var(--transition-smooth);
}

.entity-dropdown-item:hover {
    background: rgba(0, 0, 0, 0.02);
    color: var(--text-primary) !important;
}

.entity-dropdown-item.active {
    background: rgba(var(--theme-primary-rgb), 0.08);
    color: var(--theme-primary) !important;
    font-weight: 600;
}

/* User Profile Widget */
.header-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff !important;
    font-weight: 700;
    font-family: var(--font-heading);
    box-shadow: 0 0 8px var(--theme-glow);
}

/* ==========================================
   CARDS & GRIDS STYLING (GLASSMORPHISM)
   ========================================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    transition: var(--transition-smooth);
    overflow: hidden;
    position: relative;
}

.card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

/* Glowing Accent Cards */
.card-glowing::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--theme-primary);
}

.card-glowing:hover {
    box-shadow: 0 8px 20px var(--theme-glow);
}

.card-body {
    padding: 24px;
}

.card-title {
    margin-bottom: 20px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ==========================================
   METRIC STATS LAYOUT
   ========================================== */

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    color: var(--theme-primary);
    transition: var(--transition-smooth);
}

.card:hover .stat-icon {
    background: rgba(var(--theme-primary-rgb), 0.08);
    border-color: rgba(var(--theme-primary-rgb), 0.15);
    color: var(--theme-primary);
    transform: scale(1.05);
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 10px;
    margin-bottom: 2px;
    color: var(--text-primary) !important;
}

/* ==========================================
   PREMIUM LIGHT TABLES
   ========================================== */

.table-responsive-custom {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    background: #ffffff;
}

.table-custom {
    width: 100%;
    margin-bottom: 0;
    color: var(--text-primary);
    border-collapse: collapse;
}

.table-custom th {
    background: #f8fafc;
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 14px 20px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.table-custom td {
    padding: 14px 20px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.88rem;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

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

.table-custom tbody tr:hover {
    background: #f8fafc;
}

.table-custom tbody tr:hover td {
    color: var(--text-primary);
}

/* Status Badges */
.badge {
    padding: 6px 12px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid transparent;
    color: var(--text-secondary); /* Override Bootstrap default white text color with slate secondary */
}

.badge.bg-white\/5 {
    background: #f1f5f9 !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-color) !important;
}

/* ==========================================
   TAILWIND UTILITY COMPATIBILITY CLASSES (PREMIUM LIGHT THEME)
   ========================================== */
.text-slate-800 { color: #1e293b !important; }
.text-slate-700 { color: #334155 !important; }
.text-slate-600 { color: #475569 !important; }
.text-slate-500 { color: #64748b !important; }

.bg-emerald-50 { background-color: #ecfdf5 !important; }
.text-emerald-700 { color: #047857 !important; }
.border-emerald-200 { border-color: #a7f3d0 !important; }

.bg-amber-50 { background-color: #fffbeb !important; }
.text-amber-700 { color: #b45309 !important; }
.border-amber-200 { border-color: #fde68a !important; }

.bg-indigo-50 { background-color: #eef2ff !important; }
.text-indigo-700 { color: #4338ca !important; }
.border-indigo-200 { border-color: #c7d2fe !important; }
.text-indigo-800 { color: #3730a3 !important; }

.bg-purple-500\/20 { background-color: rgba(168, 85, 247, 0.2) !important; }
.text-purple-300 { color: #c084fc !important; }
.border-purple-500\/30 { border-color: rgba(168, 85, 247, 0.3) !important; }

.bg-emerald-500\/20 { background-color: rgba(16, 185, 129, 0.2) !important; }
.text-emerald-300 { color: #34d399 !important; }
.border-emerald-500\/30 { border-color: rgba(16, 185, 129, 0.3) !important; }

.bg-amber-500\/20 { background-color: rgba(245, 158, 11, 0.2) !important; }
.text-amber-300 { color: #fbbf24 !important; }
.border-amber-500\/30 { border-color: rgba(245, 158, 11, 0.3) !important; }

.bg-indigo-500\/20 { background-color: rgba(99, 102, 241, 0.2) !important; }
.text-indigo-300 { color: #818cf8 !important; }
.border-indigo-500\/30 { border-color: rgba(99, 102, 241, 0.3) !important; }

.bg-success\/20 { background-color: rgba(16, 185, 129, 0.2) !important; }
.border-success\/30 { border-color: rgba(16, 185, 129, 0.3) !important; }

.bg-danger\/10 { background-color: rgba(239, 68, 68, 0.1) !important; }
.border-danger\/15 { border-color: rgba(239, 68, 68, 0.15) !important; }

.bg-danger\/20 { background-color: rgba(239, 68, 68, 0.2) !important; }
.border-danger\/30 { border-color: rgba(239, 68, 68, 0.3) !important; }

.bg-warning\/20 { background-color: rgba(245, 158, 11, 0.2) !important; }
.border-warning\/30 { border-color: rgba(245, 158, 11, 0.3) !important; }

.border-warning\/15 { border-color: rgba(245, 158, 11, 0.15) !important; }

.border-slate-200 { border-color: #e2e8f0 !important; }
.border-slate-100 { border-color: #f1f5f9 !important; }

.w-fit { width: fit-content !important; }

/* ==========================================
   INPUTS & FORM DESIGN
   ========================================== */

.form-control-custom {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 10px 16px;
    font-size: 0.88rem;
    transition: var(--transition-smooth);
}

.form-control-custom:focus {
    background: #ffffff;
    border-color: var(--theme-primary);
    box-shadow: 0 0 8px var(--theme-glow);
    color: var(--text-primary);
    outline: none;
}

.form-label-custom {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ==========================================
   PREMIUM BUTTONS
   ========================================== */

.btn-custom {
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 10px;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
}

.btn-custom-primary {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-accent));
    border: none;
    color: #fff !important;
}

.btn-custom-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px var(--theme-glow);
    color: #fff !important;
}

.btn-custom-secondary {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary) !important;
}

.btn-custom-secondary:hover {
    background: #f8fafc;
    border-color: var(--border-hover);
    color: var(--theme-primary) !important;
}

/* ==========================================
   UTILITY ALERTS & TOASTS
   ========================================== */

.alert-custom {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-custom-danger {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
}

.alert-custom-success {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.15);
    color: #047857;
}

.alert-custom-warning {
    background: rgba(245, 158, 11, 0.06);
    border-color: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

/* ==========================================
   GLOBAL PREMIUM PRELOADER & PAGE TRANSITIONS
   ========================================== */

/* Fullscreen Preloader Overlay */
.premium-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #ffffff; /* Pure white light background */
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), visibility 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    opacity: 1;
    visibility: visible;
}

.premium-preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* Concentric spinner packaging */
.preloader-spinner-wrapper {
    position: relative;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

/* Dual concentric spinning rings */
.spinner-outer {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid rgba(0, 0, 0, 0.03);
    border-top: 3px solid var(--theme-primary);
    border-radius: 50%;
    animation: preloader-spin-clockwise 1.2s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

.spinner-inner {
    position: absolute;
    width: 75%;
    height: 75%;
    border: 3px solid rgba(0, 0, 0, 0.03);
    border-bottom: 3px solid var(--theme-accent);
    border-radius: 50%;
    animation: preloader-spin-counter-clockwise 1s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

/* Brand icon pulsing inside spinner */
.preloader-brand-icon {
    font-size: 2.2rem;
    animation: preloader-pulse 2s ease-in-out infinite;
    z-index: 10;
}

/* Text banner */
.preloader-text {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    animation: preloader-text-pulse 2.5s ease-in-out infinite;
}

/* Keyframe Animations */
@keyframes preloader-spin-clockwise {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes preloader-spin-counter-clockwise {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

@keyframes preloader-pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
}

@keyframes preloader-text-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ==========================================
   LIQUID PAGE TRANSITION STATES
   ========================================== */

/* Page entrance state */
.app-content-fade {
    animation: page-fade-in-up 0.55s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

/* Page exit state */
.app-content-exit {
    animation: page-fade-out-down 0.35s cubic-bezier(0.23, 1, 0.32, 1) forwards !important;
}

@keyframes page-fade-in-up {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes page-fade-out-down {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-8px);
    }
}

/* ==========================================
   GOOGLE TRANSLATE CUSTOM STYLE OVERRIDES
   ========================================== */
iframe.goog-te-banner-frame {
    display: none !important;
}
body {
    top: 0px !important;
}
#google_translate_element {
    display: none !important;
}
.goog-te-balloon-frame {
    display: none !important;
}
.goog-te-gadget {
    display: none !important;
}
font {
    background-color: transparent !important;
    box-shadow: none !important;
    color: inherit !important;
}
#gt_float_wrapper, .gt_float_wrapper, .gt_container {
    display: none !important;
}
