/* ==========================================================================
   INABA (إنابة) — Core Design System & Global Styles
   Phase WEB-1: Foundation + Public Website + Authentication
   Direction: RTL | Language: Arabic
   ========================================================================== */

:root {
  /* Brand Color Palette (Approved Direction: Deep Emerald, Warm Ivory, Refined Gold) */
  --primary: #0E4D34;              /* Deep Heritage Green */
  --primary-hover: #093725;
  --primary-dark: #082C1E;        /* Deep Secondary */
  --primary-light: #EBF4F0;
  --primary-subtle: #F3F8F5;

  --accent-gold: #C5A869;          /* Refined Metallic Gold */
  --accent-gold-dark: #9F8246;
  --accent-hover: #B49655;
  --accent-light: #FBF7EE;

  /* Surfaces & Neutrals */
  --bg-main: #FBF9F5;              /* Warm Ivory Base */
  --bg-surface: #FFFFFF;
  --bg-muted: #F3F6F4;
  --bg-subtle: #F7F5F0;
  --bg-ivory: #FBF9F5;

  --text-main: #14201B;
  --text-secondary: #3D4E47;
  --text-muted: #6B7D76;
  --text-light: #FFFFFF;

  --border-color: #E2EAE6;
  --border-light: #EDF3F0;
  --border-focus: #0E4D34;

  /* Semantic Status Palette */
  --status-pending: #B45309;
  --status-pending-bg: #FEF3C7;
  --status-progress: #1D4ED8;
  --status-progress-bg: #DBEAFE;
  --status-success: #0E4D34;
  --status-success-bg: #D1FAE5;
  --status-danger: #B91C1C;
  --status-danger-bg: #FEE2E2;

  /* Typography Stack */
  --font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Kufi Arabic', 'Cairo', sans-serif;
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 1.875rem;  /* 30px */
  --font-size-4xl: 2.25rem;   /* 36px */

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(14, 77, 52, 0.04);
  --shadow-sm: 0 2px 6px rgba(14, 77, 52, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 6px 18px rgba(14, 77, 52, 0.08);
  --shadow-lg: 0 14px 30px rgba(14, 77, 52, 0.12);
  --shadow-card: 0 2px 10px rgba(14, 77, 52, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);

  /* Spacing & Radii */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --transition-fast: 0.18s ease;
  --transition-base: 0.26s ease;

  --container-max: 1220px;
}

/* Dark Mode Theme Tokens */
[data-theme="dark"] {
  --primary: #127550;
  --primary-hover: #178D61;
  --primary-dark: #072318;
  --primary-light: #0C3022;
  --primary-subtle: #092419;

  --accent-gold: #D8B772;
  --accent-gold-dark: #B89650;
  --accent-hover: #E4C686;
  --accent-light: #2A2416;

  --bg-main: #0B1713;
  --bg-surface: #10241D;
  --bg-muted: #152E25;
  --bg-subtle: #0E1E18;
  --bg-ivory: #0B1713;

  --text-main: #F3F8F5;
  --text-secondary: #C4D7CF;
  --text-muted: #859E93;
  --text-light: #FFFFFF;

  --border-color: #1F3C30;
  --border-light: #183026;
  --border-focus: #127550;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 14px 34px rgba(0, 0, 0, 0.45);
  --shadow-card: 0 3px 12px rgba(0, 0, 0, 0.3);
}

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

html {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-main);
  background-color: var(--bg-main);
  text-align: start;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  transition: background-color var(--transition-base), color var(--transition-base);
}

html[lang="ur"] {
  font-family: 'Segoe UI', 'Urdu Typesetting', 'Tahoma', system-ui, -apple-system, sans-serif;
}

html[dir="rtl"],
[dir="rtl"] {
  direction: rtl;
}

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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-color: var(--bg-main);
  direction: inherit;
  text-align: start;
  transition: background-color var(--transition-base), color var(--transition-base);
}

