/* 
 * ENJAZ PMS - 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: #c9840f;
    --primary-hover: #a8660c;
    --secondary: #ff8a3d;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Background */
    --bg-primary: #ffffff;
    --bg-secondary: #f4f4f4;
    --bg-tertiary: #f3f4f6;
    
    /* Surface */
    --surface: #ffffff;
    --surface-hover: #f9fafb;
    --bg-card: #ffffff;
    --card-bg: var(--bg-card);
    --card-border-color: #e5e7eb;

    /* Border */
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;

    --text-primary: #111827;
    --text-secondary: #374151;
    --text-tertiary: #6b7280;
    --text-main: #1e293b;
    --text-inverse: #ffffff;
    --input-bg: #f8fafc;
    --hover-bg: #f1f5f9;
    --table-head-bg: #f8fafc;
    --text-muted: #64748b;
    --surface-alt: #f9fafb;
    --border-medium: #d1d5db;
    --indigo-50: #fef3e2;
    --indigo-100: #fde6c2;
    --indigo-500: #c9840f;
    --indigo-600: #a8660c;
    --indigo-700: #8f5c0a;

    /* 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;
}

/* Brand mark — logo icon + "ENJAZ" wordmark, used in every nav/header position */
.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
}

.brand-mark__icon {
    height: 26px;
    width: auto;
    display: block;
    flex-shrink: 0;
}

.brand-mark__icon--dark  { display: block; }
.brand-mark__icon--light { display: none; }
[data-theme="dark"] .brand-mark__icon--dark  { display: none; }
[data-theme="dark"] .brand-mark__icon--light { display: block; }

/* Forces the white mark regardless of site theme — for panels with a fixed colored background */
.brand-mark--inverse .brand-mark__icon--dark  { display: none; }
.brand-mark--inverse .brand-mark__icon--light { display: block; }

/* Forces the dark mark + dark text regardless of site theme — for headers
   that keep a fixed light/white background even when data-theme is dark
   (e.g. the marketing pages' topbars). */
