﻿/* ============================================================
   UAE Forms — Design System
   Primary: #1B3A6B (Navy) | Accent: #B68A35 (Gold)
   RTL-first | Responsive | Bootstrap 5 RTL
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&family=Cairo:wght@400;600;700;800&family=DM+Sans:wght@400;500;600;700&display=swap');

/* ── CSS Variables ── */
:root {
  --primary:        #1B3A6B;
  --primary-dark:   #122B52;
  --primary-light:  #2B5BA8;
  --primary-bg:     rgba(27,58,107,0.06);
  --gold:           #B68A35;
  --gold-dark:      #9A7228;
  --gold-light:     #D4A54A;
  --gold-bg:        rgba(182,138,53,0.08);
  --success:        #1A7A4A;
  --success-bg:     rgba(26,122,74,0.08);
  --danger:         #C0392B;
  --danger-bg:      rgba(192,57,43,0.08);
  --warning:        #B68A35;
  --warning-bg:     rgba(182,138,53,0.1);
  --text:           #1A1A2E;
  --text-muted:     #6B7280;
  --text-light:     #9CA3AF;
  --border:         #E5E7EB;
  --border-focus:   #1B3A6B;
  --bg:             #FFFFFF;
  --bg-light:       #F8F9FB;
  --bg-sidebar:     #1B3A6B;
  --sidebar-w:      260px;
  --navbar-h:       64px;
  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      16px;
  --shadow:         0 2px 12px rgba(27,58,107,0.08);
  --shadow-md:      0 4px 24px rgba(27,58,107,0.12);
  --shadow-lg:      0 8px 40px rgba(27,58,107,0.16);
  --transition:     all 0.2s ease;
  --font-ar:        'Tajawal', 'Cairo', sans-serif;
  --font-en:        'DM Sans', sans-serif;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html[dir="rtl"] {
    direction: rtl;
}

html[dir="ltr"] {
    direction: ltr;
}
html {

  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ar);
  color: var(--text);
  background: var(--bg-light);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ── */
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.3; }
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fw-900 { font-weight: 900; }
.text-primary-uae { color: var(--primary) !important; }
.text-gold        { color: var(--gold) !important; }
.text-success-uae { color: var(--success) !important; }
.text-muted       { color: var(--text-muted) !important; }

/* ============================================================
   LAYOUT — App Shell
   ============================================================ */

.app-wrapper {
  display: flex;
  flex-direction: row-reverse; /* RTL: sidebar right, content left */
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  transition: transform 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-brand-icon {
  width: 38px;
  height: 38px;
  background: var(--gold);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand-name {
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
}

.sidebar-brand-sub {
  color: rgba(255,255,255,0.6);
  font-size: 10px;
  font-weight: 400;
}

/* Plan Badge */
.sidebar-plan {
  margin: 0.75rem 1.25rem;
  padding: 0.35rem 0.75rem;
  background: rgba(182,138,53,0.15);
  border: 1px solid rgba(182,138,53,0.3);
  border-radius: 20px;
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0;
  list-style: none;
}

.sidebar-section-label {
  padding: 1rem 1.25rem 0.35rem;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.25rem;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-right: 3px solid transparent;
  transition: var(--transition);
  position: relative;
}

.sidebar-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-right-color: rgba(182,138,53,0.5);
}

.sidebar-link.active {
  color: #fff;
  background: rgba(182,138,53,0.15);
  border-right-color: var(--gold);
  font-weight: 700;
}

.sidebar-link i {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-badge {
  margin-right: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 0.5rem 1.25rem;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-user-info { min-width: 0; flex: 1; }
.sidebar-user-name {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  color: rgba(255,255,255,0.5);
  font-size: 11px;
}

/* ── Main Content ── */
.main-wrapper {
  flex: 1;
  margin-right: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── Navbar ── */
.navbar-uae {
  height: var(--navbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 1px 8px rgba(27,58,107,0.06);
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--primary);
  cursor: pointer;
  padding: 0.25rem;
}

.navbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
}

.navbar-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}
.navbar-breadcrumb a:hover { color: var(--primary); }
.navbar-breadcrumb .current { color: var(--primary); font-weight: 600; }

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Language Toggle */
.lang-toggle {
  display: flex;
  align-items: center;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.lang-btn {
  padding: 0.3rem 0.75rem;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.lang-btn.active {
  background: var(--primary);
  color: #fff;
}

/* Notification Bell */
.nav-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  font-size: 16px;
}
.nav-icon-btn:hover {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: var(--primary);
}

.nav-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* User Dropdown */
.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  color: var(--text);
}
.navbar-user:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.navbar-user-avatar {
  width: 30px;
  height: 30px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}
.navbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Page Content ── */
.page-content {
  flex: 1;
  padding: 2rem 1.75rem;
  max-width: 1400px;
  width: 100%;
}

.page-header {
  margin-bottom: 1.75rem;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 0.2rem;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

/* ============================================================
   COMPONENTS
   ============================================================ */

/* ── Cards ── */
.card-uae {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
}
.card-uae:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(27,58,107,0.15);
}

.card-header-uae {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  gap: 0.75rem;
}

.card-body-uae {
  padding: 1.25rem;
}

/* ── Stat Cards ── */
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border-top: 3px solid var(--primary);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card.gold   { border-top-color: var(--gold); }
.stat-card.success{ border-top-color: var(--success); }
.stat-card.danger { border-top-color: var(--danger); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--primary-bg);
  color: var(--primary);
}
.stat-icon.gold    { background: var(--gold-bg);    color: var(--gold); }
.stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-icon.danger  { background: var(--danger-bg);  color: var(--danger); }

.stat-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary-dark);
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Buttons ── */
.btn-primary-uae {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: var(--primary);
  color: #fff !important;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-ar);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary-uae:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(27,58,107,0.25);
  color: #fff !important;
}

