/**
 * 🛒 TAKAMOL HYPERMARKET — DESIGN SYSTEM & CORE STYLES
 * High-performance, Pure Vanilla CSS3 with RTL Support & Modern UI Tokens
 */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=Readex+Pro:wght@400;500;600;700&display=swap');

:root {
  /* Brand Palette - Emerald Freshness & Professional Trust */
  --primary: #059669;
  --primary-hover: #047857;
  --primary-dark: #064e3b;
  --primary-light: #d1fae5;
  --primary-50: #ecfdf5;

  /* Secondary & Navy Tones */
  --secondary: #0f172a;
  --secondary-hover: #1e293b;
  --secondary-light: #334155;

  /* Accent, Discount & Offer Colors */
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --accent-light: #fef3c7;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fee2e2;
  --success: #10b981;
  --info: #3b82f6;

  /* Neutrals & Surfaces */
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f1f5f9;
  --bg-card: #ffffff;
  
  /* Text & Typography */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-inverse: #ffffff;

  /* Borders & Dividers */
  --border-color: #e2e8f0;
  --border-color-hover: #cbd5e1;
  --border-focus: #10b981;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px -1px rgba(0, 0, 0, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 10px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 35px -5px rgba(0, 0, 0, 0.12), 0 8px 15px -3px rgba(0, 0, 0, 0.06);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Typography Specs */
  --font-family: 'Cairo', 'Readex Pro', system-ui, -apple-system, sans-serif;
  --font-alt: 'Readex Pro', 'Cairo', sans-serif;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout Containers */
  --container-max-width: 1280px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

img, svg, picture, video {
  max-width: 100%;
  display: block;
  height: auto;
}

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

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

button {
  cursor: pointer;
  user-select: none;
}

ul, ol {
  list-style: none;
}

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

/* ---------------- TYPOGRAPHY UTILITIES ---------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--secondary);
}

.section-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-color);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  position: relative;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 22px;
  background: var(--primary);
  border-radius: var(--radius-sm);
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.view-all-link {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  background: var(--primary-50);
  transition: all var(--transition-fast);
}

.view-all-link:hover {
  background: var(--primary);
  color: var(--text-inverse);
  transform: translateX(-3px);
}

/* ---------------- BUTTONS ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
  border: 1px solid transparent;
  text-align: center;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background-color: var(--primary);
  color: var(--text-inverse);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--secondary);
  color: var(--text-inverse);
}

.btn-secondary:hover {
  background-color: var(--secondary-hover);
}

.btn-outline {
  border-color: var(--border-color-hover);
  background-color: var(--bg-surface);
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: var(--primary-50);
}

.btn-accent {
  background-color: var(--accent);
  color: var(--secondary);
  font-weight: 700;
}

.btn-accent:hover {
  background-color: var(--accent-hover);
}

.btn-danger {
  background-color: var(--danger);
  color: var(--text-inverse);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

.btn-icon-only {
  padding: 0.65rem;
  border-radius: var(--radius-full);
}

/* ---------------- BADGES & CHIPS ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

.badge-primary {
  background-color: var(--primary-light);
  color: var(--primary-dark);
}

.badge-danger {
  background-color: var(--danger-light);
  color: var(--danger-hover);
}

.badge-accent {
  background-color: var(--accent-light);
  color: var(--accent-hover);
}

.badge-neutral {
  background-color: var(--bg-surface-alt);
  color: var(--text-muted);
}

/* ---------------- FORM INPUTS ---------------- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: var(--secondary);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
  background-color: #ffffff;
}

.form-control::placeholder {
  color: var(--text-light);
}

select.form-control {
  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: left 0.75rem center;
  background-size: 1.1rem;
  padding-left: 2.2rem;
}

/* ---------------- TOAST NOTIFICATIONS ---------------- */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 400px;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--secondary);
  color: #fff;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  animation: slideUpFade 0.3s var(--transition-smooth);
}

.toast-success {
  border-right: 4px solid var(--primary);
}

.toast-danger {
  border-right: 4px solid var(--danger);
}

.toast-info {
  border-right: 4px solid var(--info);
}

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