/* ============================================================
   Modeer Brand Theme - SaaS Customer & Subscription Manager
   Brand Identity: Indigo + Purple Gradient Palette
   Supports Light & Dark modes via [data-theme] attribute
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;900&family=Inter:wght@400;500;600;700;800&display=swap');

/* ============================================================
   1. CSS Variables - Theme Tokens (Modeer Palette)
   ============================================================ */
:root {
    /* Typography */
    --font-arabic: 'Tajawal', sans-serif;
    --font-latin: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-sans: var(--font-arabic), var(--font-latin);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Radii */
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 72px;

    /* Modeer Brand Colors (shared across themes) */
    --modeer-indigo: #6366F1;
    --modeer-indigo-hover: #4F46E5;
    --modeer-indigo-light: #818CF8;
    --modeer-purple: #8B5CF6;
    --modeer-purple-hover: #7C3AED;
    --modeer-purple-light: #A78BFA;
    --modeer-indigo-soft: rgba(99, 102, 241, 0.10);
    --modeer-indigo-border: rgba(99, 102, 241, 0.25);

    /* Modeer Signature Gradient */
    --modeer-gradient: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    --modeer-gradient-hover: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    --modeer-gradient-soft: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
}

/* ---------- Light Mode (Modeer Classic) ---------- */
:root,
[data-theme="light"] {
    /* Backgrounds */
    --bg-app: #F8FAFF;
    --bg-surface: #FFFFFF;
    --bg-surface-2: #F1F5F9;
    --bg-sidebar: #EEF2FF;
    --bg-hover: rgba(99, 102, 241, 0.06);
    --bg-active: rgba(99, 102, 241, 0.12);
    --bg-input: #FFFFFF;
    --bg-overlay: rgba(15, 23, 42, 0.45);

    /* Text */
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-on-accent: #FFFFFF;

    /* Borders */
    --border-subtle: rgba(15, 23, 42, 0.06);
    --border-default: rgba(15, 23, 42, 0.10);
    --border-strong: rgba(15, 23, 42, 0.18);

    /* Accent */
    --accent: var(--modeer-indigo);
    --accent-hover: var(--modeer-indigo-hover);
    --accent-soft: var(--modeer-indigo-soft);
    --accent-border: var(--modeer-indigo-border);
    --accent-gradient: var(--modeer-gradient);
    --accent-gradient-hover: var(--modeer-gradient-hover);

    /* Status Colors */
    --success: #10B981;
    --success-soft: rgba(16, 185, 129, 0.12);
    --warning: #F59E0B;
    --warning-soft: rgba(245, 158, 11, 0.12);
    --warning-text: #0F172A;
    --danger: #EF4444;
    --danger-soft: rgba(239, 68, 68, 0.12);
    --info: #3B82F6;
    --info-soft: rgba(59, 130, 246, 0.12);

    /* Critical/expiring-soon orange */
    --critical: #F97316;
    --critical-soft: rgba(249, 115, 22, 0.12);
    --critical-border: rgba(249, 115, 22, 0.30);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px rgba(15, 23, 42, 0.05), 0 2px 4px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px rgba(15, 23, 42, 0.06), 0 4px 6px rgba(15, 23, 42, 0.04);
    --shadow-xl: 0 20px 25px rgba(15, 23, 42, 0.08), 0 10px 10px rgba(15, 23, 42, 0.04);

    /* Brand-tinted shadow */
    --shadow-brand: 0 4px 12px rgba(99, 102, 241, 0.18);
    --shadow-brand-lg: 0 10px 25px rgba(99, 102, 241, 0.22), 0 4px 10px rgba(139, 92, 246, 0.12);
}

/* ---------- Dark Mode (Modeer Midnight) ---------- */
[data-theme="dark"] {
    /* Backgrounds */
    --bg-app: #0F172A;
    --bg-surface: #1E293B;
    --bg-surface-2: #334155;
    --bg-sidebar: #0B1120;
    --bg-hover: rgba(129, 140, 248, 0.08);
    --bg-active: rgba(129, 140, 248, 0.16);
    --bg-input: #1E293B;
    --bg-overlay: rgba(0, 0, 0, 0.65);

    /* Text */
    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #64748B;
    --text-on-accent: #FFFFFF;

    /* Borders */
    --border-subtle: rgba(241, 245, 249, 0.06);
    --border-default: rgba(241, 245, 249, 0.10);
    --border-strong: rgba(241, 245, 249, 0.18);

    /* Accent */
    --accent: var(--modeer-indigo-light);
    --accent-hover: #A5B4FC;
    --accent-soft: rgba(129, 140, 248, 0.15);
    --accent-border: rgba(129, 140, 248, 0.30);
    --accent-gradient: linear-gradient(135deg, #818CF8 0%, #A78BFA 100%);
    --accent-gradient-hover: linear-gradient(135deg, #A5B4FC 0%, #C4B5FD 100%);

    /* Status Colors */
    --success: #34D399;
    --success-soft: rgba(52, 211, 153, 0.15);
    --warning: #FBBF24;
    --warning-soft: rgba(251, 191, 36, 0.15);
    --warning-text: #0F172A;
    --danger: #F87171;
    --danger-soft: rgba(248, 113, 113, 0.15);
    --info: #60A5FA;
    --info-soft: rgba(96, 165, 250, 0.15);

    --critical: #FB923C;
    --critical-soft: rgba(251, 146, 60, 0.18);
    --critical-border: rgba(251, 146, 60, 0.40);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.30), 0 2px 4px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.40), 0 4px 6px rgba(0, 0, 0, 0.30);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.45), 0 10px 10px rgba(0, 0, 0, 0.35);

    --shadow-brand: 0 4px 12px rgba(129, 140, 248, 0.25);
    --shadow-brand-lg: 0 10px 25px rgba(129, 140, 248, 0.30), 0 4px 10px rgba(167, 139, 250, 0.18);
}

/* ============================================================
   2. Reset & Base
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    direction: rtl;
    line-height: 1.65;
    font-size: 15px;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-base), color var(--transition-base);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--accent-hover); text-decoration: underline; }

li { list-style: none; }

::selection { background: var(--accent-soft); color: var(--accent-hover); }

/* ============================================================
   3. App Layout with Sidebar
   ============================================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.app-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-inline-start: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition-base), transform var(--transition-base);
}
body.sidebar-collapsed .app-sidebar { width: var(--sidebar-width-collapsed); }

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 18px;
    border-bottom: 1px solid var(--border-subtle);
    min-height: 68px;
}
.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: var(--shadow-brand);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.sidebar-logo:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-brand-lg);
}
.sidebar-logo.logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    padding: 4px;
}
.sidebar-logo svg {
    width: 100%;
    height: 100%;
}
.sidebar-brand {
    font-weight: 800;
    font-size: 16px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    line-height: 1.2;
    letter-spacing: -0.01em;
}
.sidebar-brand small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
    background: none;
    -webkit-text-fill-color: var(--text-muted);
}
body.sidebar-collapsed .sidebar-brand { display: none; }

.sidebar-toggle {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast), color var(--transition-fast);
    flex-shrink: 0;
}
.sidebar-toggle:hover { background-color: var(--bg-hover); color: var(--accent); }

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 14px 12px 6px;
}
body.sidebar-collapsed .sidebar-section-label { display: none; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: start;
    font-family: inherit;
    transition: background-color var(--transition-fast), color var(--transition-fast);
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-link i {
    width: 20px;
    font-size: 15px;
    text-align: center;
    flex-shrink: 0;
}
.sidebar-link:hover { background-color: var(--bg-hover); color: var(--accent); }
.sidebar-link.active {
    background-color: var(--bg-active);
    color: var(--accent);
    font-weight: 600;
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 22%;
    bottom: 22%;
    width: 3px;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
}
.sidebar-link.active i { color: var(--accent); }

body.sidebar-collapsed .sidebar-link { justify-content: center; padding: 10px; }
body.sidebar-collapsed .sidebar-link span { display: none; }
body.sidebar-collapsed .sidebar-link i { width: auto; font-size: 17px; }

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    font-family: inherit;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}
.theme-toggle-btn:hover { background-color: var(--bg-hover); color: var(--accent); }
.theme-toggle-btn i { width: 20px; font-size: 15px; text-align: center; }
body.sidebar-collapsed .theme-toggle-btn { justify-content: center; }
body.sidebar-collapsed .theme-toggle-btn span { display: none; }

/* --- Main Content --- */
.app-main {
    flex: 1;
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-right var(--transition-base);
    display: flex;
    flex-direction: column;
}
body.sidebar-collapsed .app-main { margin-right: var(--sidebar-width-collapsed); }

