/* ============================================
   Re-Kit Main CSS — Dark/Light Mode + AR/EN
   ============================================ */

:root {
  --primary: #57F287;
  --primary-2: #32E0A1;
  --primary-dark: #3dba6a;
  --primary-glow: rgba(87, 242, 135, 0.15);

  --bg-1: #0A0F1C;
  --bg-2: #101827;
  --bg-3: #161B22;
  --bg-card: #1a2235;
  --bg-input: #0d1526;

  --text-primary: #ffffff;
  --text-secondary: #a0aec0;
  --text-muted: #718096;

  --border: rgba(255,255,255,0.08);
  --border-focus: rgba(87, 242, 135, 0.5);

  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-card: 0 2px 16px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 30px rgba(87,242,135,0.2);

  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
  --font-ar: 'Cairo', 'Tajawal', sans-serif;
  --font-en: 'Inter', 'Segoe UI', sans-serif;

  --nav-h: 70px;
  --sidebar-w: 260px;
}

[data-theme="light"] {
  --bg-1: #f0f4f8;
  --bg-2: #ffffff;
  --bg-3: #e8edf5;
  --bg-card: #ffffff;
  --bg-input: #f7fafc;
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --border: rgba(0,0,0,0.08);
  --border-focus: rgba(87, 242, 135, 0.6);
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-card: 0 2px 16px rgba(0,0,0,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

body[dir="rtl"] { font-family: var(--font-ar); }

/* ---- Typography ---- */
h1,h2,h3,h4,h5,h6 { line-height: 1.2; font-weight: 700; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea, select { font: inherit; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ---- Utility ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-wide { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-4 { gap: 16px; }
.gap-8 { gap: 32px; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.mt-2 { margin-top: 8px; }
.mb-4 { margin-bottom: 16px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #0A0F1C;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(87,242,135,0.35);
}
.btn-success {
  background: linear-gradient(135deg, #25d366, #1da851);
  color: #fff;
}
.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37,211,102,0.35);
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary-glow);
  transform: translateY(-2px);
}
.btn-ghost {
  background: var(--bg-3);
  color: var(--text-primary);
}
.btn-ghost:hover { background: var(--bg-card); }
.btn-danger {
  background: rgba(229,62,62,0.15);
  color: #fc8181;
  border: 1px solid rgba(229,62,62,0.2);
}
.btn-danger:hover { background: rgba(229,62,62,0.25); }
.btn-sm { padding: 7px 16px; font-size: 0.82rem; }
.btn-lg { padding: 14px 30px; font-size: 1rem; }
.btn-icon { padding: 10px; border-radius: var(--radius-sm); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-loading { position: relative; color: transparent !important; }
.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  color: #0A0F1C;
  border-top-color: #0A0F1C;
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-sale { background: rgba(66,153,225,0.15); color: #63b3ed; border: 1px solid rgba(66,153,225,0.3); }
.badge-borrow { background: rgba(237,137,54,0.15); color: #f6ad55; border: 1px solid rgba(237,137,54,0.3); }
.badge-donate { background: rgba(87,242,135,0.15); color: #57F287; border: 1px solid rgba(87,242,135,0.3); }
.badge-available { background: rgba(87,242,135,0.15); color: #57F287; }
.badge-sold { background: rgba(229,62,62,0.15); color: #fc8181; }
.badge-borrowed { background: rgba(237,137,54,0.15); color: #f6ad55; }
.badge-donated { background: rgba(159,122,234,0.15); color: #b794f4; }
.badge-new { background: rgba(87,242,135,0.1); color: #57F287; }
.badge-like-new { background: rgba(66,153,225,0.1); color: #63b3ed; }
.badge-good { background: rgba(237,137,54,0.1); color: #f6ad55; }
.badge-used { background: rgba(160,174,192,0.1); color: #a0aec0; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
}
.card:hover {
  border-color: rgba(87,242,135,0.2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

/* ---- Navbar ---- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(10,15,28,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: background var(--transition);
}
[data-theme="light"] .navbar {
  background: rgba(240,244,248,0.9);
}
.navbar .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}
.nav-logo img { height: 40px; width: auto; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}
.nav-links a {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.nav-links a:hover, .nav-links a.active {
  color: var(--primary);
  background: var(--primary-glow);
}
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  cursor: pointer;
  object-fit: cover;
  transition: transform var(--transition);
}
.nav-avatar:hover { transform: scale(1.08); }

/* Theme & Lang Toggle */
.theme-toggle, .lang-toggle {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  color: var(--text-secondary);
  font-size: 1.1rem;
  transition: all var(--transition);
  border: 1px solid var(--border);
}
.theme-toggle:hover, .lang-toggle:hover {
  color: var(--primary);
  border-color: var(--primary);
}
.lang-toggle { font-size: 0.8rem; font-weight: 700; }

/* Mobile Menu */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
  transition: background .15s;
}
.menu-toggle:hover { background: var(--bg-3); }
.menu-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all .25s cubic-bezier(.4,0,.2,1);
}

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-control::placeholder { color: var(--text-muted); }
.form-error {
  font-size: 0.82rem;
  color: #fc8181;
  margin-top: 5px;
}
.input-icon { position: relative; }
.input-icon .form-control { padding-left: 42px; }
[dir="rtl"] .input-icon .form-control { padding-left: 16px; padding-right: 42px; }
.input-icon .icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
[dir="rtl"] .input-icon .icon { left: auto; right: 14px; }

/* Select */
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
[dir="rtl"] select.form-control {
  background-position: left 12px center;
  padding-right: 16px;
  padding-left: 36px;
}

/* ---- Grid ---- */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

/* ---- Resource Card ---- */
.resource-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(87,242,135,0.1);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.resource-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
  border-color: rgba(87,242,135,0.25);
}
.resource-card-img {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: var(--bg-3);
  display: flex; align-items: center; justify-content: center;
}
.resource-placeholder-icon {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  opacity: 0.4;
}
.resource-placeholder-icon svg { width: 54px; height: 54px; }
.rc-meta-item { display: inline-flex; align-items: center; gap: 4px; }
.resource-card-img img {
  width: 100%; height: 100%;
  object-fit: contain;
  transition: transform 0.4s ease;
}
.resource-card:hover .resource-card-img img { transform: none; }
.resource-card-badges {
  position: absolute;
  top: 10px; left: 10px;
  display: flex; gap: 5px;
  flex-wrap: wrap;
}
[dir="rtl"] .resource-card-badges { left: auto; right: 10px; }
.resource-card-save {
  position: absolute;
  top: 10px; right: 10px;
  width: 38px; height: 38px;
  background: rgba(8,12,24,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.5);
  transition: color .2s, background .2s, transform .15s, box-shadow .2s;
  border: 1.5px solid rgba(255,255,255,0.1);
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
[dir="rtl"] .resource-card-save { right: auto; left: 10px; }
.resource-card-save:hover { color: #ff4d6d; background: rgba(255,77,109,0.15); border-color: rgba(255,77,109,0.3); transform: scale(1.1); }
.resource-card-save.saved { color: #ff4d6d; background: rgba(255,77,109,0.18); border-color: rgba(255,77,109,0.4); }
.resource-card-save.saved svg { animation: heartbeat .3s ease; }
@keyframes heartbeat { 0%{transform:scale(1)} 40%{transform:scale(1.35)} 70%{transform:scale(0.9)} 100%{transform:scale(1)} }
[data-theme="light"] .resource-card-save { background: rgba(255,255,255,0.9); border-color: rgba(0,0,0,0.1); color: #999; }
.resource-card-body { padding: 16px; }
.resource-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.resource-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.resource-card-meta span { display: flex; align-items: center; gap: 4px; }
.resource-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.resource-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

/* ---- Section ---- */
.section { padding: 80px 0; }
.section-header { text-align: center; margin-bottom: 50px; }
.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: var(--primary-glow);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 14px;
  border: 1px solid rgba(87,242,135,0.2);
}
.section-title { font-size: 2.2rem; margin-bottom: 14px; }
.section-title span { color: var(--primary); }
.section-desc { color: var(--text-secondary); font-size: 1.05rem; max-width: 600px; margin: 0 auto; }

/* ---- Dropdown ---- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 200px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition);
  z-index: 500;
}
[dir="rtl"] .dropdown-menu { right: auto; left: 0; }
.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all var(--transition);
  border-radius: var(--radius-sm);
  margin: 3px 5px;
}
.dropdown-item:hover { background: var(--bg-3); color: var(--text-primary); }
.dropdown-item.danger:hover { color: #fc8181; background: rgba(229,62,62,0.08); }
.dropdown-divider { height: 1px; background: var(--border); margin: 5px 0; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: all var(--transition);
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-card); }

/* ---- Toast ---- */
#toast-container {
  position: fixed;
  top: 90px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
[dir="rtl"] #toast-container { right: auto; left: 20px; }
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 260px;
  max-width: 380px;
  animation: slideIn 0.3s ease;
  font-size: 0.9rem;
}
.toast.success { border-left: 3px solid var(--primary); }
.toast.error { border-left: 3px solid #fc8181; }
.toast.info { border-left: 3px solid #63b3ed; }
.toast-icon { font-size: 1.2rem; flex-shrink: 0; }
.toast-close { margin-left: auto; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; }
[dir="rtl"] .toast-close { margin-left: 0; margin-right: auto; }

/* ---- Loader ---- */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease;
}
.page-loader.hidden { opacity: 0; pointer-events: none; }
.loader-ring {
  width: 56px; height: 56px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---- Floating Reko Button ---- */
.reko-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px; height: 58px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(87,242,135,0.4);
  z-index: 900;
  transition: all var(--transition);
  animation: pulse-fab 2.5s ease-in-out infinite;
}
[dir="rtl"] .reko-fab { right: auto; left: 28px; }
.reko-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(87,242,135,0.5);
}
.reko-fab img { width: 34px; height: 34px; object-fit: contain; }

/* ---- Animations ---- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-fab {
  0%,100% { box-shadow: 0 8px 24px rgba(87,242,135,0.4); }
  50% { box-shadow: 0 8px 36px rgba(87,242,135,0.65); }
}
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
[dir="rtl"] @keyframes slideIn {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes glow {
  0%,100% { opacity: 0.6; }
  50% { opacity: 1; }
}
.fade-up { animation: fadeUp 0.5s ease both; }
.fade-up-2 { animation: fadeUp 0.5s 0.1s ease both; }
.fade-up-3 { animation: fadeUp 0.5s 0.2s ease both; }

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.4;
}
.empty-state h3 { font-size: 1.2rem; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { color: var(--text-muted); font-size: 0.9rem; }

/* ---- Footer ---- */
.footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 50px 0 24px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3,1fr);
  gap: 40px;
  margin-bottom: 40px;
}
.footer-brand-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
  font-size: 1.2rem; font-weight: 700; color: var(--primary);
}
.footer-brand-logo img { height: 38px; }
.footer-brand-desc { color: var(--text-muted); font-size: 0.88rem; line-height: 1.7; max-width: 240px; }
.footer-col h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 14px; color: var(--text-primary); }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-links a { color: var(--text-muted); font-size: 0.87rem; transition: color var(--transition); }
.footer-links a:hover { color: var(--primary); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.footer-socials { display: flex; gap: 10px; }
.footer-socials a {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  color: var(--text-muted);
  transition: all var(--transition);
}
.footer-socials a:hover { color: var(--primary); background: var(--primary-glow); }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2,1fr); }
}
/* Mobile full-screen nav overlay */
.nav-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 998;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .25s;
}
.nav-mobile-overlay.open { opacity: 1; }
.nav-mobile-drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(320px, 85vw);
  height: 100dvh;
  background: var(--bg-2);
  border-left: 1px solid var(--border);
  z-index: 999;
  display: flex;
  flex-direction: column;
  transform: translateX(110%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}
[dir="ltr"] .nav-mobile-drawer { right: 0; border-left: 1px solid var(--border); border-right: none; }
[dir="rtl"] .nav-mobile-drawer { right: auto; left: 0; border-right: 1px solid var(--border); border-left: none; transform: translateX(-110%); }
.nav-mobile-drawer.open { transform: translateX(0); }
.nav-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.nav-drawer-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; }
.nav-drawer-logo img { width: 32px; height: 32px; border-radius: 8px; }
.nav-drawer-close {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary);
  transition: .15s;
}
.nav-drawer-close:hover { background: var(--primary-glow); color: var(--primary); }
.nav-drawer-user {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.nav-drawer-user img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); }
.nav-drawer-user-info .u-name { font-weight: 700; font-size: .95rem; }
.nav-drawer-user-info .u-school { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.nav-drawer-links {
  flex: 1;
  display: flex; flex-direction: column;
  padding: 12px 12px;
  gap: 4px;
}
.nav-drawer-links a, .nav-drawer-links button {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px;
  border-radius: 10px;
  font-size: .95rem; font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: .15s;
  border: none; background: none; cursor: pointer;
  width: 100%; text-align: start;
}
.nav-drawer-links a:hover, .nav-drawer-links button:hover { background: var(--bg-3); color: var(--text-primary); }
.nav-drawer-links a.active { background: var(--primary-glow); color: var(--primary); }
.nav-drawer-links .drawer-divider { height: 1px; background: var(--border); margin: 8px 0; }
.nav-drawer-links .danger { color: #ff4d4d; }
.nav-drawer-links .danger:hover { background: rgba(255,77,77,.1); }
.nav-drawer-actions {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.nav-drawer-actions .btn { flex: 1; justify-content: center; }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-mobile-overlay { display: block; }
  .menu-toggle { display: flex; }
  .nav-links.open { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .section { padding: 50px 0; }
  .section-title { font-size: 1.6rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .footer-brand-desc { max-width: 100%; }
  .footer-bottom { flex-direction: column; gap: 14px; text-align: center; }
}
@media (max-width: 480px) {
  .container { padding: 0 14px; }
  .grid-4 { grid-template-columns: 1fr; }
  .reko-fab { bottom: 20px; right: 18px; }
  [dir="rtl"] .reko-fab { right: auto; left: 18px; }
}

/* ============================================
   Re-Kit — Font Improvements
   ============================================ */

/* Better Arabic font stack with proper weights */
:root {
  --font-ar: 'Cairo', 'Tajawal', 'Noto Kufi Arabic', system-ui, sans-serif;
  --font-en: 'Inter', 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
}

/* Arabic-specific typography tweaks */
body[dir="rtl"] h1, body[dir="rtl"] h2, body[dir="rtl"] h3,
body[dir="rtl"] h4, body[dir="rtl"] h5, body[dir="rtl"] h6 {
  font-weight: 800;
  letter-spacing: 0;
}
body[dir="rtl"] { word-spacing: 0.05em; }
body:not([dir="rtl"]) { letter-spacing: -0.01em; }

/* ============================================
   Re-Kit — CoreX AI Footer
   ============================================ */
.corex-footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 18px 0;
  text-align: center;
}
.corex-footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.corex-powered-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}
.corex-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(87,242,135,0.07), rgba(50,224,161,0.05));
  border: 1px solid rgba(87,242,135,0.18);
  transition: all var(--transition);
}
.corex-link:hover {
  background: linear-gradient(135deg, rgba(87,242,135,0.15), rgba(50,224,161,0.12));
  border-color: rgba(87,242,135,0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(87,242,135,0.15);
}
.corex-logo-img {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  object-fit: cover;
}
.corex-name {
  font-size: 0.85rem;
  font-weight: 700;
  background: linear-gradient(135deg, #57F287, #4fc3f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.corex-footer-divider {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border);
}
.corex-copy {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ============================================
   Re-Kit — AI Code Block Enhanced
   ============================================ */
.code-block-wrap {
  position: relative;
  margin: 10px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(87,242,135,0.2);
}
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(87,242,135,0.06);
  border-bottom: 1px solid rgba(87,242,135,0.12);
}
.code-block-lang {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.code-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(87,242,135,0.1);
  border: 1px solid rgba(87,242,135,0.25);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-en);
}
.code-copy-btn:hover {
  background: rgba(87,242,135,0.2);
  border-color: rgba(87,242,135,0.5);
}
.code-copy-btn.copied {
  background: rgba(87,242,135,0.25);
  color: #fff;
}
.code-block-wrap pre {
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: #0d1117 !important;
  padding: 16px !important;
  overflow-x: auto;
  font-family: var(--font-mono) !important;
  font-size: 0.85rem !important;
  line-height: 1.65 !important;
  color: #e2e8f0 !important;
}
.code-block-wrap pre code {
  background: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  font-family: var(--font-mono) !important;
  font-size: inherit !important;
  color: inherit !important;
}
/* Syntax colors */
.code-block-wrap pre .kw { color: #ff7b72; }   /* keywords */
.code-block-wrap pre .str { color: #a5d6ff; }  /* strings */
.code-block-wrap pre .num { color: #79c0ff; }  /* numbers */
.code-block-wrap pre .cmt { color: #8b949e; font-style: italic; } /* comments */
.code-block-wrap pre .fn { color: #d2a8ff; }   /* functions */

/* ============================================
   Re-Kit — Avatar Crop Modal
   ============================================ */
.crop-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.crop-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 440px;
  width: 100%;
}
.crop-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}
.crop-modal-img-wrap {
  width: 100%;
  max-height: 340px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.crop-modal-img-wrap img {
  max-width: 100%;
  max-height: 340px;
  display: block;
}
.crop-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.crop-preview-ring {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--primary);
  margin: 0 auto 12px;
  background: var(--bg-3);
}
.crop-preview-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.crop-zoom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.crop-zoom-row label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.crop-zoom-row input[type=range] {
  flex: 1;
  accent-color: var(--primary);
}

/* ---- CoreX Ai in footer ---- */
.corex-name { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; letter-spacing: 0.3px; }
.corex-ai-badge {
  color: #4fc3f7;
  font-weight: 800;
  font-size: 1em;
}

/* ============================================
   Re-Kit — Mobile Touch Fixes
   ============================================ */
* { -webkit-tap-highlight-color: transparent; }
button, a, [onclick], .btn, .theme-toggle, .lang-toggle,
.menu-toggle, .nav-avatar, .dropdown-item, .reko-mode-btn,
.welcome-chip, .reko-send-btn, .reko-mic-btn, .reko-clear-btn,
.gallery-nav, .gallery-thumb, .resource-card-save, .reko-clear-topbar-btn,
.admin-nav-item, .filter-toggle, .card, .reko-fab {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
/* Ensure divs with onclick work on iOS */
[onclick] { cursor: pointer; }
/* Make buttons feel instant (no 300ms delay) */
button, a { touch-action: manipulation; }
/* Fix scrollable areas on iOS */
.reko-messages, .reko-sidebar, .admin-content, .main-content,
.marketplace-content, .resource-page, .profile-page {
  -webkit-overflow-scrolling: touch;
}
