/* ==========================================
   JAWAB — Global Styles
   ========================================== */

/* Smooth theme transition */
*, *::before, *::after {
    transition: background-color 0.3s ease, color 0.2s ease, border-color 0.3s ease;
}

:root {
    /* Colors — teal brand (remapped from legacy indigo/violet to match the new
       React UI's design tokens in /design/tokens/theme.css). Values mirror
       Tailwind's teal + cyan scales so shadows/glows still feel balanced. */
    --primary-50:  #F0FDFA;
    --primary-100: #CCFBF1;
    --primary-200: #99F6E4;
    --primary-300: #5EEAD4;
    --primary-400: #2DD4BF;
    --primary-500: #14B8A6;
    --primary-600: #0D9488;   /* matches var(--jawab-brand-base) */
    --primary-700: #0F766E;
    --primary-800: #115E59;
    --primary-900: #134E4A;

    --violet-500: #06B6D4;    /* accent now cyan (matches jawab-accent-base) */
    --violet-600: #0891B2;

    --emerald-400: #34D399;
    --emerald-500: #10B981;
    --emerald-600: #059669;

    --amber-400: #FBBF24;
    --amber-500: #F59E0B;

    --red-400: #F87171;
    --red-500: #EF4444;

    --cyan-400: #22D3EE;
    --cyan-500: #06B6D4;

    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --gray-950: #030712;

    /* Dark theme */
    --dark-bg: #0B0F1A;
    --dark-surface: #111827;
    --dark-surface-2: #1A2332;
    --dark-border: #1F2937;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #0D9488 0%, #06B6D4 50%, #22D3EE 100%);
    --gradient-dark: linear-gradient(180deg, #0B0F1A 0%, #111827 100%);

    /* Typography */
    --font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --container-max: 1200px;
    --section-padding: 120px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 40px rgba(13, 148, 136, 0.3);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.7;
    color: var(--gray-300);
    background: var(--dark-bg);
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

img {
    max-width: 100%;
    height: auto;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

ul, ol {
    list-style: none;
}

/* Container */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: #fff;
    font-weight: 700;
    line-height: 1.3;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Section */
.section-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 64px;
}

.section-tag {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-full);
    color: var(--primary-400);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.section-header p {
    font-size: 1.125rem;
    color: var(--gray-400);
    margin-top: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    transition: all var(--transition-base);
    border: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.btn-outline {
    border-color: var(--gray-700);
    color: var(--gray-300);
    background: transparent;
}

.btn-outline:hover {
    border-color: var(--primary-500);
    color: #fff;
    background: rgba(99, 102, 241, 0.05);
}

.btn-ghost {
    color: var(--gray-300);
    background: transparent;
}

.btn-ghost:hover {
    color: #fff;
}

.btn-white {
    background: #fff;
    color: var(--primary-600);
}

.btn-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.2);
}

.btn-ghost-white {
    color: rgba(255,255,255,0.8);
    border-color: rgba(255,255,255,0.2);
}

.btn-ghost-white:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.05);
}

.btn-lg {
    padding: 16px 36px;
    font-size: 1.1rem;
}

.btn-block {
    width: 100%;
}

/* Animations */
[data-animate] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

[data-animate].animated {
    opacity: 1;
    transform: translateY(0);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-700);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-600);
}

/* Selection */
::selection {
    background: rgba(99, 102, 241, 0.3);
    color: #fff;
}

/* ==========================================
   Light Theme Overrides
   ========================================== */
[data-theme="light"] {
    --dark-bg: #f5f7fa;
    --dark-surface: #ffffff;
    --dark-surface-2: #f0f2f5;
    --dark-border: #e2e8f0;
    --gray-300: #374151;
    --gray-400: #4b5563;
    --gray-500: #6b7280;
    --gray-600: #9ca3af;
    --gray-700: #d1d5db;
}

[data-theme="light"] .sidebar {
    background: #ffffff;
    border-color: #e2e8f0;
}