.app-topbar {
    position: sticky;
    top: 0;
    background-color: var(--bg-surface);
    background-color: color-mix(in srgb, var(--bg-app) 90%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 50;
    min-height: 68px;
}
.topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.topbar-clock {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    padding: 4px 12px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: var(--radius-full);
}
.mobile-menu-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.app-content {
    flex: 1;
    padding: 32px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* ============================================================
   4. Typography
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
h5 { font-size: 14px; }
h6 { font-size: 13px; }

.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info    { color: var(--info) !important; }
.text-primary { color: var(--accent) !important; }
.text-secondary { color: var(--text-secondary) !important; }

/* Modeer brand text utility */
.text-brand {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    font-weight: 700;
}

/* ============================================================
   5. Containers & Surfaces
   ============================================================ */
.container, .container-fluid {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border: none;
    border-radius: 0;
}

.surface-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: background-color var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}

/* ============================================================
   6. Buttons - Modeer style (gradient primary, soft hover)
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px !important;
    min-height: 38px;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
    text-decoration: none;
    outline: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled, .btn.disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
.btn-lg { padding: 10px 20px !important; min-height: 44px; font-size: 15px; border-radius: var(--radius-md); }
.btn-sm { padding: 6px 12px !important; min-height: 32px; font-size: 13px; border-radius: var(--radius-sm); }

/* Button Icons */
.btn i, .btn svg, .btn-sm i, .btn-sm svg, .btn-lg i, .btn-lg svg {
    font-size: 1.1em;
}

/* Primary = Modeer Gradient */
.btn-primary {
    background: var(--accent-gradient);
    color: #FFFFFF;
    border-color: transparent;
    box-shadow: var(--shadow-brand);
}
.btn-primary:hover {
    background: var(--accent-gradient-hover);
    color: #FFFFFF;
    box-shadow: var(--shadow-brand-lg);
    transform: translateY(-1px);
    filter: brightness(1.03);
}
.btn-primary:active { filter: brightness(0.95); }

/* Secondary */
.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-default);
}
.btn-secondary:hover { background-color: var(--bg-hover); border-color: var(--accent-border); color: var(--accent); }

.btn-success { background-color: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { filter: brightness(0.92); color: #fff; }
.btn-danger { background-color: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(0.92); color: #fff; }
.btn-warning { background-color: var(--warning); color: var(--warning-text); border-color: var(--warning); }
.btn-warning:hover { filter: brightness(0.92); color: var(--warning-text); }
.btn-info { background-color: var(--info); color: #fff; border-color: var(--info); }
.btn-info:hover { filter: brightness(0.92); color: #fff; }

/* Outline buttons */
.btn-outline-primary { color: var(--accent); border-color: var(--accent-border); background: transparent; }
.btn-outline-primary:hover { background-color: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.btn-outline-secondary { color: var(--text-secondary); border-color: var(--border-default); background: transparent; }
.btn-outline-secondary:hover { background-color: var(--bg-hover); color: var(--text-primary); }
.btn-outline-info { color: var(--info); border-color: var(--info); background: transparent; }
.btn-outline-info:hover { background-color: var(--info-soft); color: var(--info); }
.btn-outline-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-outline-danger:hover { background-color: var(--danger-soft); color: var(--danger); }
.btn-outline-success { color: var(--success); border-color: var(--success); background: transparent; }
.btn-outline-success:hover { background-color: var(--success-soft); color: var(--success); }
.btn-outline-warning { color: var(--warning); border-color: var(--warning); background: transparent; }
.btn-outline-warning:hover { background-color: var(--warning-soft); color: var(--warning); }

.active-nav-btn {
    background: var(--accent-gradient) !important;
    color: var(--text-on-accent) !important;
    border-color: transparent !important;
    box-shadow: var(--shadow-brand);
}

.btn-icon {
    width: 36px; height: 36px; padding: 0;
    border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
}

/* ============================================================
   6.1 Glass Button - Modern Premium Style
   ============================================================ */
.glass-btn-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.glass-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-arabic);
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    padding: 10px 20px;
    min-height: 42px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    background: linear-gradient(135deg, var(--modeer-indigo) 0%, var(--modeer-purple) 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
    overflow: hidden;
    z-index: 1;
}

/* Glass Button Icons */
.glass-btn i, .glass-btn svg, .glass-btn-sm i, .glass-btn-sm svg, .glass-btn-lg i, .glass-btn-lg svg {
    font-size: 1.1em;
}

.glass-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    z-index: -1;
}

.glass-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.45);
    filter: brightness(1.05);
}

.glass-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    filter: brightness(0.95);
}

.glass-btn:focus-visible {
    outline: 2px solid var(--modeer-indigo);
    outline-offset: 3px;
}

.glass-btn:disabled, .glass-btn.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Glass Button Sizes */
.glass-btn-sm {
    padding: 8px 16px;
    min-height: 36px;
    font-size: 13px;
    border-radius: 40px;
}

.glass-btn-lg {
    padding: 12px 24px;
    min-height: 46px;
    font-size: 15px;
    border-radius: 50px;
}

.glass-btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Secondary Glass Button */
.glass-btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.glass-btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Ghost/Soft Glass Button */
.glass-btn-soft {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid transparent;
    box-shadow: none;
}

.glass-btn-soft:hover {
    background: rgba(99, 102, 241, 0.2);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

/* ============================================================
   7. Forms
   ============================================================ */
.form-control, .form-select {
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
    outline: none;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background-color: var(--bg-input);
    color: var(--text-primary);
}
.form-control::placeholder { color: var(--text-muted); }
.form-select option { background-color: var(--bg-surface); color: var(--text-primary); }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

textarea.form-control { min-height: 90px; resize: vertical; }

.form-check-input {
    background-color: var(--bg-input);
    border-color: var(--border-default);
}
.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}
.form-check-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-group .form-control { border-radius: var(--radius-sm); }
.input-group-text {
    background-color: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}

/* ============================================================
   TASK 2: Bulletproof Dark/Light Mode — Override Bootstrap's
   hardcoded white backgrounds on form controls & filters.
   ============================================================ */

/* Force all form elements to respect theme tokens regardless of Bootstrap */
.form-control,
.form-select,
.form-control:not(:focus),
.form-select:not(:focus) {
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-default) !important;
}
.form-control:focus,
.form-select:focus {
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-soft) !important;
}
.form-control::placeholder {
    color: var(--text-muted) !important;
    opacity: 1;
}
/* Dropdown <option> native elements (where browsers allow) */
.form-select option,
select option {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}
/* input-group addon */
.input-group-text {
    background-color: var(--bg-surface-2) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-default) !important;
}
/* filter bar inputs specifically */
.filter-controls .form-control,
.filter-controls .form-select,
.customer-filters .form-control,
.customer-filters .form-select {
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-default) !important;
}
/* Quick-action outline buttons — ensure they don't get Bootstrap's white bg */
.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-info,
.btn-outline-success,
.btn-outline-danger,
.btn-outline-warning {
    background-color: transparent !important;
}
/* Disabled inputs */
.form-control:disabled,
.form-select:disabled,
.form-control[readonly] {
    background-color: var(--bg-surface-2) !important;
    color: var(--text-muted) !important;
    opacity: 0.7;
}

/* ============================================================
   8. Dashboard — Greeting Header + Stat Cards
   Replaces the old sparkles banner and info-box system.
   ============================================================ */

/* ── Greeting header ── */
.dash-greeting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 24px 28px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    flex-wrap: wrap;
}

.dash-greeting-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dash-greeting-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0;
    letter-spacing: 0.01em;
}

.dash-greeting-title {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.dash-greeting-name {
    color: var(--accent);
    position: relative;
}

.dash-greeting-right {
    flex-shrink: 0;
}

.dash-date-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 9999px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-subtle);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.dash-date-pill i {
    color: var(--accent);
    font-size: 13px;
    flex-shrink: 0;
}

