/* =========================================================
   ACADEMIC STORE — clean green & white theme
   RTL + Arabic support. All colors are CSS variables.
========================================================= */

:root {
  /* Brand palette — rich green on soft mint-white */
  --bg-0: #ffffff;
  --bg-1: #f0faf4;
  --bg-2: #e8f5ee;
  --bg-3: #d4edda;

  --panel: #ffffff;
  --panel-solid: #ffffff;
  --panel-2: #f0faf4;
  --sidebar: #ffffff;

  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --border-soft: #edf2f7;

  --green-50:  #f0faf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-300: #86efac;
  --green-500: #2d8a4e;
  --green-600: #1a7a3c;
  --green-700: #155c2e;
  --green-800: #14532d;
  --green-900: #0f3d20;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow:    0 4px 14px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 10px 24px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 20px 40px rgba(16, 24, 40, 0.10);
  --glow:        0 10px 28px rgba(26, 122, 60, 0.20);
  --glow-strong: 0 16px 40px rgba(26, 122, 60, 0.30);

  --text: #111827;
  --text-dim: #4b5563;
  --text-muted: #6b7280;

  --green: #1a7a3c;
  --green-soft: #dcfce7;
  --blue: #1877f2;
  --blue-soft: #e7f0fd;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;

  /* Layout */
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --sidebar-w: 260px;
  --navbar-h: 72px;

  /* Fonts */
  --font-ar: 'Tajawal', 'Cairo', 'Noto Sans Arabic', system-ui, sans-serif;
  --font-en: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html, body {
  font-family: var(--font-ar);
  background: var(--bg-1);
  color: var(--text);
  min-height: 100vh;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(900px 520px at 85% -10%, rgba(26, 122, 60, 0.08), transparent 60%),
    radial-gradient(800px 480px at 10% 20%,  rgba(45, 138, 78, 0.06), transparent 60%),
    var(--bg-1);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Preserve English orientation inside Arabic flow */
.ltr, code, .code, .mono {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: var(--font-en);
}

a { color: var(--green-600); text-decoration: none; transition: color .15s; }
a:hover { color: var(--green-700); }

::selection { background: var(--green-600); color: white; }

/* ==================== NAV BAR (public) ==================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--navbar-h);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
  align-items: center;
}
.nav-links a {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 14px;
  transition: color .15s;
}
.nav-links a:hover { color: var(--text); }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}
.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--green-500), var(--green-700));
  display: grid;
  place-items: center;
  box-shadow: var(--glow);
  flex-shrink: 0;
}
.brand-icon svg { width: 22px; height: 22px; color: white; }

/* ==================== BUTTONS ==================== */
.btn {
  background: var(--green-600);
  color: white;
  border: 0;
  padding: 12px 22px;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(26, 122, 60, 0.25);
  transition: transform .15s, box-shadow .15s, background .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
.btn:hover { background: var(--green-700); transform: translateY(-1px); box-shadow: 0 8px 22px rgba(26, 122, 60, 0.35); color: white; }
.btn:active { transform: translateY(0); }
.btn-ghost {
  background: #ffffff;
  border: 1px solid var(--green-600);
  color: var(--green-600);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--green-50); border-color: var(--green-700); color: var(--green-700); }
.btn-danger { background: var(--red); box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25); }
.btn-danger:hover { background: #b91c1c; box-shadow: 0 8px 22px rgba(220, 38, 38, 0.35); }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 16px 28px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* ==================== BADGES ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .2px;
  border: 1px solid transparent;
}
.badge::before {
  content: '●';
  font-size: 9px;
}
.badge-stable    { background: var(--green-soft);  color: #166534; border-color: #bbf7d0; }
.badge-popular   { background: var(--blue-soft);   color: #1d4ed8; border-color: #bfdbfe; }
.badge-cloud     { background: var(--green-soft);  color: #166534; border-color: #bbf7d0; }
.badge-extension { background: var(--amber-soft);  color: #b45309; border-color: #fde68a; }
.badge-warning   { background: var(--amber-soft);  color: #b45309; border-color: #fde68a; }
.badge-update    { background: var(--blue-soft);   color: #1d4ed8; border-color: #bfdbfe; }
.badge-info      { background: var(--green-soft);  color: #166534; border-color: #bbf7d0; }
.badge-soft {
  background: var(--green-50);
  border-color: var(--green-200);
  color: var(--green-700);
}
.badge-soft::before { display: none; }

/* ==================== LANDING ==================== */
.hero {
  padding: 80px 40px 100px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 60px;
  align-items: center;
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
}
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; padding: 48px 20px; gap: 40px; }
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--green-50);
  border: 1px solid var(--green-200);
  border-radius: 999px;
  font-size: 13px;
  color: var(--green-700);
  margin-bottom: 24px;
}
.hero-badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green-600);
  box-shadow: 0 0 10px rgba(26, 122, 60, 0.45);
}
.hero h1 {
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -.01em;
  margin-bottom: 20px;
  color: var(--text);
}
.hero h1 .grad {
  color: var(--green-600);
  background: none;
  -webkit-text-fill-color: currentColor;
}
.hero p.lead {
  font-size: 18px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 36px;
  max-width: 520px;
}

/* Floating tools illustration */
.hero-visual {
  position: relative;
  height: 480px;
}
.float-card {
  position: absolute;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
  animation: float 6s ease-in-out infinite;
}
.float-card img, .float-card .flogo-fb {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: white;
  padding: 4px;
  object-fit: contain;
  flex-shrink: 0;
}
.float-card .flogo-fb {
  background: var(--green-600);
  color: white;
  font-weight: 700;
  font-size: 16px;
  display: grid;
  place-items: center;
  padding: 0;
}
.float-card .fname { font-weight: 600; font-size: 14px; color: var(--text); }
.float-card .fmeta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* ==================== SECTION ==================== */
.section {
  padding: 80px 40px;
  max-width: 1280px;
  margin: 0 auto;
}
@media (max-width: 700px) { .section { padding: 48px 20px; } }
.section-head { text-align: center; margin-bottom: 40px; }
.section-head h2 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--text);
}
.section-head p {
  color: var(--text-dim);
  font-size: 16px;
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.7;
}
.section-head .badge-soft { margin-bottom: 16px; }

/* ==================== TOOL CARD ==================== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.tool-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: transform .2s, border-color .2s, box-shadow .2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  color: var(--text);
  text-decoration: none;
  display: block;
}
.tool-card:hover {
  transform: translateY(-4px);
  border-color: var(--green-300);
  box-shadow: var(--shadow-md);
}
.tool-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.tool-logo, .tool-logo-fb {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: white;
  padding: 6px;
  object-fit: contain;
  flex-shrink: 0;
  border: 1px solid var(--border-soft);
}
.tool-logo-fb {
  background: var(--green-600);
  color: white;
  font-weight: 700;
  font-size: 18px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
}
.tool-name { font-size: 17px; font-weight: 700; color: var(--text); }
.tool-desc {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
  min-height: 42px;
}
.tool-badges { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tool-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.tool-card .btn { width: 100%; }

/* Logos-only grid (landing "Available programs") */
.logos-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 18px;
}
.logo-tile {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 14px;
  text-align: center;
  transition: transform .2s, border-color .2s, box-shadow .2s;
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
  display: block;
  box-shadow: var(--shadow-sm);
}
.logo-tile:hover {
  transform: translateY(-3px);
  border-color: var(--green-300);
  box-shadow: var(--shadow-md);
}
.logo-tile img, .logo-tile .fb {
  width: 50px; height: 50px;
  border-radius: 12px;
  background: white;
  padding: 6px;
  margin: 0 auto 10px;
  object-fit: contain;
  display: block;
  border: 1px solid var(--border-soft);
}
.logo-tile .fb {
  background: var(--green-600);
  color: white;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
}
.logo-tile .lname { font-size: 13px; font-weight: 600; color: var(--text); }

