/* ============================================
   Asset Manager SaaS - Figma Design System
   ============================================ */

/* --------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------- */
:root {
  /* Figma Color Palette — Deep Blue / Cyan */
  --primary: #21315D;
  --primary-light: #3a528f;
  --primary-dark: #1a2649;
  --primary-gradient: linear-gradient(135deg, #21315D 0%, #2e4275 100%);

  --secondary: #5BC2D9;
  --secondary-light: #7dd3e6;
  --secondary-dark: #4ab0c6;

  --success: #27AE60;
  --success-light: #6DD59A;
  --warning: #F2994A;
  --warning-light: #F7C088;
  --error: #EB5757;
  --error-light: #F5A3A3;
  --info: #2D9CDB;
  --info-light: #7EC4ED;

  /* Figma Backgrounds & Surface */
  --background: #F5F5F5;
  --background-subtle: #EEEEEE;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-overlay: rgba(255, 255, 255, 0.95);

  /* Figma Text Colors */
  --text-primary: #21315D;
  --text-secondary: #606060;
  --text-muted: #808080;
  --text-inverse: #ffffff;

  /* Borders & Dividers */
  --border: #E2E8F4;
  --border-light: #EEF1F8;
  --border-focus: var(--primary);

  /* Spacing Scale */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 4rem;

  /* Figma Border Radius — Generous rounding */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(33, 49, 93, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(33, 49, 93, 0.06), 0 1px 2px -1px rgba(33, 49, 93, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(33, 49, 93, 0.06), 0 2px 4px -2px rgba(33, 49, 93, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(33, 49, 93, 0.06), 0 4px 6px -4px rgba(33, 49, 93, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(33, 49, 93, 0.08), 0 8px 10px -6px rgba(33, 49, 93, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(33, 49, 93, 0.15);
  --shadow-glow: 0 0 40px rgba(91, 194, 217, 0.25);
  --shadow-card: 0 2px 12px rgba(33, 49, 93, 0.05);
  --shadow-card-hover: 0 8px 30px rgba(33, 49, 93, 0.1);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 80px;
  --navbar-height: 64px;

  /* Sidebar — Light Figma theme */
  --sidebar-bg: #ffffff;
  --sidebar-bg-hover: rgba(91, 194, 217, 0.06);
  --sidebar-text: #808080;
  --sidebar-text-hover: #21315D;
  --sidebar-active-bg: rgba(91, 194, 217, 0.1);
  --sidebar-active-text: #5BC2D9;
  --sidebar-active-border: #5BC2D9;
  --sidebar-border: #EEEEEE;
  --sidebar-brand-color: #21315D;

  /* Bottom Nav */
  --bottom-nav-height: 64px;
}

/* Dark Mode — toggled via data-theme attribute */
[data-theme="dark"] {
  --background: #0B1929;
  --background-subtle: #132238;
  --surface: #132238;
  --surface-elevated: #1B2D45;
  --surface-overlay: rgba(19, 34, 56, 0.95);
  --text-primary: #F0F4FA;
  --text-secondary: #9BB0CC;
  --text-muted: #7A94B5;
  --text-inverse: #0B1929;
  --border: #1B2D45;
  --border-light: #132238;
  --border-focus: #5BC2D9;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-card-hover: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --sidebar-bg: #0B1929;
  --sidebar-bg-hover: rgba(91, 194, 217, 0.08);
  --sidebar-text: #8FA3BF;
  --sidebar-text-hover: #F0F4FA;
  --sidebar-active-bg: rgba(91, 194, 217, 0.15);
  --sidebar-active-text: #5BC2D9;
  --sidebar-border: #1B2D45;
  --sidebar-brand-color: #F0F4FA;
}

/* --------------------------------------------
   Base Reset & Typography
   -------------------------------------------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 17px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Tajawal', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Arabic Font Support */
body[dir="rtl"] {
  font-family: 'Tajawal', 'Cairo', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

/* Brand Pattern Utility */
.brand-pattern-bg {
  position: relative;
}

.brand-pattern-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* Typography Scale */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: var(--spacing-md);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

h5 {
  font-size: 1.125rem;
}

h6 {
  font-size: 1rem;
}

p {
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-dark);
}

/* Selection */
::selection {
  background: var(--primary);
  color: white;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.visible {
  visibility: visible !important;
}

/* --------------------------------------------
   Layout Containers
   -------------------------------------------- */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

.container-sm {
  max-width: 640px;
}

.container-md {
  max-width: 960px;
}

.container-lg {
  max-width: 1280px;
}

/* Main Layout with Sidebar */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--spacing-xl);
  transition: margin-left var(--transition-slow);
}

/* --------------------------------------------
   Enhanced Navigation / Sidebar
   -------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: none;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width var(--transition-slow), transform var(--transition-slow);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.sidebar-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
  text-decoration: none;
}

.sidebar-brand-logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--sidebar-brand-color);
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-align: center;
}

.sidebar-brand-logo .brand-highlight {
  color: var(--sidebar-active-text);
}

.sidebar-brand-sub {
  font-size: 0.75rem;
  color: var(--sidebar-text);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-gradient);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
  box-shadow: var(--shadow-md);
}

.sidebar-brand-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--sidebar-brand-color);
}

.sidebar-nav {
  flex: 1;
  padding: var(--spacing-md);
  overflow-y: auto;
}

/* Scrollbar for dark sidebar */
.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--sidebar-border);
  border-radius: 4px;
}

.nav-section {
  margin-bottom: var(--spacing-lg);
}

.nav-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: var(--spacing-sm) var(--spacing-md);
  margin-bottom: var(--spacing-xs);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: 0.625rem var(--spacing-md);
  border-radius: var(--radius-lg);
  color: var(--sidebar-text);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all var(--transition-fast);
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-text-hover);
  transform: translateX(0);
}

[dir="rtl"] .nav-item:hover {
  transform: translateX(0);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--sidebar-active-border);
  border-radius: 0 4px 4px 0;
}