@media (max-width: 576px) {
    .dash-greeting {
        padding: 18px 16px;
    }
    .dash-date-pill {
        font-size: 0.75rem;
        padding: 5px 10px;
    }
}

/* ── Stat Cards ── */
.dash-stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 20px 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
    outline: none;
    height: 100%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease;
    position: relative;
    overflow: hidden;
}

/* Subtle top-left accent line */
.dash-stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 3px;
    height: 40%;
    border-radius: 0 0 3px 3px;
    background: transparent;
    transition: background 0.18s ease, height 0.18s ease;
}

.dash-stat-card:hover {
    border-color: var(--accent-border);
    box-shadow: 0 0 0 3px var(--accent-soft), 0 4px 16px rgba(99,102,241,0.06);
}

.dash-stat-card:hover::before {
    background: var(--accent);
    height: 60%;
}

.dash-stat-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* Icon box */
.dash-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    transition: filter 0.18s ease;
}

.dash-stat-card:hover .dash-stat-icon {
    filter: brightness(0.92) saturate(1.2);
}

/* Label */
.dash-stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    margin-top: 2px;
}

/* Value */
.dash-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

/* Revenue card: force value to stay on one line */
.dash-stat-value--nowrap {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1.45rem;
}

/* Dark mode refinement */
[data-theme="dark"] .dash-stat-card {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .dash-greeting {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* ── Legacy .info-box stub (keep for any JS that checks class existence) ── */
.info-box { display: none; }

/* ============================================================
   9. Filters Container
   ============================================================ */
#filtersContainer, .bg-filters {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-lg) !important;
    padding: 18px !important;
    box-shadow: var(--shadow-xs);
    margin-bottom: 20px;
}
.bg-light { background-color: var(--bg-surface-2) !important; color: var(--text-primary) !important; }
.bg-light-alt { background-color: var(--bg-surface-2) !important; color: var(--text-primary) !important; }

/* ============================================================
   10. Tables — Enterprise, Data-Dense, Flat
   ============================================================ */

/* Wrapper */
.table-responsive {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    margin-bottom: 24px;
}

@media (max-width: 576px) {
    .table-responsive {
        border-radius: var(--radius-md);
    }
    .table-responsive .table {
        min-width: 600px;
    }
}

/* ── Base table reset ── */
.table {
    /* Override Bootstrap's CSS custom properties */
    --bs-table-color: var(--text-primary);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border-subtle);
    --bs-table-striped-color: var(--text-primary);
    --bs-table-striped-bg: transparent;
    --bs-table-hover-color: var(--text-primary);
    --bs-table-hover-bg: transparent;
    --bs-table-active-color: var(--text-primary);
    --bs-table-active-bg: transparent;

    width: 100%;
    margin-bottom: 0;
    font-size: 0.875rem;
    color: var(--text-primary);
    background-color: transparent;
    border-collapse: collapse;
    border-spacing: 0;
}

/* ── Header ── */
.table thead th {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    background-color: var(--bg-surface-2);
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    text-align: start;
    white-space: nowrap;
    vertical-align: middle;
}

/* ── Body cells ── */
.table tbody td,
.table tbody th {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    background-color: transparent;
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

/* No border on last row */
.table tbody tr:last-child > td,
.table tbody tr:last-child > th {
    border-bottom: none;
}

/* ── Row transition ── */
.table tbody tr {
    transition: background-color 0.12s ease;
}

/* ── Hover: light mode — barely-there indigo tint ── */
.table tbody tr:hover > td,
.table tbody tr:hover > th {
    background-color: rgba(99, 102, 241, 0.03);
    color: var(--text-primary);
}

/* ── Hover: dark mode — white whisper ── */
[data-theme="dark"] .table tbody tr:hover > td,
[data-theme="dark"] .table tbody tr:hover > th {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

/* ── Strip the Bootstrap striped pattern — uniform rows only ── */
.table-striped > tbody > tr > *,
.table-striped > tbody > tr > td,
.table-striped > tbody > tr > th {
    background-color: transparent !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
}

/* ── Strip Bootstrap hover override ── */
.table-hover > tbody > tr:hover > *,
.table-hover > tbody > tr:hover > td,
.table-hover > tbody > tr:hover > th {
    background-color: rgba(99, 102, 241, 0.03) !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
}
[data-theme="dark"] .table-hover > tbody > tr:hover > *,
[data-theme="dark"] .table-hover > tbody > tr:hover > td,
[data-theme="dark"] .table-hover > tbody > tr:hover > th {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

/* ── Remove all Bootstrap .table-bordered vertical lines ── */
.table-bordered,
.table-bordered > :not(caption) > * {
    border-color: var(--border-subtle);
}
.table-bordered > :not(caption) > * > * {
    border-width: 0;
}

/* ── .table-dark-header: sticky headers in mega modals ── */
.table .table-dark-header th,
.table-dark-header th {
    background-color: var(--bg-surface-2);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
    vertical-align: middle;
    padding: 0.5rem 0.75rem;
}

/* ── Mobile: tighten further on small screens ── */
@media (max-width: 576px) {
    .table,
    .table tbody td,
    .table tbody th,
    .table thead th {
        font-size: 0.8125rem;
    }
    .table thead th,
    .table tbody td,
    .table tbody th {
        padding: 0.4rem 0.6rem;
    }
}

/* ============================================================
   11. Cards
   ============================================================ */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    color: var(--text-primary);
}
.card-header {
    background-color: var(--bg-surface-2);
    border-bottom: 1px solid var(--border-subtle);
    padding: 14px 18px;
    font-weight: 600;
    color: var(--text-primary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}
.card-body { padding: 18px; color: var(--text-primary); }
.card-footer { background-color: var(--bg-surface-2); border-top: 1px solid var(--border-subtle); padding: 12px 18px; }

/* ============================================================
   12. Modals
   ============================================================ */
.modal-backdrop { background-color: var(--bg-overlay); }
.modal-backdrop.show { opacity: 1; }
.modal-content {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}
.modal-header {
    border-bottom: 1px solid var(--border-subtle);
    padding: 18px 22px;
}
.modal-title { color: var(--text-primary); font-weight: 700; font-size: 18px; }
.modal-body { padding: 22px; color: var(--text-primary); }
.modal-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 14px 22px;
    gap: 8px;
}
/* Base Close Button */
.btn-close {
    background-color: var(--bg-surface-2) !important;
    border-radius: 50% !important;
    opacity: 0.7 !important;
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    margin: 0 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2364748B'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") !important;
    background-size: 12px auto !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    box-shadow: none !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    box-sizing: border-box !important;
}

/* Hover State */
.btn-close:hover {
    opacity: 1 !important;
    background-color: var(--border-default) !important;
    transform: rotate(90deg) scale(1.1);
}

/* Dark Mode: Swap SVG color instead of using filter */
[data-theme="dark"] .btn-close {
    filter: none !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23F1F5F9'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") !important;
}

/* ============================================================
   13. Badges — Base
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.4;
    border: 1px solid transparent;
    white-space: nowrap;
}
.bg-primary {
    background: var(--accent-gradient) !important;
    color: var(--text-on-accent) !important;
}
.bg-success { background-color: var(--success) !important; color: #fff !important; }
.bg-danger  { background-color: var(--danger)  !important; color: #fff !important; }
.bg-warning { background-color: var(--warning) !important; color: var(--warning-text) !important; }
.bg-info    { background-color: var(--info)    !important; color: #fff !important; }
.bg-secondary {
    background-color: var(--bg-surface-2) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-default);
}

/* ============================================================
   Premium Status Badges (Soft / Adaptive Style)
   — Light-mode uses darker, legible tones.
   — Dark-mode uses lighter, vibrant tones.
   — NO hardcoded white text; every color is theme-aware.
   ============================================================ */
.badge {
    border: none !important;
    font-weight: 700 !important;
    padding: 6px 12px !important;
    letter-spacing: 0.2px !important;
}

/* ── Success / فعال ── */
.badge.badge-success, .badge.bg-success {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: #047857 !important;   /* dark green — readable on white */
}

/* ── Warning / قريب ── (was badge-yellow — NOW has a rule) */
.badge.badge-yellow, .badge.badge-warning, .badge.bg-warning {
    background-color: rgba(245, 158, 11, 0.15) !important;
    color: #92400E !important;   /* dark amber — readable on white */
}

/* ── Critical / ينتهي قريباً ── */
.badge.badge-orange {
    background-color: rgba(249, 115, 22, 0.15) !important;
    color: #7C2D12 !important;   /* dark orange-red — readable on white */
}

/* ── Danger / منتهي ── */
.badge.badge-danger, .badge.bg-danger {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: #991B1B !important;   /* dark red — readable on white */
}

/* ── Info ── */
.badge.badge-info, .badge.bg-info {
    background-color: rgba(59, 130, 246, 0.15) !important;
    color: #1E40AF !important;   /* dark blue — readable on white */
}

/* ── Secondary / غير معروف ── */
.badge.badge-secondary {
    background-color: var(--bg-surface-2) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-default) !important;
}

/* ── Dark Mode: switch to lighter, vibrant colors ── */
[data-theme="dark"] .badge.badge-success,
[data-theme="dark"] .badge.bg-success {
    background-color: rgba(52, 211, 153, 0.2) !important;
    color: #6EE7B7 !important;
}
[data-theme="dark"] .badge.badge-yellow,
[data-theme="dark"] .badge.badge-warning,
[data-theme="dark"] .badge.bg-warning {
    background-color: rgba(251, 191, 36, 0.2) !important;
    color: #FDE68A !important;
}
[data-theme="dark"] .badge.badge-orange {
    background-color: rgba(251, 146, 60, 0.2) !important;
    color: #FED7AA !important;
}
[data-theme="dark"] .badge.badge-danger,
[data-theme="dark"] .badge.bg-danger {
    background-color: rgba(248, 113, 113, 0.2) !important;
    color: #FCA5A5 !important;
}
[data-theme="dark"] .badge.badge-info,
[data-theme="dark"] .badge.bg-info {
    background-color: rgba(96, 165, 250, 0.2) !important;
    color: #BAE6FD !important;
}
[data-theme="dark"] .badge.badge-secondary {
    background-color: var(--bg-surface-2) !important;
    color: var(--text-secondary) !important;
}

/* ============================================================
   status-badge-pro — Unified Adaptive Component
   Use: <span class="status-badge-pro success|warning|danger|critical|info">
          <span class="status-dot"></span> النص
        </span>
   ============================================================ */
.status-badge-pro {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    border: 1px solid transparent;
}
.status-badge-pro .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse-live 1.5s ease-in-out infinite;
}