.brand-mark--on-light .brand-mark__icon--dark  { display: block !important; }
.brand-mark--on-light .brand-mark__icon--light { display: none !important; }
.brand-mark--on-light .brand-wordmark { color: #111827; }

.brand-mark--lg .brand-mark__icon { height: 44px; }

.brand-wordmark {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 0.01em;
    line-height: 1;
    color: var(--text-primary);
    white-space: nowrap;
}

.brand-wordmark--inverse {
    color: #fff;
}

.brand-wordmark--lg {
    font-size: 1.7rem;
}

/* Dark Mode */
[data-theme="dark"] {
    --primary: #f6a821;
    --primary-hover: #ffb640;
    --secondary: #ff8a3d;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;
    
    /* Background */
    --bg-primary: #0f172a;
    --bg-secondary: #1b2533;
    --bg-tertiary: #334155;
    
    /* Surface */
    --surface: #1e293b;
    --surface-hover: #334155;
    --bg-card: var(--surface);
    --card-bg: var(--bg-card);
    --card-border-color: var(--border-color);

    /* Border */
    --border-color: #334155;
    --border-light: #475569;
    
    /* Text */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-main: #f8fafc;
    --text-inverse: #0f172a;
    --input-bg: #334155;
    --hover-bg: #334155;
    --table-head-bg: #1e293b;
    --text-muted: #94a3b8;
    --surface-alt: #334155;
    --border-medium: #475569;
    --indigo-50: rgba(246,168,33,0.15);
    --indigo-100: rgba(246,168,33,0.25);
    --indigo-500: #f6a821;
    --indigo-600: #ffb640;
    --indigo-700: #ffd699;
    
    /* 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);
    --bg-card: var(--surface);
    --card-border-color: var(--border-color);
    
    /* 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;
}

/* LTR field types — text aligns right but renders left-to-right */
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
input[type="time"],
input[type="email"],
input[type="url"],
input[type="tel"] {
    direction: ltr;
    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-secondary-color:     var(--text-secondary);
    --bs-tertiary-color:      var(--text-tertiary);
    --bs-emphasis-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);
    --bs-table-bg:            var(--surface);
    --bs-table-striped-bg:    rgba(255,255,255,0.03);
    --bs-table-active-bg:     rgba(255,255,255,0.06);
    --bs-table-hover-bg:      rgba(255,255,255,0.04);
    --bs-table-border-color:  var(--border-color);
    --bs-table-color:         var(--text-primary);
}

/* 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;
}

/* ==========================================
   Dark-mode overrides for components with
   hard-coded white backgrounds
   ========================================== */
[data-theme="dark"] .subscription-shell,
[data-theme="dark"] .subscription-hero__main,
[data-theme="dark"] .subscription-hero__status,
[data-theme="dark"] .subscription-panel,
[data-theme="dark"] .subscription-panel__body,
[data-theme="dark"] .subscription-stat,
[data-theme="dark"] .subscription-feature,
[data-theme="dark"] .subscription-timeline__item,
[data-theme="dark"] .subscription-note-item,
[data-theme="dark"] .profile-info-item,
[data-theme="dark"] .profile-activity-item,
[data-theme="dark"] .profile-action-btn,
[data-theme="dark"] .profile-note-item,
[data-theme="dark"] .profile-activity-item .activity-icon,
[data-theme="dark"] .dashboard-panel,
[data-theme="dark"] .tenant-settings-panel,
[data-theme="dark"] .card,
[data-theme="dark"] .card-body,
[data-theme="dark"] .list-group-item
{
    background: var(--surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    box-shadow: none !important;
}

[data-theme="dark"] .activity-icon {
    background: rgba(255,255,255,0.04) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .card,
[data-theme="dark"] .card-body,
[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer,
[data-theme="dark"] .list-group-item,
[data-theme="dark"] .table,
[data-theme="dark"] .table th,
[data-theme="dark"] .table td,
[data-theme="dark"] .alert,
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .input-group-text,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .settings-card,
[data-theme="dark"] .settings-hero,
[data-theme="dark"] .settings-switches,
[data-theme="dark"] .summary-card,
[data-theme="dark"] .report-filters,
[data-theme="dark"] .subscription-shell,
[data-theme="dark"] .profile-info-item,
[data-theme="dark"] .profile-activity-item,
[data-theme="dark"] .profile-note-item,
[data-theme="dark"] .profile-action-btn,
[data-theme="dark"] .subscription-stat,
[data-theme="dark"] .subscription-feature,
[data-theme="dark"] .subscription-timeline__item,
[data-theme="dark"] .subscription-note-item {
    background: var(--surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    box-shadow: none !important;
}

[data-theme="dark"] .settings-input,
[data-theme="dark"] .settings-textarea {
    background: rgba(255,255,255,0.05) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .dash-chart {
    background: var(--surface) !important;
    border-color: rgba(255,255,255,0.08) !important;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.26) !important;
}

[data-theme="dark"] .opening-qty-input {
    background: rgba(255,255,255,0.05) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] [style*="background: #fff"] {
    background: var(--surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] [style*="background: rgba(255,255,255,0.2)"] {
    background: rgba(255,255,255,0.08) !important;
}

[data-theme="dark"] [style*="background: rgba(255,255,255,0.1)"] {
    background: rgba(255,255,255,0.05) !important;
}

/* Overrides for template elements that use inline color/background styles */
[data-theme="dark"] .cx-view-avatar {
    background: var(--primary) !important;
    color: var(--text-inverse) !important;
}

[data-theme="dark"] .cx-info-card-icon {
    background: rgba(255,255,255,0.04) !important;
}
[data-theme="dark"] .cx-info-card-icon i {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .cx-hero,
[data-theme="dark"] .summary-card,
[data-theme="dark"] .report-filters {
    background: var(--surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    box-shadow: none !important;
}

[data-theme="dark"] .cx-hero .cx-hero-title,
[data-theme="dark"] .cx-hero .cx-hero-desc,
[data-theme="dark"] .cx-hero .cx-btn-secondary {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .cx-hero-icon-wrap {
    background: rgba(255,255,255,0.06) !important;
}

[data-theme="dark"] .cx-btn-secondary {
    background: transparent !important;
    border-color: rgba(255,255,255,0.12) !important;
    color: var(--text-primary) !important;
}

/* ==========================================
   Number Stepper Buttons
   ========================================== */
.num-stepper { flex-wrap: nowrap; height: 40px; }

.num-stepper-btn {
    padding: 0 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    min-width: 28px;
    flex-shrink: 0;
    user-select: none;
    transition: background .15s, color .15s;
}
.num-stepper-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.num-stepper-btn:active { transform: scale(.93); }

.num-stepper input[type="number"] {
    flex: 1 1 0;
    min-width: 0;
    width: 0;
    text-align: center;
    direction: ltr;
    border-radius: 0 !important;
}

/* hide browser native spin arrows globally */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

[data-theme="dark"] .num-stepper-btn {
    background: rgba(255,255,255,.06);
    border-color: var(--border-color);
    color: var(--text-tertiary);
}
[data-theme="dark"] .num-stepper-btn:hover {
    background: var(--primary);
    color: #fff;
}