[data-theme="light"] .topbar {
    background: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .stat-card,
[data-theme="light"] .chart-card,
[data-theme="light"] .content-card,
[data-theme="light"] .orders-card,
[data-theme="light"] .agent-card,
[data-theme="light"] .settings-panel {
    background: #ffffff;
    border-color: #e2e8f0;
}

[data-theme="light"] .sidebar-link {
    color: #4b5563;
}

[data-theme="light"] .sidebar-link:hover {
    color: #111827;
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .sidebar-link.active {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.08);
}

[data-theme="light"] .stat-card-value,
[data-theme="light"] .chart-header h3,
[data-theme="light"] .content-card-header h3,
[data-theme="light"] h1, [data-theme="light"] h2, [data-theme="light"] h3 {
    color: #111827;
}

[data-theme="light"] .topbar-title h1 {
    color: #111827;
}

[data-theme="light"] .user-name,
[data-theme="light"] .sidebar-header .logo-text {
    color: #111827;
}

[data-theme="light"] .search-box {
    background: #f0f2f5;
    border-color: #e2e8f0;
}

[data-theme="light"] .search-box input {
    color: #111827;
}

[data-theme="light"] .modal,
[data-theme="light"] #modal-overlay > div {
    background: #ffffff;
    border-color: #e2e8f0;
}

[data-theme="light"] .modal h2,
[data-theme="light"] #modal-overlay h3 {
    color: #111827;
}

[data-theme="light"] .orders-table th {
    color: #6b7280;
    border-color: #e2e8f0;
}

[data-theme="light"] .orders-table td {
    border-color: #f0f2f5;
    color: #374151;
}

[data-theme="light"] .conv-item:hover {
    background: rgba(79, 70, 229, 0.03);
}

[data-theme="light"] .message.incoming .message-body {
    background: #f0f2f5;
    border-color: #e2e8f0;
    color: #374151;
}

[data-theme="light"] .chat-input-wrapper {
    background: #f0f2f5;
    border-color: #e2e8f0;
}

[data-theme="light"] .chat-input-wrapper input {
    color: #111827;
}

[data-theme="light"] .nav-section-label {
    color: #9ca3af;
}

[data-theme="light"] input, [data-theme="light"] select, [data-theme="light"] textarea {
    color: #111827 !important;
    background: #f0f2f5 !important;
    border-color: #e2e8f0 !important;
}

/* ==========================================
   LIGHT MODE — COMPREHENSIVE INLINE STYLE OVERRIDES
   Covers all hardcoded color:#fff in JS-generated HTML
   ========================================== */

/* Force dark text on ALL elements with inline color:#fff */
[data-theme="light"] [style*="color:#fff"],
[data-theme="light"] [style*="color: #fff"],
[data-theme="light"] [style*="color: white"] {
    color: #111827 !important;
}

/* Force dark text on table cells, spans, divs, labels, buttons with inline styles */
[data-theme="light"] td[style*="color"],
[data-theme="light"] span[style*="color:#fff"],
[data-theme="light"] div[style*="color:#fff"],
[data-theme="light"] b[style*="color:#fff"],
[data-theme="light"] label[style*="color"] {
    color: #111827 !important;
}

/* Fix inline background colors for surfaces */
[data-theme="light"] [style*="background:var(--dark-surface"],
[data-theme="light"] [style*="background: var(--dark-surface"] {
    background: #f0f2f5 !important;
}

[data-theme="light"] [style*="background:var(--dark-bg"],
[data-theme="light"] [style*="background: var(--dark-bg"] {
    background: #f5f7fa !important;
}

/* Fix cards, panels, sections with inline dark backgrounds */
[data-theme="light"] .agent-card,
[data-theme="light"] .agent-stat,
[data-theme="light"] .conv-item,
[data-theme="light"] .customer-card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

/* Agent card text */
[data-theme="light"] .agent-name,
[data-theme="light"] .agent-stat-value {
    color: #111827 !important;
}

/* Stat cards */
[data-theme="light"] .stat-card-label {
    color: #6b7280 !important;
}

/* Order status badges — keep their colors */
[data-theme="light"] .order-status {
    color: inherit !important;
}