/* success — فعال */
.status-badge-pro.success {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.25);
}
.status-badge-pro.success .status-dot {
    background: #10B981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
}

/* warning — قريب */
.status-badge-pro.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #92400E;
    border-color: rgba(245, 158, 11, 0.25);
}
.status-badge-pro.warning .status-dot {
    background: #F59E0B;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.7);
}

/* critical — ينتهي قريباً */
.status-badge-pro.critical {
    background: rgba(249, 115, 22, 0.15);
    color: #7C2D12;
    border-color: rgba(249, 115, 22, 0.25);
}
.status-badge-pro.critical .status-dot {
    background: #F97316;
    box-shadow: 0 0 6px rgba(249, 115, 22, 0.7);
}

/* danger — منتهي */
.status-badge-pro.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #991B1B;
    border-color: rgba(239, 68, 68, 0.25);
}
.status-badge-pro.danger .status-dot {
    background: #EF4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.7);
}

/* info */
.status-badge-pro.info {
    background: rgba(59, 130, 246, 0.15);
    color: #1E40AF;
    border-color: rgba(59, 130, 246, 0.25);
}
.status-badge-pro.info .status-dot {
    background: #3B82F6;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.7);
}

/* secondary — غير معروف */
.status-badge-pro.secondary {
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    border-color: var(--border-default);
}
.status-badge-pro.secondary .status-dot {
    background: var(--text-muted);
    box-shadow: none;
    animation: none;
}