img, svg {
  display: inline-block;
  vertical-align: middle;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

ul, ol {
  list-style: none;
}

/* Layout Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* Skip to Content (Accessibility) */
.skip-link {
  position: absolute;
  top: -40px;
  inset-inline-start: 1rem;
  background: var(--primary);
  color: #FFF;
  padding: 0.5rem 1rem;
  z-index: 9999;
  border-radius: var(--radius-sm);
  transition: top var(--transition-fast);
  font-size: var(--font-size-sm);
}
.skip-link:focus {
  top: 1rem;
}

/* Site Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  transition: box-shadow var(--transition-base), background-color var(--transition-base), border-color var(--transition-base);
}

[data-theme="dark"] .site-header {
  background-color: rgba(16, 36, 29, 0.92);
}

.site-header.scrolled {
  box-shadow: var(--shadow-sm);
}

.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.5rem;
  gap: 1.5rem;
}

/* Brand Link: Emblem + Wordmark */
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-emblem {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.brand-link:hover .brand-emblem {
  transform: scale(1.04);
}

/* Official Website Logo Artwork */
.brand-official-logo {
  display: block;
  height: 44px;
  width: auto;
  max-width: 52px;
  object-fit: contain;
  background: transparent;
  image-rendering: -webkit-optimize-contrast;
  transition: transform var(--transition-fast);
}

.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.1;
  text-align: start;
}

.brand-name {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
  line-height: 1;
}

[data-theme="dark"] .brand-name {
  color: #FFFFFF;
}

/* Duplicated secondary English brand subtitle is permanently removed */
.brand-tagline-small {
  display: none !important;
}

@media (max-width: 768px) {
  .brand-official-logo {
    height: 38px;
    max-width: 44px;
  }
  .brand-name {
    font-size: 1.45rem;
  }
}

/* Main Navigation */
.main-nav {
  display: flex;
  align-items: center;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.5rem 0.9rem;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  position: relative;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.nav-link:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

[data-theme="dark"] .nav-link:hover {
  color: var(--accent-gold);
}

.nav-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
  font-weight: 700;
}

[data-theme="dark"] .nav-link.active {
  color: var(--accent-gold);
  background-color: var(--primary-light);
}

/* Header Actions Controls */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

/* Clean Icon Buttons (Globe & Theme Toggle) */
.icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  border-color: var(--accent-gold);
  color: var(--primary);
  background-color: var(--primary-light);
}

[data-theme="dark"] .icon-btn:hover {
  color: var(--accent-gold);
}

/* Language Dropdown */
.lang-dropdown-wrapper {
  position: relative;
}

.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 165px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 0.4rem;
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

.lang-dropdown-wrapper.open .lang-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-xs);
  font-size: var(--font-size-sm);
  color: var(--text-main);
  font-weight: 600;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
}

.lang-menu-item:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.lang-menu-item.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

.lang-code-tag {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(197, 168, 105, 0.18);
  color: var(--accent-gold);
  font-family: monospace;
}

.lang-check {
  color: var(--primary);
  font-weight: 800;
  font-size: 0.9rem;
}

/* Theme Toggle Moon/Sun Icons */
.theme-icon-moon {
  display: block;
}
.theme-icon-sun {
  display: none;
}

[data-theme="dark"] .theme-icon-moon {
  display: none;
}
[data-theme="dark"] .theme-icon-sun {
  display: block;
  color: var(--accent-gold);
}

/* Header Login Button */
.btn-header-login {
  background-color: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  font-weight: 700;
  padding: 0.55rem 1.25rem;
}

.btn-header-login:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(14, 77, 52, 0.25);
}

/* Profile Avatar Dropdown */
.profile-dropdown-wrapper {
  position: relative;
}

.header-avatar-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--accent-gold);
  background: var(--bg-surface);
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  flex-shrink: 0;
}

.header-avatar-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 3px rgba(197, 168, 105, 0.25);
}

.header-user-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  overflow: hidden;
}

.header-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.header-avatar-initials {
  text-transform: uppercase;
  line-height: 1;
  user-select: none;
}

.profile-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 210px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

.profile-dropdown-wrapper.open .profile-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.header-dropdown-profile-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.5rem 0.65rem;
}

.header-dropdown-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 800;
  border: 2px solid var(--accent-gold);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(14, 77, 52, 0.2);
}

.header-dropdown-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.header-dropdown-avatar-initials {
  text-transform: uppercase;
  line-height: 1;
  user-select: none;
}

.header-dropdown-actions {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.header-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-xs);
  font-size: var(--font-size-sm);
  color: var(--text-main);
  font-weight: 600;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: inherit;
  box-sizing: border-box;
}