[dir="rtl"] .nav-item.active::before {
  left: auto;
  right: 0;
  border-radius: 4px 0 0 4px;
}

.nav-item-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.sidebar-footer {
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-footer .user-avatar {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border: 2px solid var(--sidebar-active-border);
}

.sidebar-footer .user-name {
  color: var(--sidebar-brand-color);
  font-weight: 600;
  font-size: 0.9rem;
}

.sidebar-footer .user-role {
  color: var(--sidebar-text);
  font-size: 0.8125rem;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  color: var(--sidebar-text);
  font-size: 0.85rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--spacing-sm) 0;
  transition: color var(--transition-fast);
  width: 100%;
}

.sidebar-logout-btn:hover {
  color: var(--error);
}

/* Top Navbar (alternative) */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: var(--spacing-md) 0;
}

.navbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}

.navbar-nav {
  display: flex;
  gap: var(--spacing-sm);
  list-style: none;
}

.navbar-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.navbar-link:hover {
  background: var(--background-subtle);
  color: var(--primary);
}

.navbar-link.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
  color: var(--primary);
}

/* User Menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.user-avatar:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

/* --------------------------------------------
   Grid System
   -------------------------------------------- */
.grid {
  display: grid;
  gap: var(--spacing-lg);
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-cols-5 {
  grid-template-columns: repeat(5, 1fr);
}

/* Auto-fit responsive grids */
.grid-auto-fit {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* --------------------------------------------
   Flexbox Utilities
   -------------------------------------------- */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-start {
  align-items: flex-start;
}

.items-center {
  align-items: center;
}

.items-end {
  align-items: flex-end;
}

.justify-start {
  justify-content: flex-start;
}

.justify-center {
  justify-content: center;
}

.justify-end {
  justify-content: flex-end;
}

.justify-between {
  justify-content: space-between;
}

.gap-xs {
  gap: var(--spacing-xs);
}

.gap-sm {
  gap: var(--spacing-sm);
}

.gap-md {
  gap: var(--spacing-md);
}

.gap-lg {
  gap: var(--spacing-lg);
}

.gap-xl {
  gap: var(--spacing-xl);
}

/* --------------------------------------------
   Premium Buttons
   -------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left var(--transition-slow);
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: var(--secondary);
  color: var(--primary);
  box-shadow: 0 4px 15px rgba(91, 194, 217, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  background: var(--secondary-dark);
  box-shadow: 0 8px 25px rgba(91, 194, 217, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--background-subtle);
  border-color: var(--primary-light);
  color: var(--primary);
}

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 4px 15px rgba(39, 174, 96, 0.35);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(39, 174, 96, 0.45);
}

.btn-danger {
  background: var(--error);
  color: white;
  box-shadow: 0 4px 15px rgba(235, 87, 87, 0.35);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(235, 87, 87, 0.45);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--background-subtle);
  color: var(--text-primary);
}

.btn-sm {
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: 0.8125rem;
}

.btn-lg {
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 1rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-lg);
}

/* Button Group */
.btn-group {
  display: flex;
  gap: var(--spacing-sm);
}

/* Disabled Buttons */
.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

/* Focus-Visible Ring — keyboard accessibility */
:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

.btn:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(91, 194, 217, 0.25);
}

/* --------------------------------------------
   Enhanced Form Elements
   -------------------------------------------- */
.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  color: var(--text-primary);
}

