:root {
  --brand-900: #051c22;
  --brand-700: #0a3d47;
  --brand-500: #038387;
  --brand-100: #d7f2ef;
  --accent-500: #d4a53c;
  --surface: #ffffff;
  --bg: #f8fafb;
  --text-900: #0f1f24;
  --text-500: #4a6572;
  --success: #16a34a;
  --danger: #dc2626;
  --radius-card: 18px;
  --radius-pill: 999px;
  --shadow-card: 0 4px 20px rgba(5,28,34,.08);
}

/* Dark Mode Colors */
.dark {
  --surface: #1a2f35;
  --bg: #0f1f24;
  --text-900: #f0f4f5;
  --text-500: #a0b4bb;
  --shadow-card: 0 4px 20px rgba(0,0,0,0.3);
}

/* Custom Base Styling */
body {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  background-color: var(--bg);
  color: var(--text-900);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Mobile App Wrapper */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background-color: var(--bg);
  position: relative;
  box-shadow: 0 0 40px var(--shadow-card);
  padding-bottom: 80px;
  transition: background-color 0.3s ease;
}

/* Header Gradient */
.header-gradient {
  background: linear-gradient(135deg, var(--brand-900) 0%, var(--brand-700) 50%, var(--brand-500) 100%);
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
  color: #ffffff;
}

.dark .header-gradient {
  background: linear-gradient(135deg, #020a0c 0%, #051c22 50%, #023d3f 100%);
}

/* Cards */
.card-custom {
  background-color: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(5,28,34,0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}

.dark .card-custom {
  border-color: rgba(255,255,255,0.08);
}

.card-custom:active {
  transform: scale(0.98);
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-700) 100%);
  color: #ffffff;
  border-radius: var(--radius-pill);
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  width: 100%;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(3, 131, 135, 0.3);
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(3, 131, 135, 0.4);
}

.btn-accent {
  background: linear-gradient(135deg, #d4a53c 0%, #e7b415 100%);
  color: var(--brand-900);
  border-radius: var(--radius-pill);
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  width: 100%;
  box-shadow: 0 4px 15px rgba(212, 165, 60, 0.3);
  border: none;
  cursor: pointer;
}

/* Bottom Tab Bar */
.bottom-tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 70px;
  background-color: var(--surface);
  box-shadow: 0 -4px 20px var(--shadow-card);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  border-top: 1px solid rgba(5,28,34,0.06);
  transition: background-color 0.3s ease;
}

.dark .bottom-tab-bar {
  border-top-color: rgba(255,255,255,0.08);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-500);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  position: relative;
  width: 20%;
  transition: color 0.2s ease;
}

.tab-item.active {
  color: var(--brand-500);
}

.tab-item.active::after {
  content: '';
  position: absolute;
  top: -8px;
  width: 20px;
  height: 4px;
  background: linear-gradient(90deg, #d4a53c, #e7b415);
  border-radius: 999px;
}

/* Top Tab Slider */
.tab-slider-container {
  display: flex;
  position: relative;
  background-color: var(--surface);
  transition: background-color 0.3s ease;
}

.tab-slider-item {
  flex: 1;
  text-align: center;
  padding: 12px 0;
  font-weight: 700;
  color: var(--text-500);
  cursor: pointer;
  transition: color 0.2s ease;
}

.tab-slider-item.active {
  color: var(--brand-500);
}

.tab-slider-line {
  position: absolute;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, #d4a53c, #e7b415);
  transition: left 0.3s ease, right 0.3s ease;
  width: 33.33%;
  border-radius: 3px 3px 0 0;
}

/* Page Transition */
.page-slide-in {
  animation: slideInRight 0.3s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 8px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Image fallback */
img[src=""], img:not([src]) {
  background: linear-gradient(135deg, var(--brand-100) 0%, #e5e7eb 100%);
  min-height: 60px;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

.dark .badge-success { background: #14532d; color: #bbf7d0; }
.dark .badge-warning { background: #451a03; color: #fde68a; }
.dark .badge-danger { background: #450a0a; color: #fecaca; }
.dark .badge-info { background: #1e1b4b; color: #bfdbfe; }

/* Pulse animation */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}
.pulse-dot { animation: pulse-dot 2s infinite; }

/* Theme Toggle Switch */
.theme-toggle {
  width: 56px;
  height: 28px;
  border-radius: 14px;
  background: #e5e7eb;
  border: 2px solid #d1d5db;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.theme-toggle.dark {
  background: var(--brand-500);
  border-color: var(--brand-500);
}

.theme-toggle::after {
  content: '🌙';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.theme-toggle.dark::after {
  content: '☀️';
  transform: translateX(28px);
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }
.dark ::-webkit-scrollbar-thumb { background: #4a6572; }

/* Input focus styles */
input:focus, select:focus, textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(3, 131, 135, 0.3);
  border-color: var(--brand-500) !important;
}

/* Glass morphism */
.glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.dark .glass {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Mobile responsive */
@media (max-width: 480px) {
  .app-wrapper {
    max-width: 100%;
    box-shadow: none;
  }
  .bottom-tab-bar {
    left: 0;
    transform: none;
    max-width: 100%;
    border-radius: 0;
  }
  body {
    background-color: var(--bg-primary) !important;
  }
}

/* Custom scrollbar for desktop */
@media (min-width: 641px) {
  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  ::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
  }
  ::-webkit-scrollbar-thumb {
    background: rgba(3, 131, 135, 0.4);
    border-radius: 3px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: rgba(3, 131, 135, 0.6);
  }
  .dark ::-webkit-scrollbar-track {
    background: #1a2f35;
  }
  .dark ::-webkit-scrollbar-thumb {
    background: rgba(3, 131, 135, 0.6);
  }
}

/* Hide scrollbar on mobile for cleaner look */
@media (max-width: 480px) {
  .app-wrapper {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .app-wrapper::-webkit-scrollbar {
    display: none;
  }
}
