/* =========================
   المتغيرات العامة
   ========================= */
:root {
  --primary-color: #6366f1;                /* لون الهوية الجديد (بنفسجي أزرق) */
  --primary-soft: rgba(99, 102, 241, 0.12);
  --text-color: #111827;
  --background-color: #f4f4f9;
  --header-bg: #ffffff;
  --border-color: #ddd;
  --radius-lg: 16px;
  --radius-md: 10px;
}

/* إعادة تعيين بسيطة */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  padding-top: 60px;    /* مساحة للهيدر */
  padding-bottom: 16px; /* لم نعد نستخدم شريط سفلي */
}

/* =========================
   الهيدر العلوي
   ========================= */
.main-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  height: 60px;
  background-color: var(--header-bg);
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
  z-index: 1000;
}

/* جزء اليسار (أو اليمين في RTL): أيقونة + عنوان */
.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.header-icon {
  font-size: 1.3rem;
  color: var(--text-color);
  text-decoration: none;
}

/* زر "إضافة" القديم — ما زال موجود لو استُخدم في صفحات أخرى */
.header-add {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--primary-color);
  color: #fff;
  font-size: 0.8rem;
  text-decoration: none;
  font-weight: 600;
  border: none;
}
.header-add:hover {
  background: #4f46e5;
}

/* =========================
   زر تبديل اللغة الاحترافي في الهيدر
   ========================= */
.lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: radial-gradient(circle at 0 0, #eef2ff, #e0e7ff);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  padding: 0;
  outline: none;
  transition:
    background 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.1s ease;
}

/* النص داخل الزر (AR أو EN) */
.lang-switch::before {
  content: "AR";
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #111827;
  z-index: 2;
}

/* الدائرة المتحركة (Thumb) */
.lang-switch::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
  transform: translateX(-9px); /* وضع العربية */
  transition: transform 0.22s ease-out;
  z-index: 1;
}

/* وضع اللغة الإنجليزية */
.lang-switch.is-en {
  background: radial-gradient(circle at 100% 0, #e0f2fe, #dbeafe);
}

.lang-switch.is-en::before {
  content: "EN";
}

/* تحريك الدائرة إلى الجهة الأخرى */
.lang-switch.is-en::after {
  transform: translateX(9px);
}

/* تأثير الهوفر والضغط */
.lang-switch:hover {
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.16);
}

.lang-switch:active {
  transform: translateY(1px) scale(0.98);
}

/* إظهار إطار خفيف عند التركيز بالكيبورد */
.lang-switch:focus-visible {
  box-shadow:
    0 0 0 1px #ffffff,
    0 0 0 3px rgba(99, 102, 241, 0.6);
}

/* =========================
   القائمة الجانبية (للشاشات الصغيرة)
   ========================= */
.sidebar {
  position: fixed;
  top: 0;
  right: -260px; /* مخفية خارج الشاشة */
  width: 240px;
  height: 100%;
  background-color: #fff;
  box-shadow: -2px 0 8px rgba(0,0,0,0.15);
  z-index: 2000;
  transition: right 0.3s ease-in-out;
  display: flex;
  flex-direction: column;
}

.sidebar.active {
  right: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
  font-size: 1rem;
  font-weight: bold;
}

.sidebar-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
}

.sidebar-nav {
  flex-grow: 1;
  padding-top: 10px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.95rem;
}

/* المسافة بين الأيقونة والنص حسب الاتجاه */
html[dir="rtl"] .sidebar-link .sidebar-icon {
  margin-left: 10px;
  margin-right: 0;
}

html[dir="ltr"] .sidebar-link .sidebar-icon {
  margin-right: 10px;
  margin-left: 0;
}

.sidebar-link:hover,
.sidebar-link.active {
  background-color: #f3f4ff;
  color: var(--primary-color);
}

/* =========================
   شريط التنقل العلوي (للشاشات الكبيرة)
   ========================= */
.top-nav {
  display: none; /* افتراضيًا مخفي في الجوال */
  gap: 6px;
}

.top-nav-link {
  text-decoration: none;
  font-size: 0.85rem;
  color: var(--text-color);
  padding: 4px 10px;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}

.top-nav-link:hover {
  background: var(--primary-soft);
  color: var(--primary-color);
}

.top-nav-link.active {
  background: var(--primary-soft);
  color: var(--primary-color);
}

/* =========================
   المحتوى الرئيسي
   ========================= */
.main-content {
  padding: 16px;
}

.page-title {
  font-size: 1.1rem;
  margin: 0 0 8px;
}

.page-intro {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: #4b5563;
}

/* كرت (ويدجت) */
.card-widget {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 14px 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.card-widget h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

/* =========================
   أزرار وحقول إدخال
   ========================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--primary-color);
  color: #fff;
  transition: background 0.2s, transform 0.1s;
}

/* أيقونة الزر: RTL / LTR */
html[dir="rtl"] .btn .btn-icon {
  margin-left: 6px;
  margin-right: 0;
}

html[dir="ltr"] .btn .btn-icon {
  margin-right: 6px;
  margin-left: 0;
}

.btn:hover {
  background: #4f46e5;
}

.btn:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn-secondary:hover {
  background: #d1d5db;
}

.input-group {
  margin-bottom: 10px;
}

.input-group label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 3px;
  color: #4b5563;
}

.input-group input,
.input-group select,
.input-group textarea {
  width: 100%;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 0.87rem;
  outline: none;
  background: #fff;
}

.input-group textarea {
  min-height: 70px;
  resize: vertical;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 1px var(--primary-soft);
}

/* ملاحظات صغيرة */
.small-note,
.form-message,
.idea-session-info {
  font-size: 0.75rem;
  color: #6b7280;
}

/* =========================
   مولّد الأفكار (الرئيسية)
   ========================= */
.generator-output {
  margin-top: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  font-size: 0.9rem;
  min-height: 40px;
}

.generator-output.empty {
  color: #9ca3af;
}

.idea-session-info {
  margin-top: 8px;
}

/* =========================
   جدول الأفكار (صفحة الأفكار)
   ========================= */
.ideas-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 6px;
}

.ideas-table th,
.ideas-table td {
  border: 1px solid var(--border-color);
  padding: 6px 8px;
  text-align: right;
}

/* في وضع الإنجليزية نخليها لليسار */
html[dir="ltr"] .ideas-table th,
html[dir="ltr"] .ideas-table td {
  text-align: left;
}

.ideas-table th {
  background: #e5e7ff;
  font-weight: 600;
}

.no-ideas {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 6px;
}

/* =========================
   فريق العمل
   ========================= */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.team-card {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 10px;
  text-align: center;
  font-size: 0.85rem;
}

.team-icon {
  font-size: 1.6rem;
  color: var(--primary-color);
  margin-bottom: 6px;
}

.team-name {
  font-weight: 600;
  margin-bottom: 3px;
}

.team-role {
  color: #6b7280;
  margin-bottom: 3px;
}

/* =========================
   استجابة (Responsive)
   ========================= */
@media (min-width: 768px) {
  .main-content {
    max-width: 700px;
    margin: 0 auto;
  }

  /* في الشاشات الكبيرة: نخفي القائمة الجانبية و زرها
     ونُظهر شريط تنقل علوي داخل الهيدر */
  .sidebar {
    display: none;
  }

  .menu-trigger {
    display: none;
  }

  .top-nav {
    display: flex;
    align-items: center;
  }
}