.form-label-required::after {
  content: '*';
  color: var(--error);
  margin-left: 4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--spacing-md);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  background: var(--surface);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(74, 173, 180, 0.12);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 44px;
}

.form-error {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: var(--spacing-sm);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.form-help {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: var(--spacing-xs);
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
}

.form-check-input {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  accent-color: var(--primary);
}

/* Input Group */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-input {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.input-group .btn {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

/* Search Input */
.search-input {
  position: relative;
}

.search-input .form-input {
  padding-left: 44px;
}

.search-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* --------------------------------------------
   Premium Cards
   -------------------------------------------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  transition: all var(--transition-slow);
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.card-flat {
  box-shadow: none;
  border: 1px solid var(--border);
}

.card-flat:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: var(--spacing-xs);
}

.card-body {
  padding: var(--spacing-md) 0;
}

.card-footer {
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--border-light);
}

/* Stats Cards */
.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: var(--primary);
  opacity: 0.06;
  border-radius: 50%;
  transform: translate(30%, -30%);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: var(--spacing-md);
}

.stat-icon-primary {
  background: rgba(74, 173, 180, 0.1);
  color: var(--primary);
}

.stat-icon-success {
  background: rgba(39, 174, 96, 0.1);
  color: var(--success);
}

.stat-icon-warning {
  background: rgba(242, 153, 74, 0.1);
  color: var(--warning);
}

.stat-icon-info {
  background: rgba(45, 156, 219, 0.1);
  color: var(--info);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-top: var(--spacing-sm);
}

.stat-trend-up {
  color: var(--success);
}

.stat-trend-down {
  color: var(--error);
}

/* Feature Cards (for landing) */
.feature-card {
  text-align: center;
  padding: var(--spacing-xl);
}

.feature-card:hover {
  transform: translateY(-8px);
}

.feature-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--spacing-lg);
  background: var(--primary);
  border-radius: var(--radius-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: var(--shadow-glow);
}

.feature-card h3 {
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.feature-card p {
  color: var(--text-secondary);
  margin: 0;
}

/* --------------------------------------------
   Enhanced Tables
   -------------------------------------------- */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  background: var(--background-subtle);
  padding: var(--spacing-md) var(--spacing-lg);
  text-align: left;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9375rem;
}

.table tbody tr {
  transition: background-color var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--background-subtle);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Table Actions */
.table-actions {
  display: flex;
  gap: var(--spacing-sm);
}

/* --------------------------------------------
   Badges & Status
   -------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-primary {
  background: rgba(74, 173, 180, 0.12);
  color: var(--primary);
}

.badge-success {
  background: rgba(39, 174, 96, 0.12);
  color: var(--success);
}

.badge-warning {
  background: rgba(242, 153, 74, 0.12);
  color: #b45309;
}

.badge-error {
  background: rgba(235, 87, 87, 0.12);
  color: var(--error);
}

.badge-info {
  background: rgba(45, 156, 219, 0.12);
  color: var(--info);
}

.badge-neutral {
  background: var(--background-subtle);
  color: var(--text-secondary);
}

/* Status Dot */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot-success {
  background: var(--success);
}

