/* ==========================================================================
   Murafaati (مرافعاتي) — Premium Modern Web UI Design System
   Specification: .agent/design.md
   Theme: Light Mode (English / LTR Primary)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

:root {
  /* Brand Colors */
  --murafaati-navy: #0F172A;
  --murafaati-navy-dark: #020617;
  --murafaati-slate: #1E293B;
  --murafaati-slate-light: #334155;

  /* Premium Gold Accent (Restrained, subtle usage) */
  --murafaati-gold: #C9A227;
  --murafaati-gold-muted: #D4AF37;
  --murafaati-gold-light: #FBF6E2;
  --murafaati-gold-border: rgba(201, 162, 39, 0.35);

  /* Light Theme Surfaces & Backgrounds */
  --bg-page: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-secondary: #F1F5F9;
  --bg-surface-tertiary: #E2E8F0;

  /* Typography Colors */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-light: #F8FAFC;

  /* Borders & Dividers */
  --border-light: #E2E8F0;
  --border-strong: #CBD5E1;
  --border-focus: #0F172A;

  /* Semantic Colors */
  --color-success: #10B981;
  --color-success-soft: #ECFDF5;
  --color-success-border: #A7F3D0;

  --color-warning: #F59E0B;
  --color-warning-soft: #FFFBEB;
  --color-warning-border: #FDE68A;

  --color-danger: #EF4444;
  --color-danger-soft: #FEF2F2;
  --color-danger-border: #FECACA;

  --color-info: #3B82F6;
  --color-info-soft: #EFF6FF;
  --color-info-border: #BFDBFE;

  /* Spacing Scale (8pt Grid) */
  --space-2: 2px;
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;
  --space-40: 40px;
  --space-48: 48px;

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

  /* Shadows (Subtle, refined) */
  --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 12px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 12px 30px rgba(15, 23, 42, 0.08);
  --shadow-modal: 0 24px 60px rgba(15, 23, 42, 0.16);

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

/* ==========================================================================
   Base Styles & Reset Extensions
   ========================================================================== */
html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Arabic typography support when needed */
:lang(ar), [dir="rtl"], .font-arabic {
  font-family: 'IBM Plex Sans Arabic', 'Inter', sans-serif;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

/* ==========================================================================
   Layout: App Shell
   ========================================================================== */
#wrapper {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-page);
}

/* Sidebar: Deep Navy Luxury (#0F172A) */
.murafaati-sidebar {
  width: 260px;
  min-height: 100vh;
  background-color: var(--murafaati-navy);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform var(--transition-normal);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 1040;
}

.murafaati-sidebar .sidebar-header {
  height: 72px;
  padding: 0 var(--space-20);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(2, 6, 23, 0.35);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #FFFFFF;
}

.brand-icon-box {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #1E293B, #0F172A);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--murafaati-gold-muted);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--murafaati-gold-muted);
  font-weight: 600;
}

.sidebar-nav-container {
  flex: 1;
  padding: var(--space-16) var(--space-12);
  overflow-y: auto;
}

.sidebar-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  color: #64748B;
  padding: var(--space-12) var(--space-12) var(--space-4);
  margin-top: var(--space-8);
}

.murafaati-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #94A3B8;
  font-weight: 500;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  position: relative;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.murafaati-sidebar .nav-link:hover {
  color: #FFFFFF;
  background-color: rgba(255, 255, 255, 0.05);
}

.murafaati-sidebar .nav-link.active {
  color: #FFFFFF;
  background-color: rgba(255, 255, 255, 0.09);
  font-weight: 600;
}

/* Subtle Gold Indicator for Active Item (Section 11) */
.murafaati-sidebar .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 3px;
  background-color: var(--murafaati-gold-muted);
  border-radius: 0 2px 2px 0;
}

.sidebar-user-footer {
  padding: var(--space-16);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(2, 6, 23, 0.2);
}

/* Page Content Wrapper */
#page-content-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Top Navbar (72px) */
.murafaati-navbar {
  height: 72px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding: 0 var(--space-24);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: var(--shadow-xs);
}

.nav-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.nav-breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.nav-breadcrumbs a:hover {
  color: var(--murafaati-navy);
}

.nav-breadcrumbs .current {
  color: var(--text-primary);
  font-weight: 600;
}

/* Global Search Input (⌘K / Ctrl+K) */
.nav-search-bar {
  position: relative;
  width: 320px;
}