.header-dropdown-item:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

[data-theme="dark"] .header-dropdown-item:hover {
  background-color: rgba(52, 211, 153, 0.12);
  color: #34D399;
}

.header-dropdown-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: inherit;
}

.header-dropdown-text {
  flex-grow: 1;
  white-space: nowrap;
}

.header-dropdown-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 0.35rem 0.25rem;
}

.header-dropdown-logout-form {
  margin: 0;
  padding: 0;
  width: 100%;
}

.header-logout-item {
  color: #DC2626;
}

.header-logout-item:hover {
  background-color: rgba(220, 38, 38, 0.08);
  color: #B91C1C;
}

[data-theme="dark"] .header-logout-item {
  color: #F87171;
}

[data-theme="dark"] .header-logout-item:hover {
  background-color: rgba(239, 68, 68, 0.15);
  color: #FCA5A5;
}

.header-logout-item .header-dropdown-icon {
  color: #DC2626;
}

.header-logout-item:hover .header-dropdown-icon {
  color: #B91C1C;
}

[data-theme="dark"] .header-logout-item .header-dropdown-icon {
  color: #F87171;
}

[data-theme="dark"] .header-logout-item:hover .header-dropdown-icon {
  color: #FCA5A5;
}

.d-desktop-only {
  display: inline-flex;
}

.mobile-toggle-btn {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem;
  cursor: pointer;
  color: var(--text-main);
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  transition: all var(--transition-fast);
}

.mobile-toggle-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Mobile Navigation Drawer */
.mobile-nav-drawer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.45);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.mobile-nav-drawer.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-panel {
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  width: 82%;
  max-width: 320px;
  height: 100%;
  background-color: var(--bg-surface);
  color: var(--text-main);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-base);
  overflow-y: auto;
  text-align: start;
}

html[dir="rtl"] .drawer-panel {
  transform: translateX(100%);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
}

html[dir="ltr"] .drawer-panel {
  transform: translateX(-100%);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.mobile-nav-drawer.open .drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.drawer-close-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.drawer-close-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.drawer-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.drawer-nav-link {
  display: block;
  padding: 0.75rem 1rem;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-main);
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.drawer-nav-link:hover,
.drawer-nav-link.active {
  background-color: var(--primary-light);
  color: var(--primary);
}

.drawer-actions {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Site Footer */
.site-footer {
  background-color: var(--primary-dark);
  color: #E2EAE6;
  padding-top: 3.5rem;
  padding-bottom: 1.75rem;
  margin-top: auto;
  border-top: 3px solid var(--accent-gold);
}

[data-theme="dark"] .site-footer {
  background-color: #061811;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  gap: 2.5rem;
  margin-bottom: 3rem;
}

.footer-brand {
  max-width: 340px;
  text-align: start;
}

.footer-col {
  text-align: start;
}

.footer-brand .brand-title {
  color: #FFFFFF;
}

.footer-brand .brand-subtitle {
  color: var(--accent-gold);
}

.footer-desc {
  font-size: var(--font-size-sm);
  color: #A9BCB4;
  line-height: 1.7;
  margin-top: 0.85rem;
}

.footer-col h4 {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 1.2rem;
  position: relative;
  padding-bottom: 0.4rem;
}

.footer-col h4::after {
  content: '';
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  width: 24px;
  height: 2px;
  background-color: var(--accent-gold);
  border-radius: var(--radius-full);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.footer-link {
  font-size: var(--font-size-sm);
  color: #B4C6BF;
  transition: color var(--transition-fast), padding-inline-start var(--transition-fast);
}

.footer-link:hover {
  color: #FFFFFF;
  padding-inline-start: 4px;
}

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: var(--font-size-xs);
  color: #8DA59B;
}

.footer-bottom a {
  color: #D1DFDA;
  text-decoration: underline;
}

/* Responsive Breakpoints (360px up to 1920px) */
@media (max-width: 991px) {
  .main-nav {
    display: none;
  }
  .d-desktop-only {
    display: none !important;
  }
  .mobile-toggle-btn {
    display: inline-flex;
  }
  .profile-dropdown-wrapper {
    display: none !important;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

@media (max-width: 640px) {
  .nav-wrapper {
    height: 4rem;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}