.btn-gold-uae {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: var(--gold);
  color: #fff !important;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-ar);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-gold-uae:hover {
  background: var(--gold-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(182,138,53,0.3);
  color: #fff !important;
}

.btn-outline-uae {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: transparent;
  color: var(--primary) !important;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-ar);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-outline-uae:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary) !important;
}

.btn-danger-uae {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: var(--danger);
  color: #fff !important;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-ar);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}
.btn-danger-uae:hover {
  background: #a93226;
  color: #fff !important;
}

/* ── Badges ── */
.badge-uae {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-uae.primary { background: var(--primary-bg); color: var(--primary); }
.badge-uae.gold    { background: var(--gold-bg);    color: var(--gold-dark); }
.badge-uae.success { background: var(--success-bg); color: var(--success); }
.badge-uae.danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-uae.warning { background: var(--warning-bg); color: var(--gold-dark); }
.badge-uae.muted   { background: #F3F4F6; color: var(--text-muted); }

/* ── Forms ── */
.form-group-uae {
  margin-bottom: 1.1rem;
}

.form-label-uae {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.form-control-uae {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-ar);
  color: var(--text);
  transition: var(--transition);
  outline: none;
  appearance: none;
}
.form-control-uae:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,58,107,0.1);
}
.form-control-uae::placeholder { color: var(--text-light); }
.form-control-uae:disabled { background: var(--bg-light); opacity: 0.7; }

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

select.form-control-uae {
  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='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
  padding-left: 2.25rem;
}

/* ── Table ── */
.table-uae {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table-uae th {
  padding: 0.75rem 1rem;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  background: var(--bg-light);
  white-space: nowrap;
}
.table-uae td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.table-uae tbody tr:hover { background: var(--bg-light); }
.table-uae tbody tr:last-child td { border-bottom: none; }

/* ── Toast ── */
#toast-container {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 300px;
  max-width: 400px;
}

.toast-uae {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border-right: 4px solid var(--primary);
  animation: slideIn 0.3s ease;
}
.toast-uae.success { border-right-color: var(--success); }
.toast-uae.error   { border-right-color: var(--danger); }
.toast-uae.warning { border-right-color: var(--gold); }

.toast-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); }
.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  opacity: 0.7;
}
.empty-state h5 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.4rem;
}
.empty-state p {
  font-size: 14px;
  margin-bottom: 1.5rem;
}

/* ── Auth Layout ── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

.auth-side {
  width: 42%;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  position: relative;
  overflow: hidden;
}

.auth-side::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
  top: -100px;
  right: -100px;
}

.auth-side::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  background: rgba(182,138,53,0.08);
  border-radius: 50%;
  bottom: -80px;
  left: -80px;
}

.auth-side-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  z-index: 1;
  text-align: center;
}

.auth-logo-icon {
  width: 72px;
  height: 72px;
  background: var(--gold);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  box-shadow: 0 8px 24px rgba(182,138,53,0.3);
}

.auth-logo-name {
  font-size: 1.6rem;
  font-weight: 900;
  color: #fff;
}

.auth-logo-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  margin-top: -0.5rem;
}

.auth-side-features {
  margin-top: 3rem;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 280px;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: rgba(255,255,255,0.8);
  font-size: 13px;
}

.auth-feature-icon {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  background: var(--bg-light);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2.5rem;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 0.35rem;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

/* ── Progress / Loading ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  display: none;
}

.spinner-uae {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Sidebar Overlay (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 991px) {
  :root { --sidebar-w: 260px; }

  .sidebar {
    transform: translateX(100%); /* Hidden off-right */
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay.open { display: block; }

  .main-wrapper {
    margin-right: 0;
  }

  .navbar-toggle { display: flex; }

  .page-content { padding: 1.25rem 1rem; }

  .auth-side { display: none; }
  .auth-main { padding: 1.5rem 1rem; }
}

@media (max-width: 575px) {
  .page-title { font-size: 1.25rem; }
  .stat-value { font-size: 1.6rem; }
  .auth-card  { padding: 1.75rem 1.25rem; }
  .navbar-user-name { display: none; }
  #toast-container { left: 0.75rem; right: 0.75rem; min-width: unset; }
}

/* ── Gap Utilities ── */
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 0.75rem !important; }

/* ── Dropdown RTL fix ── */
.dropdown-menu { text-align: right; }
.dropdown-item { font-family: var(--font-ar); }