/* ==================== AUTH / FORMS ==================== */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}
.auth-card .brand { margin-bottom: 26px; }
.auth-card h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
}
.auth-card .sub {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 28px;
}

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 600;
}
.form-control {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px 16px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 4px rgba(26, 122, 60, 0.15);
  background: #ffffff;
}
textarea.form-control { min-height: 110px; font-family: var(--font-en); resize: vertical; }

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.6;
}
.alert-error   { background: var(--red-soft);   color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: var(--green-soft); color: #166534; border: 1px solid #bbf7d0; }
.alert-info    { background: var(--green-50);   color: var(--green-700); border: 1px solid var(--green-200); }
.alert-warning { background: var(--amber-soft); color: #92400e; border: 1px solid #fde68a; }

/* ==================== APP LAYOUT (sidebar) ==================== */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #ffffff;
  border-inline-start: 1px solid var(--border);
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}
.sidebar .brand { padding: 8px 12px 18px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.sidebar-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  padding: 16px 14px 6px;
  font-weight: 600;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.sidebar-link:hover { background: var(--green-50); color: var(--green-700); }
.sidebar-link.active {
  background: var(--green-100);
  color: var(--green-700);
  font-weight: 700;
}
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--green-600); }
.sidebar-link:hover svg { color: var(--green-700); }
.sidebar-link.active svg { color: var(--green-700); }
.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-1);
  border: 1px solid var(--green-200);
  margin-bottom: 8px;
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-500), var(--green-700));
  color: white;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.user-chip .meta { line-height: 1.3; min-width: 0; }