.status-dot-warning {
  background: var(--warning);
}

.status-dot-error {
  background: var(--error);
}

.status-dot-info {
  background: var(--info);
}

/* Pulse animation for active status */
.status-dot-pulse {
  position: relative;
}

.status-dot-pulse::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
  animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* --------------------------------------------
   Loading & Spinners
   -------------------------------------------- */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.spinner-lg {
  width: 60px;
  height: 60px;
  border-width: 4px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, var(--background-subtle) 25%, var(--border) 50%, var(--background-subtle) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-title {
  height: 1.5em;
  width: 60%;
  margin-bottom: 1em;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* --------------------------------------------
   Modals & Dialogs
   -------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: var(--surface);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease;
  will-change: transform, opacity;
  /* Hardware acceleration */
}

.modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--background-subtle);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--spacing-lg);
}

.modal-footer {
  padding: var(--spacing-lg);
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: var(--spacing-sm);
  justify-content: flex-end;
}

/* --------------------------------------------
   Hero Section (Landing Page)
   -------------------------------------------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(135deg, #4AADB4 0%, #3D9199 50%, #001D4A 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  padding: var(--spacing-xl);
}

.hero h1 {
  font-size: 3.5rem;
  color: white;
  margin-bottom: var(--spacing-lg);
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.hero p {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--spacing-xl);
}

.hero-buttons {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  flex-wrap: wrap;
}

.hero .btn-primary {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-xl);
}

.hero .btn-primary:hover {
  background: rgba(255, 255, 255, 0.95);
}

.hero .btn-secondary {
  background: transparent;
  color: white;
  border: 2px solid white;
}

.hero .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Floating shapes animation */
.hero-shapes {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero-shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  animation: float 20s infinite;
}

.hero-shape:nth-child(1) {
  width: 300px;
  height: 300px;
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.hero-shape:nth-child(2) {
  width: 200px;
  height: 200px;
  bottom: -50px;
  right: -50px;
  animation-delay: -5s;
}

.hero-shape:nth-child(3) {
  width: 150px;
  height: 150px;
  top: 50%;
  right: 10%;
  animation-delay: -10s;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-30px) rotate(180deg);
  }
}

/* --------------------------------------------
   Page Header
   -------------------------------------------- */
.page-header {
  margin-bottom: var(--spacing-xl);
}