/* ── Dark Mode overrides for status-badge-pro ── */
[data-theme="dark"] .status-badge-pro.success {
    background: rgba(52, 211, 153, 0.18);
    color: #6EE7B7;
    border-color: rgba(52, 211, 153, 0.30);
}
[data-theme="dark"] .status-badge-pro.success .status-dot { background: #34D399; }

[data-theme="dark"] .status-badge-pro.warning {
    background: rgba(251, 191, 36, 0.18);
    color: #FDE68A;
    border-color: rgba(251, 191, 36, 0.30);
}
[data-theme="dark"] .status-badge-pro.warning .status-dot { background: #FBBF24; }

[data-theme="dark"] .status-badge-pro.critical {
    background: rgba(251, 146, 60, 0.18);
    color: #FED7AA;
    border-color: rgba(251, 146, 60, 0.30);
}
[data-theme="dark"] .status-badge-pro.critical .status-dot { background: #FB923C; }

[data-theme="dark"] .status-badge-pro.danger {
    background: rgba(248, 113, 113, 0.18);
    color: #FCA5A5;
    border-color: rgba(248, 113, 113, 0.30);
}
[data-theme="dark"] .status-badge-pro.danger .status-dot { background: #F87171; }

[data-theme="dark"] .status-badge-pro.info {
    background: rgba(96, 165, 250, 0.18);
    color: #BAE6FD;
    border-color: rgba(96, 165, 250, 0.30);
}
[data-theme="dark"] .status-badge-pro.info .status-dot { background: #60A5FA; }

.status-live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    margin-inline-start: 6px;
    vertical-align: middle;
    animation: pulse-live 1.5s ease-in-out infinite;
}

@keyframes pulse-live {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

.search-clear-btn {
    position: absolute;
    inset-inline-start: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    z-index: 10;
    display: none;
    font-size: 18px;
    font-weight: bold;
}

.search-clear-btn:hover {
    color: var(--danger);
}

.search-input-with-clear {
    position: relative;
    padding-inline-end: 36px !important;
}

[dir="rtl"] .search-clear-btn {
    left: auto;
    right: 8px;
}

/* ============================================================
   14. Toasts
   ============================================================ */
.toast-container { z-index: 2000; }
.toast {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    min-width: 320px;
}
.toast.bg-success { background-color: var(--success) !important; color: #fff !important; border-color: var(--success); }
.toast.bg-danger  { background-color: var(--danger) !important;  color: #fff !important; border-color: var(--danger); }
.toast.bg-warning { background-color: var(--warning) !important; color: var(--warning-text) !important; border-color: var(--warning); }
.toast.bg-info    { background-color: var(--info) !important;    color: #fff !important; border-color: var(--info); }
.toast.bg-primary { background: var(--accent-gradient) !important; color: var(--text-on-accent) !important; }
.toast .toast-body { padding: 12px 14px; }

/* ============================================================
   15. Alerts
   ============================================================ */
.alert {
    border-radius: var(--radius-md);
    padding: 12px 16px;
    border: 1px solid transparent;
    font-size: 14px;
}
.alert-primary { background-color: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.alert-success { background-color: var(--success-soft); color: var(--success); border-color: var(--success); }
.alert-danger  { background-color: var(--danger-soft);  color: var(--danger);  border-color: var(--danger); }
.alert-warning { background-color: var(--warning-soft); color: var(--warning); border-color: var(--warning); }
.alert-info    { background-color: var(--info-soft);    color: var(--info);    border-color: var(--info); }

/* ============================================================
   16. Dropdowns
   ============================================================ */
.dropdown-menu {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    color: var(--text-primary);
}
.dropdown-item {
    color: var(--text-primary);
    border-radius: var(--radius-xs);
    padding: 8px 12px;
    font-size: 14px;
}
.dropdown-item:hover, .dropdown-item:focus { background-color: var(--bg-hover); color: var(--accent); }
.dropdown-divider { border-color: var(--border-subtle); }

/* ============================================================
   17. Page Headers
   ============================================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-subtle);
}
.page-header h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.page-header h2 i {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.back-to-dashboard-btn { display: none !important; }

/* ============================================================
   18. Utility classes
   ============================================================ */
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-brand { box-shadow: var(--shadow-brand) !important; }

.border { border: 1px solid var(--border-subtle) !important; }
.border-bottom { border-bottom: 1px solid var(--border-subtle) !important; }
.border-top { border-top: 1px solid var(--border-subtle) !important; }

.rounded { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }

.bg-white { background-color: var(--bg-surface) !important; color: var(--text-primary) !important; }
.bg-body { background-color: var(--bg-app) !important; }
.bg-brand { background: var(--accent-gradient) !important; color: #FFFFFF !important; }

hr { border-color: var(--border-subtle); opacity: 1; }

/* ============================================================
   19. Empty state / Loading
   ============================================================ */
.spinner-border {
    display: inline-block;
    width: 1.2rem;
    height: 1.2rem;
    border: 0.2em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    vertical-align: -0.125em;
    color: var(--accent);
}
.spinner-border-sm { width: 1rem; height: 1rem; border-width: 0.15em; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state i { font-size: 40px; margin-bottom: 12px; color: var(--text-muted); opacity: 0.6; }

/* ============================================================
   20. SweetAlert Overrides
   ============================================================ */
.swal2-popup {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-lg) !important;
    border: 1px solid var(--border-default) !important;
    box-shadow: var(--shadow-xl) !important;
}
.swal2-title, .swal2-html-container { color: var(--text-primary) !important; }
.swal2-styled.swal2-confirm {
    background: var(--accent-gradient) !important;
    border-radius: var(--radius-md) !important;
    border: none !important;
    box-shadow: var(--shadow-brand) !important;
}
.swal2-styled.swal2-confirm:hover {
    background: var(--accent-gradient-hover) !important;
    box-shadow: var(--shadow-brand-lg) !important;
}
.swal2-styled.swal2-cancel {
    background-color: var(--bg-surface-2) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-md) !important;
}

/* ============================================================
   21. Page Containers
   ============================================================ */
#mainDashboardPage,
#customersPage,
#prospectsPage,
#subscriptionsPage,
#messageTemplatesPage,
#emailManagementPage,
#remindersPage {
    padding: 0;
    margin: 0;
    max-width: 100%;
}
#mainDashboardPage .container,
#customersPage,
#prospectsPage,
#subscriptionsPage,
#messageTemplatesPage,
#emailManagementPage,
#remindersPage {
    background: transparent;
    border: none;
    box-shadow: none;
}

#mainNavigationButtons.legacy-hidden { display: none !important; }
#mainDashboardPage > .container > header { display: none; }

/* ============================================================
   21. Premium Profile Dropdown
   ============================================================ */
.profile-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.profile-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 12px;
    background: transparent;
    border: 1px solid var(--border-default);
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-dropdown-trigger:hover {
    background: var(--bg-hover);
    border-color: var(--accent-border);
}

.profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 10px;
}

.profile-avatar-improved {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    position: relative;
    overflow: hidden;
}

.profile-avatar-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(14, 165, 233, 0.15) 100%);
    z-index: 0;
}

.profile-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
}

.profile-info {
    text-align: start;
}

.profile-name {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
}

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

.profile-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.profile-arrow.rotate-180 {
    transform: rotate(180deg);
}

.profile-dropdown-trigger[aria-expanded="true"] .profile-arrow {
    transform: rotate(180deg);
}

.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    width: 220px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(12px);
    opacity: 0;
    transform: scale(0.95) translateY(-8px);
    transform-origin: top end;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
}

[dir="rtl"] .profile-dropdown-menu {
    transform-origin: top start;
}

.profile-dropdown-menu.show {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.profile-dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.profile-dropdown-item svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.profile-dropdown-item span {
    flex: 1;
    text-align: start;
}

.profile-dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.profile-dropdown-item.text-danger {
    color: var(--danger);
}

.profile-dropdown-item.text-danger:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 6px 8px;
}

.profile-subscription-info {
    padding: 8px 12px;
    margin: 4px 0;
}

.profile-subscription-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 12px;
}

.profile-subscription-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.profile-subscription-row:last-child {
    margin-bottom: 0;
}

.profile-subscription-key {
    font-size: 12px;
    color: var(--text-muted);
}

.profile-subscription-value {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.profile-subscription-value.text-success {
    color: var(--success) !important;
}

.profile-subscription-value.text-warning {
    color: var(--warning) !important;
}

.profile-subscription-value.text-danger {
    color: var(--danger) !important;
}

/* ============================================================
   22. Responsive
   ============================================================ */
@media (max-width: 991px) {
    .app-sidebar {
        transform: translateX(100%);
        width: var(--sidebar-width);
    }
    body.sidebar-open .app-sidebar { transform: translateX(0); box-shadow: var(--shadow-xl); }
    .app-main { margin-right: 0 !important; }
    body.sidebar-collapsed .app-main { margin-right: 0 !important; }
    .mobile-menu-toggle { display: inline-flex; }
    .app-content { padding: 20px 16px; }
    .app-topbar { padding: 12px 16px; }

    .app-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background-color: var(--bg-overlay);
        z-index: 99;
    }
    body.sidebar-open .app-sidebar-overlay { display: block; }

    h1 { font-size: 22px; }
    h2 { font-size: 18px; }
    .info-box { padding: 16px; gap: 12px; }
    .info-box-icon { width: 40px; height: 40px; font-size: 17px; }
    .info-box-number { font-size: 22px; }
}

@media (max-width: 576px) {
    .app-content { padding: 16px 12px; }
    .btn { padding: 8px 14px; font-size: 13px; }
    .btn-lg { padding: 10px 18px; font-size: 14px; }
    .topbar-title { font-size: 15px; }
    .topbar-clock { display: none; }
}

/* ============================================================
   23. Accessibility - prefer reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   24. Print
   ============================================================ */
@media print {
    .app-sidebar, .app-topbar, .mobile-menu-toggle, .btn, .sidebar-toggle { display: none !important; }
    .app-main { margin: 0 !important; }
    .app-content { padding: 0 !important; }
    body { background: #fff !important; color: #000 !important; }
    .surface-card, .info-box, .card { box-shadow: none !important; border: 1px solid #ccc !important; }
    .sidebar-brand, .text-brand {
        -webkit-text-fill-color: #6366F1 !important;
        color: #6366F1 !important;
    }
}

/* ============================================================
   25. Enhanced Mobile Responsive Fixes
   ============================================================ */

/* Prevent horizontal scroll on all devices */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Table responsive fixes */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100vw;
}

.table-responsive table {
    min-width: 500px;
    width: 100%;
}

/* Fix long text on mobile */
.text-truncate {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 576px) {
    .text-truncate {
        max-width: 100px;
    }
}

/* Modal responsive */
.modal-dialog {
    max-width: calc(100% - 30px) !important;
    margin: 15px auto !important;
}

.modal-content {
    max-height: calc(100vh - 30px);
    overflow-y: auto;
}

/* ============================================================
   26. Mega Modal — Full-Screen Actions Log (Apple-style)
   Targets .modal-mega, #customerActionsModal, #allActionsModal, #activityLogModal
   ============================================================ */

/* ── Desktop: 95vw × 90vh centred ── */
@media (min-width: 992px) {
    .modal-mega .modal-dialog,
    #customerActionsModal .modal-dialog,
    #allActionsModal .modal-dialog,
    #activityLogModal .modal-dialog {
        max-width: 95vw !important;
        width: 95vw !important;
        margin: 2.5vh auto !important; /* override the global 15px margin */
    }

    /* Fix: override the global .modal-dialog rule that caps at calc(100%-30px) */
    #customerActionsModal .modal-dialog,
    #allActionsModal .modal-dialog,
    #activityLogModal .modal-dialog {
        max-width: 95vw !important;
    }

    .modal-mega .modal-content,
    #customerActionsModal .modal-content,
    #allActionsModal .modal-content,
    #activityLogModal .modal-content {
        height: 90vh;
        max-height: 90vh;
        overflow: hidden; /* body scrolls, not the whole content */
        display: flex;
        flex-direction: column;
        border-radius: var(--radius-lg);
        box-shadow:
            0 0 0 1px rgba(99,102,241,0.1),
            0 32px 64px -16px rgba(0,0,0,0.45);
    }

    /* Let the modal-body flex-grow and scroll independently */
    .modal-mega .modal-body,
    #customerActionsModal .modal-body,
    #allActionsModal .modal-body,
    #activityLogModal .modal-body {
        flex: 1 1 0;
        overflow: hidden; /* table-responsive handles its own scroll */
        padding: 0 !important;
    }

    /* Table wrapper fills the remaining height */
    #customerActionsModal .table-responsive,
    #allActionsModal .table-responsive,
    #activityLogModal .table-responsive {
        height: 100%;
        overflow-y: auto;
        overflow-x: auto;
    }
}

