/* 
 * EnjazIMS - Core Design System
 * Version: 3.0
 * Date: April 28, 2026
 * Purpose: Fonts + Colors + Basic Variables ONLY
 * Page-specific styles should be in their own CSS files
 */

/* ==========================================
   1. Font Imports
   ========================================== */

@font-face {
    font-family: 'Cairo';
    src: url("../fonts/cairo/Cairo-Regular.5dacd3d88fa2.ttf") format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Cairo';
    src: url("../fonts/cairo/Cairo-Medium.700c074c00ff.ttf") format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Cairo';
    src: url("../fonts/cairo/Cairo-SemiBold.a847fd89b0c8.ttf") format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Cairo';
    src: url("../fonts/cairo/Cairo-Bold.08f051a1822e.ttf") format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}


/* ==========================================
   2. CSS Variables - Light & Dark Mode
   ========================================== */

:root {
    /* Light Mode Colors */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Background */
    --bg-primary: #ffffff;
    --bg-secondary: #f4f4f4;
    --bg-tertiary: #f3f4f6;
    
    /* Surface */
    --surface: #ffffff;
    --surface-hover: #f9fafb;
    
    /* Border */
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-tertiary: #6b7280;
    --text-inverse: #ffffff;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Sidebar */
    --sidebar-bg: #ffffff;
    --sidebar-border: #e5e7eb;
    /* Navbar */
    --navbar-bg: rgba(255, 255, 255, 0.8);
    --navbar-border: #e5e7eb;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 0.875rem;
    --spacing-lg: 1.125rem;
    --spacing-xl: 1.5rem;
    --spacing-2xl: 1.875rem;
    --spacing-3xl: 2.25rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    --transition: 150ms ease-in-out;
}

/* Dark Mode */
[data-theme="dark"] {
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --secondary: #a78bfa;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;
    
    /* Background */
    --bg-primary: #0f172a;
    --bg-secondary: #1b2533;
    --bg-tertiary: #334155;
    
    /* Surface */
    --surface: #1e293b;
    --surface-hover: #334155;
    
    /* Border */
    --border-color: #334155;
    --border-light: #475569;
    
    /* Text */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-inverse: #0f172a;
    
    /* Shadows (subtle in dark mode) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
    
    /* Sidebar */
    --sidebar-bg: #1e293b;
    --sidebar-border: #334155;
    
    /* Navbar */
    --navbar-bg: rgba(30, 41, 59, 0.8);
    --navbar-border: #334155;
}

/* ==========================================
   3. Global Base Styles
   ========================================== */

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

html, body {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
    direction: rtl;
    text-align: right;
    transition: background var(--transition), color var(--transition);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ==========================================
   4. Global Input Direction Rules
   ========================================== */

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="hidden"]),
select,
textarea {
    direction: rtl;
    text-align: right;
    unicode-bidi: plaintext;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="hidden"])::placeholder,
textarea::placeholder {
    direction: rtl;
    text-align: right;
}

/* ==========================================
   5. Dark Mode — Bootstrap Variable Overrides
   Bootstrap 5.3 uses its own --bs-* variables
   which are unaware of the custom [data-theme]
   toggle. We remap them here so all Bootstrap
   components (modals, dropdowns, cards, etc.)
   inherit the correct dark surface colors.
   ========================================== */
[data-theme="dark"] {
    /* Bootstrap core */
    --bs-body-bg:             var(--bg-primary);
    --bs-body-color:          var(--text-primary);
    --bs-border-color:        var(--border-color);
    --bs-border-color-translucent: rgba(255,255,255,0.1);
    --bs-secondary-bg:        var(--bg-secondary);
    --bs-tertiary-bg:         var(--bg-tertiary);

    /* Modal */
    --bs-modal-bg:            var(--surface);
    --bs-modal-color:         var(--text-primary);
    --bs-modal-border-color:  var(--border-color);
    --bs-modal-header-bg:     var(--surface);
    --bs-modal-header-border-color: var(--border-light);
    --bs-modal-footer-bg:     var(--bg-secondary);
    --bs-modal-footer-border-color: var(--border-light);

    /* Dropdown */
    --bs-dropdown-bg:         var(--surface);
    --bs-dropdown-color:      var(--text-primary);
    --bs-dropdown-border-color: var(--border-color);
    --bs-dropdown-link-color: var(--text-primary);
    --bs-dropdown-link-hover-bg: var(--surface-hover);
    --bs-dropdown-link-active-bg: var(--primary);

    /* List group & misc */
    --bs-list-group-bg:       var(--surface);
    --bs-list-group-border-color: var(--border-color);
    --bs-card-bg:             var(--surface);
    --bs-card-border-color:   var(--border-color);
}

/* Hard overrides — some Bootstrap components use
   background-color directly instead of the CSS var */
[data-theme="dark"] .modal-content {
    background-color: var(--surface) !important;
    color:            var(--text-primary) !important;
    border-color:     var(--border-color) !important;
}

[data-theme="dark"] .modal-header {
    background-color: var(--surface) !important;
    border-bottom-color: var(--border-light) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .modal-footer {
    background-color: var(--bg-secondary) !important;
    border-top-color: var(--border-light) !important;
}

[data-theme="dark"] .modal-body {
    background-color: var(--surface) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .modal-backdrop {
    --bs-backdrop-opacity: 0.65;
}

[data-theme="dark"] .dropdown-menu {
    background-color: var(--surface) !important;
    border-color:     var(--border-color) !important;
    color:            var(--text-primary) !important;
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: var(--surface-hover) !important;
    color: var(--text-primary) !important;
}