.page-title {
  font-size: 1.75rem;
  margin-bottom: var(--spacing-xs);
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.page-actions {
  display: flex;
  gap: var(--spacing-sm);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.breadcrumb-item a {
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumb-item a:hover {
  color: var(--primary);
}

.breadcrumb-separator {
  color: var(--text-muted);
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 500;
}

/* --------------------------------------------
   Empty States
   -------------------------------------------- */
.empty-state {
  text-align: center;
  padding: var(--spacing-3xl);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: var(--spacing-lg);
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-sm);
}

.empty-state-description {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xl);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* --------------------------------------------
   Toasts & Notifications
   -------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  min-width: 300px;
  max-width: 400px;
  animation: toast-in 0.3s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

.toast-success .toast-icon {
  background: var(--success-light);
  color: var(--success);
}

.toast-error .toast-icon {
  background: var(--error-light);
  color: var(--error);
}

.toast-warning .toast-icon {
  background: var(--warning-light);
  color: var(--warning);
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.875rem;
}

.toast-message {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.toast-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: var(--spacing-xs);
}

/* --------------------------------------------
   Utility Classes
   -------------------------------------------- */
/* Text */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.text-primary {
  color: var(--primary);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-muted {
  color: var(--text-muted);
}

.text-success {
  color: var(--success);
}

.text-error {
  color: var(--error);
}

.text-warning {
  color: var(--warning);
}

.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

.font-medium {
  font-weight: 500;
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.8125rem;
}

.text-lg {
  font-size: 1.125rem;
}

/* Spacing */
.mt-1 {
  margin-top: var(--spacing-sm);
}

.mt-2 {
  margin-top: var(--spacing-md);
}

.mt-4 {
  margin-top: var(--spacing-xl);
}

.mt-6 {
  margin-top: var(--spacing-2xl);
}

.mb-1 {
  margin-bottom: var(--spacing-sm);
}

.mb-2 {
  margin-bottom: var(--spacing-md);
}

.mb-4 {
  margin-bottom: var(--spacing-xl);
}

.mb-6 {
  margin-bottom: var(--spacing-2xl);
}

.p-4 {
  padding: var(--spacing-xl);
}

/* Display */
.hidden {
  display: none !important;
}

.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

.w-full {
  width: 100%;
}

/* Background */
.bg-primary {
  background: var(--primary);
}

.bg-surface {
  background: var(--surface);
}

.bg-gradient {
  background: var(--primary-gradient);
}

/* Borders */
.rounded {
  border-radius: var(--radius-md);
}

.rounded-lg {
  border-radius: var(--radius-lg);
}

.rounded-xl {
  border-radius: var(--radius-xl);
}

.rounded-full {
  border-radius: var(--radius-full);
}

.border {
  border: 1px solid var(--border);
}

/* Cursor */
.cursor-pointer {
  cursor: pointer;
}

/* --------------------------------------------
   Responsive Design
   -------------------------------------------- */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  .container {
    padding: 0 var(--spacing-md);
  }

  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }

  .navbar-nav {
    display: none;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .modal {
    width: 95%;
    max-height: 95vh;
  }

  .btn-group {
    flex-direction: column;
  }

  .page-header {
    flex-direction: column;
    gap: var(--spacing-md);
  }
}

/* --------------------------------------------
   RTL Support
   -------------------------------------------- */
[dir="rtl"] {
  .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--border);
  }

  .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
  }

  .nav-item:hover {
    transform: translateX(-4px);
  }

  .nav-item.active::before {
    left: auto;
    right: 0;
    border-radius: 4px 0 0 4px;
  }

  .table th,
  .table td {
    text-align: right;
  }

  .form-select {
    background-position: left 12px center;
    padding-left: 44px;
    padding-right: var(--spacing-md);
  }

  .search-input .form-input {
    padding-left: var(--spacing-md);
    padding-right: 44px;
  }

  .search-input-icon {
    left: auto;
    right: 14px;
  }

  .toast-container {
    right: auto;
    left: var(--spacing-lg);
  }

  .modal-footer {
    flex-direction: row-reverse;
  }
}

/* --------------------------------------------
   Sidebar Navigation
   -------------------------------------------- */
:root {
  --sidebar-width: 260px;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-slow);
}

[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid var(--border-light);
}

.sidebar-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-light);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  text-decoration: none;
  color: var(--text-primary);
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
}

.sidebar-brand-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--sidebar-brand-color);
}

.sidebar-nav {
  flex: 1;
  padding: var(--spacing-md);
  overflow-y: auto;
}

.nav-section {
  margin-bottom: var(--spacing-lg);
}

.nav-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--spacing-sm) var(--spacing-md);
  margin-bottom: var(--spacing-xs);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  margin-bottom: var(--spacing-xs);
}

.nav-item:hover {
  background: var(--background-subtle);
  color: var(--primary);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 500;
}

.nav-item-icon {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: var(--spacing-lg);
  border-top: 1px solid var(--border-light);
  background: var(--background-subtle);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* Main content wrapper for sidebar layout */
.main-content-wrapper {
  margin-left: var(--sidebar-width);
  padding: var(--spacing-xl);
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

[dir="rtl"] .main-content-wrapper {
  margin-left: 0;
  margin-right: var(--sidebar-width);
}

/* Mobile sidebar */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content-wrapper {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .mobile-menu-toggle {
    display: flex !important;
  }
}

.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: var(--spacing-md);
  left: var(--spacing-md);
  z-index: 101;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-light);
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

[dir="rtl"] .mobile-menu-toggle {
  left: auto;
  right: var(--spacing-md);
}

/* --------------------------------------------
   Content Header Bar (Figma)
   -------------------------------------------- */
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) 0;
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.content-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb .breadcrumb-sep {
  opacity: 0.5;
}