.nav-search-bar input {
  width: 100%;
  height: 40px;
  padding: 0 42px 0 38px;
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.nav-search-bar input:focus {
  outline: none;
  background-color: #FFFFFF;
  border-color: var(--murafaati-navy);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.nav-search-bar .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.nav-search-bar .search-badge {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 6px;
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

/* Main Dashboard Canvas */
.murafaati-content-canvas {
  padding: var(--space-32) var(--space-32);
  flex: 1;
}

@media (max-width: 991.98px) {
  .murafaati-content-canvas {
    padding: var(--space-20);
  }
}

/* ==========================================================================
   Components: Cards & Stat Cards
   ========================================================================== */
.murafaati-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.murafaati-card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

/* Stat Cards (Section 12) */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-20);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.stat-card .stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.stat-card .stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin: var(--space-4) 0;
  letter-spacing: -0.02em;
}

.stat-card .stat-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.stat-trend.trend-up {
  background-color: var(--color-success-soft);
  color: var(--color-success);
}

.stat-trend.trend-neutral {
  background-color: var(--bg-surface-secondary);
  color: var(--text-secondary);
}

/* ==========================================================================
   Components: Buttons (Section 23)
   ========================================================================== */
.btn-murafaati-primary {
  background-color: var(--murafaati-navy);
  color: #FFFFFF !important;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--murafaati-navy);
  box-shadow: var(--shadow-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-murafaati-primary:hover {
  background-color: var(--murafaati-navy-dark);
  border-color: var(--murafaati-navy-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-murafaati-gold {
  background-color: var(--murafaati-gold-muted);
  color: var(--murafaati-navy) !important;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--murafaati-gold);
  box-shadow: var(--shadow-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-murafaati-gold:hover {
  background-color: #C29F2F;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.25);
}

.btn-murafaati-secondary {
  background-color: #FFFFFF;
  color: var(--text-primary) !important;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-murafaati-secondary:hover {
  background-color: var(--bg-surface-secondary);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-murafaati-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-murafaati-ghost:hover {
  background-color: var(--bg-surface-secondary);
  color: var(--text-primary);
}

/* ==========================================================================
   Components: Tables (Section 15)
   ========================================================================== */
.table-murafaati {
  width: 100%;
  margin-bottom: 0;
  color: var(--text-primary);
  border-collapse: separate;
  border-spacing: 0;
}

.table-murafaati thead th {
  background-color: var(--bg-surface-secondary);
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  padding: 14px 20px;
  border-top: none;
  border-bottom: 1px solid var(--border-light);
}

.table-murafaati tbody td {
  padding: 16px 20px;
  vertical-align: middle;
  border-top: none;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.88rem;
  transition: background-color var(--transition-fast);
}

.table-murafaati tbody tr:hover td {
  background-color: #F8FAFC;
}

.table-murafaati tbody tr:last-child td {
  border-bottom: none;
}

/* ==========================================================================
   Components: Status Badges (Section 28)
   ========================================================================== */
.badge-murafaati {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.badge-murafaati-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.badge-murafaati.badge-success {
  background-color: var(--color-success-soft);
  color: #065F46;
  border: 1px solid var(--color-success-border);
}
.badge-murafaati.badge-success .badge-murafaati-dot {
  background-color: var(--color-success);
}

.badge-murafaati.badge-warning {
  background-color: var(--color-warning-soft);
  color: #92400E;
  border: 1px solid var(--color-warning-border);
}
.badge-murafaati.badge-warning .badge-murafaati-dot {
  background-color: var(--color-warning);
}

.badge-murafaati.badge-danger {
  background-color: var(--color-danger-soft);
  color: #991B1B;
  border: 1px solid var(--color-danger-border);
}
.badge-murafaati.badge-danger .badge-murafaati-dot {
  background-color: var(--color-danger);
}

.badge-murafaati.badge-info {
  background-color: var(--color-info-soft);
  color: #1E40AF;
  border: 1px solid var(--color-info-border);
}
.badge-murafaati.badge-info .badge-murafaati-dot {
  background-color: var(--color-info);
}

.badge-murafaati.badge-gold {
  background-color: var(--murafaati-gold-light);
  color: #854D0E;
  border: 1px solid var(--murafaati-gold-border);
}
.badge-murafaati.badge-gold .badge-murafaati-dot {
  background-color: var(--murafaati-gold-muted);
}

/* ==========================================================================
   Components: Form Inputs (Section 24)
   ========================================================================== */
.form-label-murafaati {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: block;
}

.form-control-murafaati {
  height: 46px;
  padding: 10px 14px;
  background-color: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  width: 100%;
}

.form-control-murafaati:focus {
  outline: none;
  border-color: var(--murafaati-navy);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

/* ==========================================================================
   Components: Modals (Section 26)
   ========================================================================== */
.modal-content-murafaati {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-modal);
  background-color: #FFFFFF;
  overflow: hidden;
}

.modal-header-murafaati {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  background-color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body-murafaati {
  padding: 24px;
}

.modal-footer-murafaati {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background-color: var(--bg-surface-secondary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   Components: Empty States (Section 16)
   ========================================================================== */
.empty-state-murafaati {
  text-align: center;
  padding: 48px 24px;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-16);
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.empty-state-description {
  font-size: 0.88rem;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto var(--space-20);
}

/* ==========================================================================
   Mobile & Responsive Tweaks (Section 37)
   ========================================================================== */
@media (max-width: 991.98px) {
  .murafaati-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-modal);
  }

  .murafaati-sidebar.show {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(4px);
    z-index: 1030;
  }

  .sidebar-backdrop.show {
    display: block;
  }

  .nav-search-bar {
    display: none;
  }
}