.user-chip .meta .n { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.user-chip .meta .e { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Main content */
.app-main {
  padding: 28px 36px 60px;
  min-width: 0;
  background: transparent;
}
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.app-topbar h1 { font-size: 28px; font-weight: 800; color: var(--text); }
.app-topbar .sub { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

/* Mobile sidebar */
.sidebar-toggle { display: none; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset-inline-end: 0;
    top: 0;
    height: 100vh;
    width: 280px;
    transform: translateX(100%);
    transition: transform .25s;
    z-index: 90;
    border-inline-start: 1px solid var(--border);
    box-shadow: -12px 0 32px rgba(16, 24, 40, 0.08);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open::after {
    content: '';
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 85;
  }
  .sidebar-toggle {
    display: inline-flex;
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--green-700);
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
  }
  .app-main { padding: 20px; }
}

/* ==================== PANEL / CARD ==================== */
.panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.panel h2 { font-size: 18px; font-weight: 700; margin-bottom: 14px; color: var(--text); }
.panel .muted { color: var(--text-dim); font-size: 14px; line-height: 1.7; }

.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.kv {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
}
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--text-muted); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.stat .label { color: var(--text-muted); font-size: 13px; }
.stat .value { font-size: 32px; font-weight: 800; margin-top: 6px; color: var(--text); }
.stat .ic {
  position: absolute;
  inset-inline-end: 16px;
  top: 16px;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--green-100);
  color: var(--green-700);
  display: grid; place-items: center;
}
.stat .ic svg { width: 22px; height: 22px; }

/* Search + filters */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.search {
  flex: 1;
  min-width: 220px;
  position: relative;
}
.search input {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 42px 12px 16px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
}
.search input:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 4px rgba(26, 122, 60, 0.15);
}
.search svg {
  position: absolute;
  top: 50%;
  inset-inline-end: 14px;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 18px; height: 18px;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--green-300); color: var(--green-700); }
.chip.active {
  background: var(--green-600);
  border-color: var(--green-600);
  color: white;
  box-shadow: 0 4px 10px rgba(26, 122, 60, 0.25);
}

/* Empty state */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty h3 { color: var(--text); font-size: 18px; margin-bottom: 8px; }

/* Announcement item */
.announce {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--green-600);
  border-radius: 12px;
  background: #ffffff;
  margin-bottom: 12px;
}
.announce:last-child { margin-bottom: 0; }
.announce .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green-600);
  margin-top: 8px;
  flex-shrink: 0;
}
.announce .body { flex: 1; min-width: 0; }
.announce .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.announce .title { font-weight: 700; font-size: 15px; color: var(--text); }
.announce .time { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.announce .content { color: var(--text-dim); font-size: 14px; line-height: 1.7; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--green-200); border-radius: 10px; border: 2px solid var(--bg-1); }
::-webkit-scrollbar-thumb:hover { background: var(--green-300); }
