/**
 * Quran Memorization Association Design System
 * نظام تصميم جمعية تحفيظ القرآن الكريم بأملج
 * Version: 2.0.0
 * Direction: RTL
 * Style: Islamic & Modern
 */

/* ==========================================
   FONT FACE - Local Fonts
   ========================================== */
@font-face {
  font-family: 'Alfont';
  src: url('../fonts/alfont.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ==========================================
   IMPORT FONTS - Fallback (Optional)
   ========================================== */
/* Google Fonts are now optional fallbacks - commented out to reduce CDN dependency */
/* @import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700&family=Reem+Kufi:wght@400;500;600;700&family=Noto+Kufi+Arabic:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap'); */

/* ==========================================
   CSS VARIABLES - Design System Tokens
   ========================================== */
:root {
  /* === BRAND COLORS === */
  --color-brand-primary: #818E4D;
  /* Olive green */
  --color-brand-secondary: #CFB051;
  /* Gold */
  --color-brand-accent: #005C3A;
  /* Dark green for navbar/sidebar */

  /* === PRIMARY COLORS (mapped to brand for compatibility) === */
  --color-primary-main: #818E4D;
  --color-primary-light: #9BA66A;
  --color-primary-dark: #6B7540;
  --color-primary-contrast: #FFFFFF;

  /* === SECONDARY COLORS === */
  --color-secondary-coral: #CFB051;
  --color-secondary-yellow: #CFB051;
  --color-secondary-purple: #818E4D;
  --color-secondary-navy: #005C3A;

  /* === BACKGROUND COLORS === */
  --color-bg-main: #F5F7F6;
  --color-bg-card: #FFFFFF;
  --color-bg-hover: #ECE5D3;
  --color-bg-muted: #ECE5D3;

  /* === TEXT COLORS === */
  --color-text-primary: #1F2933;
  --color-text-secondary: #6B7280;
  --color-text-disabled: #9CA3AF;
  --color-text-white: #FFFFFF;
  --color-text-on-primary: #FFFFFF;

  /* === STATUS COLORS === */
  --color-status-success: #16A34A;
  --color-status-warning: #EAB308;
  --color-status-error: #DC2626;
  --color-status-info: #2563EB;

  /* === CHART COLORS === */
  --color-chart-line1: #818E4D;
  --color-chart-line2: #CFB051;
  --color-chart-line3: #16A34A;
  --color-chart-area1: rgba(129, 142, 77, 0.1);
  --color-chart-area2: rgba(207, 176, 81, 0.1);

  /* === ICON COLORS === */
  --color-icon-students: #818E4D;
  --color-icon-teachers: #CFB051;
  --color-icon-events: #EAB308;
  --color-icon-foods: #005C3A;

  /* === TYPOGRAPHY === */
  --font-family-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-family-arabic: 'Alfont', 'Tajawal', 'Cairo', 'IBM Plex Sans Arabic', sans-serif;
  --font-family-headings: 'Alfont', 'Reem Kufi', 'Noto Kufi Arabic', 'Tajawal', sans-serif;
  --font-family-numbers: 'Inter', 'Roboto', sans-serif;

  /* Font Sizes */
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-base: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-size-3xl: 30px;
  --font-size-4xl: 36px;

  /* Font Weights */
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Line Heights */
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* === SPACING === */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  --spacing-3xl: 64px;

  /* === BORDER RADIUS === */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* === SHADOWS === */
  --shadow-sm: 0 1px 2px rgba(31, 41, 51, 0.05);
  --shadow-md: 0 4px 6px rgba(31, 41, 51, 0.07);
  --shadow-lg: 0 10px 15px rgba(31, 41, 51, 0.1);
  --shadow-xl: 0 20px 25px rgba(31, 41, 51, 0.15);

  /* === TRANSITIONS === */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

  /* === BREAKPOINTS === */
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;

  /* === LAYOUT === */
  --navbar-height: 70px;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;
  --container-max-width: 1440px;

  /* === Z-INDEX === */
  --z-index-dropdown: 1000;
  --z-index-sticky: 1020;
  --z-index-fixed: 1030;
  --z-index-modal-backdrop: 1040;
  --z-index-modal: 1050;
  --z-index-popover: 1060;
  --z-index-tooltip: 1070;
}

/* ==========================================
   DARK MODE THEME
   ========================================== */
[data-theme="dark"] {
  /* === BACKGROUND COLORS === */
  --color-bg-main: #121212;
  --color-bg-card: #1E1E1E;
  --color-bg-hover: #2C2C2C;
  --color-bg-muted: #2C2C2C;

  /* === TEXT COLORS === */
  --color-text-primary: #E5E7EB;
  --color-text-secondary: #9CA3AF;
  --color-text-disabled: #6B7280;
  --color-text-white: #FFFFFF;
  /* Keep white as white */

  /* === BRAND COLORS === */
  /* Slightly adjust for better contrast on dark */
  --color-brand-primary: #9BA66A;
  --color-brand-secondary: #CFB051;
  --color-brand-accent: #004d30;
  /* Slightly darker accent for deep backgrounds */

  /* === SHADOWS (Lighter for visibility on dark) === */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);

  /* === BADGES === */
  --badge-good-bg: #064E3B;
  --badge-good-color: #D1FAE5;

  --badge-excellent-bg: #1E3A8A;
  --badge-excellent-color: #DBEAFE;

  --badge-average-bg: #78350F;
  --badge-average-color: #FEF3C7;

  --badge-poor-bg: #7F1D1D;
  --badge-poor-color: #FEE2E2;
}

/* ==========================================
   BASE STYLES
   ========================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  direction: rtl;
}

body {
  font-family: var(--font-family-arabic);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-main);
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Headings use Islamic font */
h1,
h2,
h3,
h4,
h5,
h6,
.page-title,
.section-title {
  font-family: var(--font-family-headings);
}

/* === NUMBERS === */
.number,
.stat-value,
[class*="number"],
[class*="count"],
[class*="amount"] {
  font-family: var(--font-family-numbers);
  direction: ltr;
  display: inline-block;
}

/* ==========================================
   BADGE COLORS
   ========================================== */
:root {
  /* Good Badge */
  --badge-good-bg: #D1FAE5;
  --badge-good-color: #065F46;

  /* Excellent Badge */
  --badge-excellent-bg: #DBEAFE;
  --badge-excellent-color: #1E40AF;

  /* Average Badge */
  --badge-average-bg: #FEF3C7;
  --badge-average-color: #92400E;

  /* Poor Badge */
  --badge-poor-bg: #FEE2E2;
  --badge-poor-color: #991B1B;
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */
:focus-visible {
  outline: 2px solid var(--color-primary-main);
  outline-offset: 2px;
}

/* Skip to main content link */
.skip-to-main {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary-main);
  color: var(--color-text-white);
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-to-main:focus {
  top: 0;
}

/* ==========================================
   RESPONSIVE TYPOGRAPHY
   ========================================== */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
}

@media (min-width: 1536px) {
  html {
    font-size: 18px;
  }
}

/* ==========================================
   UTILITIES
   ========================================== */

/* Display */
.d-none {
  display: none !important;
}

.d-block {
  display: block !important;
}

.d-flex {
  display: flex !important;
}

.d-inline-flex {
  display: inline-flex !important;
}

.d-grid {
  display: grid !important;
}

/* Flex utilities */
.flex-row {
  flex-direction: row !important;
}

.flex-column {
  flex-direction: column !important;
}

.justify-start {
  justify-content: flex-start !important;
}

.justify-center {
  justify-content: center !important;
}

.justify-between {
  justify-content: space-between !important;
}

.justify-end {
  justify-content: flex-end !important;
}

.align-start {
  align-items: flex-start !important;
}

.align-center {
  align-items: center !important;
}

.align-end {
  align-items: flex-end !important;
}

.gap-xs {
  gap: var(--spacing-xs) !important;
}

.gap-sm {
  gap: var(--spacing-sm) !important;
}

.gap-md {
  gap: var(--spacing-md) !important;
}

.gap-lg {
  gap: var(--spacing-lg) !important;
}

.gap-xl {
  gap: var(--spacing-xl) !important;
}

/* Text alignment */
.text-right {
  text-align: right !important;
}

.text-left {
  text-align: left !important;
}

.text-center {
  text-align: center !important;
}

/* Font weights */
.fw-regular {
  font-weight: var(--font-weight-regular) !important;
}

.fw-medium {
  font-weight: var(--font-weight-medium) !important;
}

.fw-semibold {
  font-weight: var(--font-weight-semibold) !important;
}

.fw-bold {
  font-weight: var(--font-weight-bold) !important;
}

/* Text colors */
.text-primary {
  color: var(--color-text-primary) !important;
}

.text-secondary {
  color: var(--color-text-secondary) !important;
}

.text-white {
  color: var(--color-text-white) !important;
}

.text-success {
  color: var(--color-status-success) !important;
}

.text-warning {
  color: var(--color-status-warning) !important;
}

.text-error {
  color: var(--color-status-error) !important;
}

.text-brand-primary {
  color: var(--color-brand-primary) !important;
}

/* Background colors */
.bg-main {
  background-color: var(--color-bg-main) !important;
}

.bg-card {
  background-color: var(--color-bg-card) !important;
}

.bg-primary {
  background-color: var(--color-primary-main) !important;
}

/* Width & Height */
.w-100 {
  width: 100% !important;
}

.h-100 {
  height: 100% !important;
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
}