.breadcrumb .breadcrumb-current {
  color: var(--text-secondary);
  font-weight: 500;
}

.content-header-welcome {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.content-header-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.header-search {
  position: relative;
  min-width: 200px;
}

.header-search input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.header-search input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(74, 173, 180, 0.12);
}

.header-search .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

[dir="rtl"] .header-search .search-icon {
  left: auto;
  right: 0.75rem;
}

[dir="rtl"] .header-search input {
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
}

.notification-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  color: var(--text-secondary);
  transition: background var(--transition-fast);
}

.notification-bell:hover {
  background: var(--background-subtle);
}

.notification-bell .bell-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: var(--error);
  border-radius: 50%;
  border: 2px solid var(--background);
}

.lang-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.lang-toggle-btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-toggle-btn:not(:last-child) {
  border-right: 1px solid var(--border);
}

.lang-toggle-btn.active {
  background: var(--primary);
  color: white;
}

.lang-toggle-btn:hover:not(.active) {
  background: var(--background-subtle);
  color: var(--text-primary);
}

/* --------------------------------------------
   Floating Action Button (FAB)
   -------------------------------------------- */
.fab-wrapper {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 900;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: var(--spacing-sm);
}

[dir="rtl"] .fab-wrapper {
  right: auto;
  left: 2rem;
}

.fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(74, 173, 180, 0.4);
  transition: all var(--transition-fast);
  line-height: 1;
}

.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 28px rgba(74, 173, 180, 0.5);
}

.fab.open {
  transform: rotate(45deg);
  background: var(--error);
}

.fab-menu {
  display: none;
  flex-direction: column;
  gap: var(--spacing-xs);
  align-items: flex-end;
}

.fab-wrapper.open .fab-menu {
  display: flex;
  animation: fabSlideUp 200ms ease-out;
}

@keyframes fabSlideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fab-action {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition-fast);
  border: 1px solid var(--border-light);
}

.fab-action:hover {
  background: var(--background-subtle);
  box-shadow: var(--shadow-lg);
  color: var(--primary);
}

.fab-action-icon {
  font-size: 1rem;
}

/* --------------------------------------------
   Offline Mode Banner
   -------------------------------------------- */
.offline-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: 0.5rem var(--spacing-lg);
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 950;
  border-bottom: 1px solid #f59e0b33;
}

.offline-banner.visible {
  display: flex;
}

.offline-banner-icon {
  font-size: 1rem;
}

/* --------------------------------------------
   Alert Banner (Figma)
   -------------------------------------------- */
.alert-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: var(--spacing-lg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  margin-bottom: var(--spacing-lg);
}

.alert-banner::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 200px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1));
  pointer-events: none;
}

.progress-bar-bg {
  width: 100%;
  background: rgba(255, 255, 255, 0.2);
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  margin: var(--spacing-md) 0;
}

.progress-bar-fill {
  background: white;
  height: 100%;
  border-radius: 999px;
  transition: width 1s ease-out;
}

/* --------------------------------------------
   Print Styles
   -------------------------------------------- */
@media print {

  .sidebar,
  .navbar,
  .btn,
  .modal-backdrop,
  .toast-container,
  .fab-wrapper,
  .offline-banner,
  .bottom-nav {
    display: none !important;
  }

  .main-content {
    margin: 0;
  }

  body {
    background: white;
    color: black;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* --------------------------------------------
   Bottom Navigation Bar (Figma Mobile)
   -------------------------------------------- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border-light);
  box-shadow: 0 -2px 12px rgba(0, 29, 74, 0.06);
  z-index: 1000;
  padding: 0 var(--spacing-sm);
}

.bottom-nav-items {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  min-width: 52px;
}

.bottom-nav-item:hover {
  color: var(--primary);
}

.bottom-nav-item.active {
  color: var(--primary);
  font-weight: 600;
}

.bottom-nav-item.active .bottom-nav-icon {
  background: rgba(74, 173, 180, 0.1);
}