/* ── Actions Log Table — Premium Apple-style ── */
.actions-log-table {
    font-size: 14px;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.actions-log-table thead th {
    background: var(--bg-body) !important;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 14px 20px;
    border-bottom: 2px solid var(--border-subtle);
    white-space: nowrap;
}

.actions-log-table tbody tr {
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--border-subtle);
}

.actions-log-table tbody tr:last-child {
    border-bottom: none;
}

.actions-log-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

.actions-log-table tbody td {
    padding: 14px 20px;
    color: var(--text-secondary);
    vertical-align: middle;
    border-bottom: 1px solid var(--border-subtle);
}

.actions-log-table tbody td:first-child {
    padding-inline-start: 28px;
    color: var(--text-muted);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Mega modal header — clean, theme-aware */
#customerActionsModal .modal-header,
#allActionsModal .modal-header,
#activityLogModal .modal-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    padding: 16px 24px;
    flex-shrink: 0;
    color: var(--text-primary);
}

#customerActionsModal .modal-header .modal-title,
#allActionsModal .modal-header .modal-title,
#activityLogModal .modal-header .modal-title {
    color: var(--text-primary);
}

#customerActionsModal .modal-header .btn-close,
#allActionsModal .modal-header .btn-close,
#activityLogModal .modal-header .btn-close {
    filter: none;
    opacity: 0.5;
}

[data-theme="dark"] #customerActionsModal .modal-header .btn-close,
[data-theme="dark"] #allActionsModal .modal-header .btn-close,
[data-theme="dark"] #activityLogModal .modal-header .btn-close {
    filter: invert(1) grayscale(1);
    opacity: 0.6;
}

#customerActionsModal .modal-footer,
#allActionsModal .modal-footer,
#activityLogModal .modal-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border-subtle);
    padding: 14px 28px;
    background: var(--bg-surface);
}

/* ============================================================
   27. RTL Form Select — Chevron & Spacing Fix
   Fixes the dropdown arrow overlapping Arabic text in RTL mode.
   ============================================================ */

/* ── Global RTL fix for ALL .form-select ── */
[dir="rtl"] .form-select,
html[lang="ar"] .form-select,
.form-select {
    /* Move Bootstrap's chevron arrow to the LEFT side */
    background-position: left 0.75rem center !important;
    /* Reserve space on the left for the chevron icon */
    padding-left: 2.5rem !important;
    /* Reset Bootstrap's default RTL right-padding override */
    padding-right: 0.75rem !important;
    /* Prevent long option text from breaking layout */
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

/* Keep focus state consistent */
[dir="rtl"] .form-select:focus,
html[lang="ar"] .form-select:focus,
.form-select:focus {
    background-position: left 0.75rem center !important;
    padding-left: 2.5rem !important;
    padding-right: 0.75rem !important;
}

/* ── Reminders Page — Filter Container breathing room ──
   Ensures the 5 filter inputs have proper vertical + horizontal
   gap and don't squish on mid-size desktops.
   ============================================================ */
#remindersFiltersContainer {
    gap: 0; /* handled by Bootstrap .row.g-3 col gutters */
    background: var(--bg-surface);
    border-color: var(--border-subtle) !important;
    border-radius: var(--radius-md) !important;
}

/* Ensure every filter column label has breathing room */
#remindersFiltersContainer .form-label {
    margin-bottom: 0.35rem;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Tighten select height inside the filter bar */
#remindersFiltersContainer .form-select {
    font-size: 13px;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
}

/* ============================================================
   28. Quick Actions — Button Dark Mode Fixes
   Ensures btn-outline-warning stays readable in dark mode
   and WhatsApp button uses brand green.
   ============================================================ */

/* Guarantee outline-warning text/icon is always the warning amber colour,
   even if a dark-mode theme inadvertently inherits a dark foreground */
.btn-outline-warning {
    color: #ffc107 !important;
    border-color: #ffc107 !important;
}
.btn-outline-warning:hover,
.btn-outline-warning:focus,
.btn-outline-warning:active {
    color: #000 !important;
    background-color: #ffc107 !important;
    border-color: #ffc107 !important;
}

[data-theme="dark"] .btn-outline-warning {
    color: #ffd55a !important;
    border-color: #ffd55a !important;
}
[data-theme="dark"] .btn-outline-warning:hover,
[data-theme="dark"] .btn-outline-warning:active {
    color: #111 !important;
    background-color: #ffd55a !important;
}

/* ── Reminders Page header h2 icon gap ── */
#remindersPage > div:first-child h2 {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;   /* 8px between bell icon and title text */
}

#remindersPage > div:first-child h2 i {
    flex-shrink: 0;
    font-size: 0.9em;  /* slightly smaller than the text */
    opacity: 0.85;
}

/* Form controls mobile */
.form-control, .form-select {
    font-size: 16px !important; /* Prevent zoom on iOS */
    padding: 10px 12px;
}

/* ============================================================
   29. Compact Customer Modal — #addEditCustomerModal
   Enterprise-grade form layout. Tight, readable, no vertical scroll
   on desktop. All .cmodal-* classes scoped to this modal only.
   ============================================================ */

/* Modal body padding reduction */
#addEditCustomerModal .modal-body.cmodal-body {
    padding: 16px 20px 8px;
}

/* Labels: muted, small, tight */
#addEditCustomerModal .cmodal-label {
    display: block;
    font-size: 0.775rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    letter-spacing: 0.01em;
}

/* Compact inputs & selects */
#addEditCustomerModal .cmodal-input,
#addEditCustomerModal .cmodal-input-group .form-control,
#addEditCustomerModal .cmodal-input-group .form-select {
    font-size: 0.875rem !important;
    padding: 0.35rem 0.7rem !important;
    border-radius: 8px !important;
    background-color: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border-default);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    min-height: unset;
}

#addEditCustomerModal .cmodal-input:focus,
#addEditCustomerModal .cmodal-input-group .form-control:focus,
#addEditCustomerModal .cmodal-input-group .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

/* Input group: fix border radius on joined country code + phone */
#addEditCustomerModal .cmodal-input-group {
    display: flex;
    gap: 0;
}
#addEditCustomerModal .cmodal-input-group .form-select:first-child {
    border-radius: 8px 0 0 8px !important;
    border-right-width: 0 !important;
    flex-shrink: 0;
}
#addEditCustomerModal .cmodal-input-group .form-control:last-child {
    border-radius: 0 8px 8px 0 !important;
}

/* Textarea: lock resize to horizontal only */
#addEditCustomerModal textarea.cmodal-input {
    resize: vertical;
    min-height: 58px;
    max-height: 100px;
}

/* Section divider between personal + subscription blocks */
#addEditCustomerModal .cmodal-section-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
#addEditCustomerModal .cmodal-section-divider::before,
#addEditCustomerModal .cmodal-section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

/* Modal footer: tighter */
#addEditCustomerModal .modal-footer {
    padding: 10px 20px;
}

/* Dark mode overrides */
[data-theme="dark"] #addEditCustomerModal .cmodal-input,
[data-theme="dark"] #addEditCustomerModal .cmodal-input-group .form-control,
[data-theme="dark"] #addEditCustomerModal .cmodal-input-group .form-select {
    background-color: var(--bg-input);
    border-color: var(--border-default);
    color: var(--text-primary);
}


/* ============================================================
   29. Enterprise Button System — Flat, Minimalist, Professional
   Replaces Bootstrap defaults with crisp, stable, precise buttons.
   No lift, no gradients, no heavy shadows.
   ============================================================ */

/* ── Base ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: fit-content;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.01em;
    padding: 0.35rem 0.85rem;
    border-radius: 8px;
    border-width: 1px;
    border-style: solid;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.1s ease;
    -webkit-font-smoothing: antialiased;
    cursor: pointer;
    white-space: nowrap;
}

/* No lift on hover — background shift only */
.btn:hover:not(:disabled) {
    transform: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Micro press on click */
.btn:active:not(:disabled) {
    transform: scale(0.98);
    transition-duration: 0.08s;
    box-shadow: none;
}

/* Disabled */
.btn:disabled,
.btn.disabled {
    opacity: 0.45;
    pointer-events: none;
    box-shadow: none;
}

/* Small */
.btn-sm {
    font-size: 0.8rem;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    gap: 0.3rem;
}

/* Large */
.btn-lg {
    font-size: 0.9375rem;
    padding: 0.5rem 1.25rem;
    border-radius: 10px;
}

/* Focus ring */
.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    box-shadow: 0 0 0 3px var(--accent-soft) !important;
}

