/* ===========================================
   KING PHONE - BASE CSS
   Unified Light/Dark Theme System
   =========================================== */

/* ==================== CSS VARIABLES ==================== */
:root {
  /* Primary Colors */
  --color-primary: #f59e0b;
  --color-primary-dark: #d97706;
  --color-primary-light: #fbbf24;

  /* Light Theme (Default) */
  --color-bg: #fffaf0;
  --color-bg-alt: #fef3c7;
  --color-bg-card: #ffffff;
  --color-bg-elevated: #ffffff;

  --color-text: #111827;
  --color-text-secondary: #4b5563;
  --color-text-muted: #6b7280;

  --color-border: #e5e7eb;
  --color-border-light: #f3f4f6;

  --color-surface: #ffffff;
  --color-surface-hover: #f9fafb;

  /* Shadows (modern soft/diffuse) */
  --shadow-sm: 0 2px 8px rgba(17, 24, 39, 0.04);
  --shadow-md: 0 8px 24px rgba(17, 24, 39, 0.07);
  --shadow-lg: 0 16px 40px rgba(17, 24, 39, 0.1);
  --shadow-xl: 0 24px 64px rgba(17, 24, 39, 0.14);
  --shadow-glow: 0 8px 30px rgba(245, 158, 11, 0.25);

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Fonts */
  --font-arabic: 'Tajawal', system-ui, sans-serif;
  --font-latin: 'Inter', system-ui, sans-serif;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Spacing */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-2xl: 2rem;
  --radius-full: 9999px;
}

/* ==================== DARK THEME ==================== */
[data-theme="dark"] {
  --color-bg: #0f172a;
  --color-bg-alt: #1e293b;
  --color-bg-card: #1e293b;
  --color-bg-elevated: #334155;

  --color-text: #f1f5f9;
  --color-text-secondary: #cbd5e1;
  --color-text-muted: #94a3b8;

  --color-border: #334155;
  --color-border-light: #475569;

  --color-surface: #1e293b;
  --color-surface-hover: #334155;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 8px 30px rgba(245, 158, 11, 0.35);
}

/* Bring static Tailwind utility colors in line with the theme so pages
   built with them (e.g. the admin panel) actually go dark too. */
[data-theme="dark"] body {
  background-color: var(--color-bg);
  color: var(--color-text);
}

[data-theme="dark"] .bg-white {
  background-color: var(--color-bg-card);
}

[data-theme="dark"] .bg-gray-50 {
  background-color: var(--color-bg);
}

[data-theme="dark"] .bg-gray-100 {
  background-color: var(--color-surface-hover);
}

[data-theme="dark"] .text-gray-900 {
  color: var(--color-text);
}

[data-theme="dark"] .text-gray-700,
[data-theme="dark"] .text-gray-600 {
  color: var(--color-text-secondary);
}

[data-theme="dark"] .text-gray-500 {
  color: var(--color-text-muted);
}

[data-theme="dark"] .border-gray-100,
[data-theme="dark"] .border-gray-200,
[data-theme="dark"] .border-gray-300 {
  border-color: var(--color-border);
}

/* ==================== BASE RESET ==================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-arabic);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color var(--transition-base), color var(--transition-base);
}

html[dir="ltr"] body {
  font-family: var(--font-latin);
}

/* ==================== SELECTION ==================== */
::selection {
  background-color: rgba(245, 158, 11, 0.3);
  color: inherit;
}

/* ==================== CONTAINER ==================== */
.container-page {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

/* ==================== GLASS EFFECT ==================== */
.glass {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--color-border);
}

[data-theme="dark"] .glass {
  background: rgba(30, 41, 59, 0.85);
  border-color: var(--color-border);
}

/* ==================== TEXT UTILITIES ==================== */
.text-gradient {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 52%, #7c3aed 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ==================== ANIMATIONS ==================== */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==================== SCROLLBAR ==================== */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ==================== SKIP LINK ==================== */
.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-full);
  background: var(--color-text);
  color: var(--color-bg);
  text-decoration: none;
  font-weight: 700;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 1rem;
}

/* ==================== THEME TOGGLE BUTTON ==================== */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* Theme icon visibility - light theme shows moon (to switch to dark), dark theme shows sun (to switch to light) */
.theme-toggle .theme-icon-light {
  display: block;
}

.theme-toggle .theme-icon-dark {
  display: none;
}

[data-theme="dark"] .theme-toggle .theme-icon-light {
  display: none;
}

[data-theme="dark"] .theme-toggle .theme-icon-dark {
  display: block;
}

/* ==================== LANGUAGE BUTTONS ==================== */
.lang-btn {
  min-height: 44px;
  padding: 0.625rem 1.1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-1px);
}

.lang-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-bg);
  box-shadow: var(--shadow-glow);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .container-page {
    width: calc(100% - 24px);
  }
}