.bottom-nav-icon {
  font-size: 1.3rem;
  width: 36px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

.bottom-nav-label {
  white-space: nowrap;
}

/* Show bottom nav on mobile, hide sidebar */
@media (max-width: 1024px) {
  .bottom-nav {
    display: block;
  }

  .main-content-wrapper {
    padding-bottom: calc(var(--bottom-nav-height) + var(--spacing-md));
  }

  /* Adjust FAB position above bottom nav */
  .fab-wrapper {
    bottom: calc(var(--bottom-nav-height) + 1rem);
  }

  /* Adjust toast position above bottom nav */
  .toast-container {
    bottom: calc(var(--bottom-nav-height) + var(--spacing-lg));
  }
}

/* --------------------------------------------
   Figma Alert Banner (Package Limit)
   -------------------------------------------- */
.alert-banner {
  background: var(--primary);
  color: white;
  border-radius: var(--radius-2xl);
  padding: var(--spacing-lg) var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
  position: relative;
  overflow: hidden;
}

.alert-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.alert-banner-text {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.alert-banner-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.alert-banner-subtitle {
  font-size: 0.875rem;
  opacity: 0.9;
}

.alert-banner-progress {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-full);
  margin-top: var(--spacing-sm);
  overflow: hidden;
}

.alert-banner-progress-bar {
  height: 100%;
  background: white;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.alert-banner-actions {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.btn-upgrade {
  background: white;
  color: var(--primary);
  border: none;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-upgrade:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-dismiss {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.btn-dismiss:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* --------------------------------------------
   Figma Maintenance Card
   -------------------------------------------- */
.ticket-card {
  background: var(--surface);
  border-radius: var(--radius-2xl);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  border-top: 4px solid var(--border);
  transition: all var(--transition-slow);
  margin-bottom: var(--spacing-md);
}

.ticket-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.ticket-card.priority-high {
  border-top-color: #2D9CDB;
}

.ticket-card.priority-medium {
  border-top-color: #F2994A;
}

.ticket-card.priority-low {
  border-top-color: #27AE60;
}

.ticket-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-sm);
}

.ticket-card-id {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.ticket-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: var(--spacing-xs) 0;
}

.ticket-card-meta {
  display: flex;
  gap: var(--spacing-md);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
}

.ticket-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ticket-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ticket-card-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.ticket-action-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--background-subtle);
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.ticket-action-btn:hover {
  background: var(--primary);
  color: white;
}

.ticket-action-btn.danger:hover {
  background: var(--error);
  color: white;
}

/* Priority pill badge */
.priority-pill {
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
}

.priority-pill.high {
  background: rgba(45, 156, 219, 0.12);
  color: #2D9CDB;
}

.priority-pill.medium {
  background: rgba(242, 153, 74, 0.12);
  color: #F2994A;
}

.priority-pill.low {
  background: rgba(39, 174, 96, 0.12);
  color: #27AE60;
}

/* Status badge */
.status-pill {
  padding: 4px 12px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid;
}

.status-pill.open {
  background: rgba(45, 156, 219, 0.08);
  color: #2D9CDB;
  border-color: rgba(45, 156, 219, 0.2);
}

.status-pill.in-progress {
  background: rgba(242, 153, 74, 0.08);
  color: #F2994A;
  border-color: rgba(242, 153, 74, 0.2);
}

.status-pill.completed {
  background: rgba(39, 174, 96, 0.08);
  color: #27AE60;
  border-color: rgba(39, 174, 96, 0.2);
}

/* --------------------------------------------
   Figma Full-Width Action Button
   -------------------------------------------- */
.btn-action-full {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  width: 100%;
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-2xl);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 15px rgba(74, 173, 180, 0.3);
}

.btn-action-full:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(74, 173, 180, 0.4);
}

/* --------------------------------------------
   Figma Report Stat Cards
   -------------------------------------------- */
.report-stat-card {
  background: var(--surface);
  border-radius: var(--radius-2xl);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  text-align: right;
}

.report-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: var(--spacing-sm);
  margin-left: auto;
}

[dir="rtl"] .report-stat-icon {
  margin-left: 0;
  margin-right: auto;
}

.report-stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xs);
}

.report-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.report-stat-unit {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-right: var(--spacing-xs);
}