/* Dropdown caret spacing */
.btn.dropdown-toggle::after {
    margin-inline-start: 0.3em;
}


/* ── Solid: Primary ── */
.btn-primary {
    background-color: var(--modeer-indigo);
    border-color: var(--modeer-indigo);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background-color: var(--modeer-indigo-hover);
    border-color: var(--modeer-indigo-hover);
    color: #fff;
}
.btn-primary:active:not(:disabled) {
    background-color: #4338ca;
    border-color: #4338ca;
}
[data-theme="dark"] .btn-primary {
    background-color: var(--modeer-indigo-light);
    border-color: var(--modeer-indigo-light);
    color: #0f172a;
}
[data-theme="dark"] .btn-primary:hover:not(:disabled) {
    background-color: #a5b4fc;
    border-color: #a5b4fc;
    color: #0f172a;
}


/* ── Solid: Secondary ── */
.btn-secondary {
    background-color: var(--bg-surface-2);
    border-color: var(--border-strong);
    color: var(--text-secondary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] .btn-secondary {
    background-color: #334155;
    border-color: var(--border-default);
    color: var(--text-secondary);
}
[data-theme="dark"] .btn-secondary:hover:not(:disabled) {
    background-color: #3e526a;
    color: var(--text-primary);
}


/* ── Solid: Success ── */
.btn-success {
    background-color: var(--success);
    border-color: var(--success);
    color: #fff;
}
.btn-success:hover:not(:disabled) {
    background-color: #0da572;
    border-color: #0da572;
    color: #fff;
}
[data-theme="dark"] .btn-success {
    background-color: #10b981;
    border-color: #10b981;
    color: #fff;
}
[data-theme="dark"] .btn-success:hover:not(:disabled) {
    background-color: #34d399;
    border-color: #34d399;
    color: #0f172a;
}


/* ── Solid: Danger ── */
.btn-danger {
    background-color: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
    border-color: #dc2626;
    color: #fff;
}
[data-theme="dark"] .btn-danger {
    background-color: #ef4444;
    border-color: #ef4444;
    color: #fff;
}
[data-theme="dark"] .btn-danger:hover:not(:disabled) {
    background-color: #f87171;
    border-color: #f87171;
    color: #0f172a;
}


/* ── Solid: Warning ── */
.btn-warning {
    background-color: var(--warning);
    border-color: var(--warning);
    color: #0f172a;
}
.btn-warning:hover:not(:disabled) {
    background-color: #d97706;
    border-color: #d97706;
    color: #0f172a;
}
[data-theme="dark"] .btn-warning {
    background-color: #fbbf24;
    border-color: #fbbf24;
    color: #0f172a;
}
[data-theme="dark"] .btn-warning:hover:not(:disabled) {
    background-color: #fcd34d;
    border-color: #fcd34d;
}


/* ── Solid: Info ── */
.btn-info {
    background-color: var(--info);
    border-color: var(--info);
    color: #fff;
}
.btn-info:hover:not(:disabled) {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
[data-theme="dark"] .btn-info {
    background-color: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}
[data-theme="dark"] .btn-info:hover:not(:disabled) {
    background-color: #60a5fa;
    border-color: #60a5fa;
    color: #0f172a;
}


/* ── Outline: Primary ── */
.btn-outline-primary {
    background-color: transparent;
    border-color: var(--modeer-indigo);
    color: var(--modeer-indigo);
    box-shadow: none;
}
.btn-outline-primary:hover:not(:disabled) {
    background-color: rgba(99, 102, 241, 0.06);
    border-color: var(--modeer-indigo);
    color: var(--modeer-indigo);
    box-shadow: none;
}
[data-theme="dark"] .btn-outline-primary {
    border-color: var(--modeer-indigo-light);
    color: var(--modeer-indigo-light);
}
[data-theme="dark"] .btn-outline-primary:hover:not(:disabled) {
    background-color: rgba(129, 140, 248, 0.10);
    border-color: var(--modeer-indigo-light);
    color: var(--modeer-indigo-light);
}


/* ── Outline: Secondary ── */
.btn-outline-secondary {
    background-color: transparent;
    border-color: var(--border-strong);
    color: var(--text-secondary);
    box-shadow: none;
}
.btn-outline-secondary:hover:not(:disabled) {
    background-color: rgba(71, 85, 105, 0.06);
    border-color: var(--border-strong);
    color: var(--text-primary);
    box-shadow: none;
}
[data-theme="dark"] .btn-outline-secondary {
    border-color: var(--border-default);
    color: var(--text-secondary);
}
[data-theme="dark"] .btn-outline-secondary:hover:not(:disabled) {
    background-color: rgba(148, 163, 184, 0.08);
    color: var(--text-primary);
}


/* ── Outline: Success ── */
.btn-outline-success {
    background-color: transparent;
    border-color: var(--success);
    color: var(--success);
    box-shadow: none;
}
.btn-outline-success:hover:not(:disabled) {
    background-color: rgba(16, 185, 129, 0.06);
    border-color: var(--success);
    color: var(--success);
}
[data-theme="dark"] .btn-outline-success {
    border-color: #34d399;
    color: #34d399;
}
[data-theme="dark"] .btn-outline-success:hover:not(:disabled) {
    background-color: rgba(52, 211, 153, 0.08);
    color: #6ee7b7;
}


/* ── Outline: Danger ── */
.btn-outline-danger {
    background-color: transparent;
    border-color: var(--danger);
    color: var(--danger);
    box-shadow: none;
}
.btn-outline-danger:hover:not(:disabled) {
    background-color: rgba(239, 68, 68, 0.05);
    border-color: var(--danger);
    color: var(--danger);
}
[data-theme="dark"] .btn-outline-danger {
    border-color: #f87171;
    color: #f87171;
}
[data-theme="dark"] .btn-outline-danger:hover:not(:disabled) {
    background-color: rgba(248, 113, 113, 0.08);
    color: #fca5a5;
}


/* ── Outline: Warning ── */
.btn-outline-warning {
    background-color: transparent;
    border-color: #ffc107 !important;
    color: #ffc107 !important;
    box-shadow: none;
}
.btn-outline-warning:hover:not(:disabled) {
    background-color: rgba(255, 193, 7, 0.07) !important;
    border-color: #ffc107 !important;
    color: #ffc107 !important;
}
.btn-outline-warning:active:not(:disabled) {
    background-color: rgba(255, 193, 7, 0.14) !important;
}
[data-theme="dark"] .btn-outline-warning {
    border-color: #ffd55a !important;
    color: #ffd55a !important;
}
[data-theme="dark"] .btn-outline-warning:hover:not(:disabled) {
    background-color: rgba(255, 213, 90, 0.08) !important;
    color: #fde68a !important;
}


/* ── Outline: Info ── */
.btn-outline-info {
    background-color: transparent;
    border-color: var(--info);
    color: var(--info);
    box-shadow: none;
}
.btn-outline-info:hover:not(:disabled) {
    background-color: rgba(59, 130, 246, 0.06);
    border-color: var(--info);
    color: var(--info);
}
[data-theme="dark"] .btn-outline-info {
    border-color: #60a5fa;
    color: #60a5fa;
}
[data-theme="dark"] .btn-outline-info:hover:not(:disabled) {
    background-color: rgba(96, 165, 250, 0.08);
    color: #93c5fd;
}


/* ── btn-close ── */
.btn-close {
    border-radius: 6px;
    transition: opacity 0.15s ease, transform 0.2s ease;
    opacity: 0.5;
    box-shadow: none;
}
.btn-close:hover {
    opacity: 0.85;
    transform: rotate(90deg);
    box-shadow: none;
}

@media (max-width: 576px) {
    .form-control, .form-select {
        padding: 8px 10px;
        font-size: 14px;
    }
    
    .form-label {
        font-size: 13px;
    }
}

/* Button responsive */
.btn {
    white-space: normal !important;
    word-wrap: break-word;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

@media (max-width: 576px) {
    .btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .btn-block {
        width: 100%;
        display: block;
    }
}

/* Card responsive */
.card {
    overflow: hidden;
}

@media (max-width: 576px) {
    .card {
        margin-bottom: 15px;
        border-radius: var(--radius-md);
    }
    
    .card-body {
        padding: 12px;
    }
}

/* Grid system mobile fixes */
@media (max-width: 576px) {
    .row {
        margin-left: -7px;
        margin-right: -7px;
    }
    
    .row > [class*="col-"] {
        padding-left: 7px;
        padding-right: 7px;
    }
}

/* Sidebar mobile fix */
@media (max-width: 768px) {
    .app-sidebar {
        width: 100% !important;
        max-width: 280px;
        transform: translateX(-100%);
    }
    
    .app-sidebar.active {
        transform: translateX(0);
    }
    
    .app-main {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* Topbar mobile */
@media (max-width: 576px) {
    .app-topbar {
        padding: 10px 15px;
    }
    
    .topbar-title {
        font-size: 16px;
    }
    
    .profile-dropdown-wrapper {
        padding: 5px;
    }
}

/* Dashboard stats mobile */
@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card-value {
        font-size: 24px;
    }
    
    .stat-card-label {
        font-size: 12px;
    }
}

/* Navigation mobile */
@media (max-width: 576px) {
    .sidebar-nav {
        padding: 10px;
    }
    
    .sidebar-link {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .sidebar-link span {
        display: inline;
    }
}

/* Table mobile */
@media (max-width: 768px) {
    .table {
        font-size: 12px;
    }
    
    .table th, .table td {
        padding: 8px 6px;
    }
    
    .table td[data-label]::before {
        font-size: 10px;
    }
}

/* Pagination mobile */
@media (max-width: 576px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-link {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* Toast notifications mobile */
@media (max-width: 576px) {
    .toast-container {
        left: 10px;
        right: 10px;
        width: auto;
    }
}

/* Search inputs mobile */
@media (max-width: 576px) {
    .search-container input {
        font-size: 14px;
        padding: 8px 12px;
    }
}

/* Filter controls mobile */
@media (max-width: 576px) {
    .filter-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-controls .form-select,
    .filter-controls .form-control {
        width: 100%;
    }
}

/* Action buttons mobile */
@media (max-width: 576px) {
    .action-buttons {
        flex-direction: column;
        gap: 5px;
    }
    
    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Charts mobile */
.chart-container {
    max-width: 100%;
    overflow-x: auto;
}

/* Badges mobile */
.badge {
    font-size: 11px;
    padding: 4px 8px;
}

/* Progress bar mobile */
.progress {
    height: 8px;
    font-size: 10px;
}

/* Close button mobile */
.close {
    padding: 5px;
    font-size: 20px;
}

/* Dropdown menu mobile */
@media (max-width: 576px) {
    .dropdown-menu {
        width: 100%;
        max-width: 100vw;
    }
}

/* Tab navigation mobile */
@media (max-width: 576px) {
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-tabs .nav-link {
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* Fix iOS specific issues */
@supports (-webkit-touch-callout: none) {
    body {
        min-height: -webkit-fill-available;
    }
    
    input, select, textarea {
        font-size: 16px;
    }
    
    input:focus, select:focus, textarea:focus {
        font-size: 16px;
    }
}

/* ============================================================
   Premium Modal UI - Desktop Only (min-width: 992px)
   ============================================================ */
@media (min-width: 992px) {
    /* Compact modal width for standard modals */
    .modal-dialog {
        max-width: 450px !important;
    }
    
    /* Larger modals (form modals) - Compact dimensions */
    .modal-dialog.modal-lg {
        max-width: 600px !important;
    }
    
    /* Leave XL modals untouched (wide data tables) */
    .modal-dialog.modal-xl {
        max-width: unset;
    }

    /* ✅ TASK 2: Invoice modal — fixed A4-like width, proper shadow */
    #invoiceModal .modal-dialog {
        max-width: 780px !important;
        width: 90vw;
    }
    #invoiceModal .modal-content {
        border-radius: 20px !important;
        box-shadow:
            0 0 0 1px rgba(255,255,255,0.06) inset,
            0 32px 64px -16px rgba(0,0,0,0.35),
            0 8px 24px rgba(0,0,0,0.18) !important;
        overflow: hidden;
    }
    /* Override generic modal-body padding for invoice only */
    #invoiceModal .modal-body {
        padding: 0 !important;
        overflow-y: auto;
        max-height: 82vh;
        background: var(--bg-body);
    }
    #invoiceModal .modal-header,
    #invoiceModal .modal-footer {
        padding: 18px 28px !important;
    }
    /* The invoice inner body gets its own A4-style padding */
    #invoiceModal .inv-body {
        padding: 32px 40px !important;
    }
    #invoiceModal .inv-header-inner {
        padding: 36px 40px !important;
    }
    #invoiceModal .inv-footer {
        padding: 22px 40px !important;
    }
    
    /* Apple-like Radius & Border */
    .modal-content {
        border-radius: 24px !important;
        border: 1px solid var(--border-subtle) !important;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255,255,255,0.05) inset !important;
    }
    
    /* Fluid Spring Animation */
    .modal.fade .modal-dialog {
        transform: scale(0.95);
        transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    }
    
    .modal.show .modal-dialog {
        transform: scale(1) !important;
    }
    
    /* Glassmorphism Backdrop */
    .modal-backdrop.show {
        backdrop-filter: blur(8px) !important;
        opacity: 0.6 !important;
    }
    
    /* Clean Spacing & Whitespace */
    .modal-header {
        padding: 24px 32px 20px !important;
        border-bottom: 1px solid var(--border-subtle) !important;
    }
    
    .modal-body {
        padding: 24px 32px 32px !important;
    }
    
    .modal-footer {
        padding: 20px 32px !important;
        background-color: var(--bg-surface-2) !important;
        border-top: 1px solid var(--border-subtle) !important;
        border-radius: 0 0 24px 24px !important;
    }
    
    /* Ensure grid layout inside modals */
    .modal-body .row.g-3 > div {
        margin-bottom: 0;
    }
    
    /* Modal Specific Positioning (RTL fix) */
    .modal-header .btn-close {
        position: absolute !important;
        left: 24px !important;
        top: 24px !important;
        z-index: 10 !important;
    }
}

/* Landscape orientation */
@media (orientation: landscape) and (max-height: 500px) {
    .modal-body {
        max-height: 40vh;
    }
}

/* ============================================================
   Premium Service Badges
   ============================================================ */
.service-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    letter-spacing: 0.3px;
    white-space: nowrap;
    border: none !important;
}

/* Brand Colors - Light Mode */
.service-chatgpt { background-color: rgba(16, 185, 129, 0.15) !important; color: #059669 !important; }
.service-gemini { background-color: rgba(139, 92, 246, 0.15) !important; color: #7C3AED !important; }
.service-adobe { background-color: rgba(220, 38, 38, 0.15) !important; color: #DC2626 !important; }
.service-canva { background-color: rgba(6, 182, 212, 0.15) !important; color: #0891B2 !important; }
.service-shahid { background-color: rgba(244, 63, 94, 0.15) !important; color: #E11D48 !important; }
.service-netflix { background-color: rgba(229, 9, 20, 0.15) !important; color: #B91C1C !important; }
.service-default { background-color: var(--bg-surface-2) !important; color: var(--text-secondary) !important; border: 1px solid var(--border-subtle) !important; }

/* Brand Colors - Dark Mode */
[data-theme="dark"] .service-chatgpt { background-color: rgba(16, 185, 129, 0.2) !important; color: #34D399 !important; }
[data-theme="dark"] .service-gemini { background-color: rgba(139, 92, 246, 0.2) !important; color: #A78BFA !important; }
[data-theme="dark"] .service-adobe { background-color: rgba(220, 38, 38, 0.2) !important; color: #F87171 !important; }
[data-theme="dark"] .service-canva { background-color: rgba(6, 182, 212, 0.2) !important; color: #22D3EE !important; }
[data-theme="dark"] .service-shahid { background-color: rgba(244, 63, 94, 0.2) !important; color: #FB7185 !important; }
[data-theme="dark"] .service-netflix { background-color: rgba(229, 9, 20, 0.2) !important; color: #FCA5A5 !important; }