/* Modal content */
[data-theme="light"] .modal-body,
[data-theme="light"] .modal-content {
    color: #374151 !important;
}

/* Notification/toast */
[data-theme="light"] .toast {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #374151 !important;
}

/* Fix gray text that's too dark/light */
[data-theme="light"] [style*="color:var(--gray-300)"],
[data-theme="light"] [style*="color:var(--gray-400)"] {
    color: #4b5563 !important;
}

[data-theme="light"] [style*="color:var(--gray-500)"],
[data-theme="light"] [style*="color:var(--gray-600)"] {
    color: #6b7280 !important;
}

/* Buttons — keep primary colors readable */
[data-theme="light"] .btn-outline {
    border-color: #e2e8f0 !important;
    color: #374151 !important;
}

[data-theme="light"] .btn-outline:hover {
    background: #f0f2f5 !important;
}

/* Sidebar mobile overlay */
[data-theme="light"] .sidebar {
    box-shadow: 2px 0 8px rgba(0,0,0,0.05) !important;
}

/* Table headers and rows */
[data-theme="light"] .orders-table tr:hover td {
    background: #f5f7fa !important;
}

/* Fix scrollbar for light mode */
[data-theme="light"] ::-webkit-scrollbar-track {
    background: #f5f7fa;
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #d1d5db;
}

/* Selection highlight */
[data-theme="light"] ::selection {
    background: rgba(79, 70, 229, 0.15);
    color: #111827;
}

/* Dropdown/select arrow visibility */
[data-theme="light"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
}

/* Social comments cards */
[data-theme="light"] #comments-list > div {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

/* Fix order-filter-btn in light mode */
[data-theme="light"] .order-filter-btn {
    color: #4b5563 !important;
    border-color: #e2e8f0 !important;
}
[data-theme="light"] .order-filter-btn.active {
    color: #fff !important;
    background: var(--primary-500) !important;
}

/* Fix booking/product cards and any JS-generated cards */
[data-theme="light"] [style*="border-radius:12px"][style*="padding:16px"] {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

/* Empty state text */
[data-theme="light"] .empty-state .empty-text {
    color: #374151 !important;
}

/* Bulk action bar */
[data-theme="light"] #bulk-bar {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

/* Product grid cards */
[data-theme="light"] .product-card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

/* Fix text in dynamically generated elements */
[data-theme="light"] [style*="font-weight:600"] {
    color: #111827 !important;
}

/* Badge colors — keep readable */
[data-theme="light"] .badge-green { background: rgba(16, 185, 129, 0.1) !important; }
[data-theme="light"] .badge-red { background: rgba(239, 68, 68, 0.1) !important; }
[data-theme="light"] .badge-blue { background: rgba(99, 102, 241, 0.1) !important; }

/* Topbar icons and buttons */
[data-theme="light"] .topbar-btn {
    color: #374151 !important;
}
[data-theme="light"] .topbar-btn:hover {
    background: rgba(0,0,0,0.05) !important;
}

/* Force ALL text with inline color to be dark in light mode */
[data-theme="light"] span[style*="color:#"],
[data-theme="light"] div[style*="color:#"],
[data-theme="light"] td[style*="color:#"],
[data-theme="light"] p[style*="color:#"],
[data-theme="light"] label[style*="color:var(--gray-300)"],
[data-theme="light"] label[style*="color:var(--gray-400)"] {
    color: #374151 !important;
}

/* Stat card numbers */
[data-theme="light"] .stat-card-value,
[data-theme="light"] .agent-stat-value,
[data-theme="light"] .biz-stat-num {
    color: #111827 !important;
}

/* Chart bars */
[data-theme="light"] .chart-bar {
    opacity: 0.8;
}

/* Tables — ensure readable text */
[data-theme="light"] table td,
[data-theme="light"] table th {
    color: #374151 !important;
}

[data-theme="light"] .order-id {
    color: #111827 !important;
    font-weight: 600;
}

/* Notification/toast in light mode */
[data-theme="light"] .admin-notification {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #374151 !important;
}
