/* style.css - النسخة النهائية المضبوطة بدون تكرار */

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

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
  transition: background 0.4s, color 0.4s;
  direction: rtl;
  text-align: right;
}

body.dark {
  background: #0f172a;
  color: #e2e8f0;
}

/* Header */
.main-header {
  background: #0ea5e9;
  color: white;
  padding: 1rem 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-title h1 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
}

.site-title a {
  text-decoration: none;       /* إزالة الخط تحت */
  color: inherit;              /* يأخذ لون النص الأصلي */
  display: block;              /* يجعل المنطقة كلها قابلة للضغط */
}

.site-title a:hover {
  text-decoration: underline;  /* خط تحت عند التمرير */
           /* لون مختلف عند الـ hover، غيّره حسب تصميمك */
}



/* Navigation */
.header-nav {
  flex: 1;
}

.nav-items {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  color: white;
  text-decoration: none;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  transition: background 0.2s;
}

.nav-link:hover {
  background: rgba(255,255,255,0.18);
}

.country-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255,255,255,0.22);
  padding: 0.5rem 1rem;
  border-radius: 50px;
}

.location-icon {
  font-size: 1.2rem;
}

#country-select {
  background: transparent;
  border: none;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  min-width: 140px;
}

#country-select option {
  background: #0ea5e9;
  color: white;
}

.theme-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 0.6rem 1.1rem;
  border-radius: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.admin-btn {
  background: #10b981;
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Main Content */
.container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.today-card {
  background: white;
  border-radius: 1rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

body.dark .today-card {
  background: #1e293b;
}

.date-hijri {
  font-size: 3.2rem;
  font-weight: bold;
  margin: 1.5rem 0 0.8rem;
  color: #0ea5e9;
}

.date-greg {
  font-size: 1.4rem;
  color: #64748b;
}

body.dark .date-greg {
  color: #94a3b8;
}

.error {
  color: #ef4444;
  font-size: 1.2rem;
}

.about-section {
  background: white;
  margin-top: 2rem;
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

body.dark .about-section {
  background: #1e293b;
}

/* Footer */
footer {
  background: #0f172a;
  color: white;
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 3rem;
}

.footer-links a {
  color: #94a3b8;
  margin: 0 10px;
  text-decoration: none;
}

.footer-links a:hover {
  color: white;
}

.social-icons a {
  color: white;
  font-size: 1.6rem;
  margin: 0 12px;
}

/* Responsive - للهاتف */
@media (max-width: 992px) {
  .header-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .site-title h1 {
    margin-bottom: 1rem;
  }

  .nav-items {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    width: 100%;
  }

  .country-item {
    width: 100%;
    justify-content: center;
  }

  #country-select {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 600px) {
  .date-hijri {
    font-size: 2.4rem;
  }
}





/* ----- تحسين الجدول الشهري ----- */

.monthly-calendar {
  overflow-x: auto;           /* تمرير أفقي إذا كان الجدول أعرض من الشاشة */
  -webkit-overflow-scrolling: touch; /* تمرير سلس على iOS */
}

.monthly-calendar table {
  width: 100%;
  min-width: 480px;           /* الحد الأدنى لمنع الضغط الشديد */
  border-collapse: collapse;
  table-layout: fixed;        /* توزيع متساوي للأعمدة */
}

.monthly-calendar th,
.monthly-calendar td {
  padding: 0.8rem 0.4rem;
  font-size: 1rem;
  text-align: center;
  vertical-align: middle;
  border: 1px solid #e2e8f0;
  word-wrap: break-word;
}

.monthly-calendar th {
  font-weight: 600;
  background: #0ea5e9;
  color: white;
  padding: 0.9rem 0.3rem;
}

.monthly-calendar td div:first-child {  /* الرقم الهجري الكبير */
  font-size: 1.45rem;
  font-weight: bold;
  margin-bottom: 0.2rem;
}

.monthly-calendar td div:last-child {   /* الرقم الميلادي الصغير */
  font-size: 0.85rem;
  opacity: 0.85;
  color: #475569;
}

/* hover */
.monthly-calendar table td:hover {
  background: #f1f5f9;
  cursor: pointer;
}

/* dark mode */
body.dark .monthly-calendar table td {
  border-color: #334155;
}

body.dark .monthly-calendar table th {
  background: #0284c7;
}

body.dark .monthly-calendar table td:hover {
  background: #334155;
}

body.dark .monthly-calendar td div:last-child {
  color: #94a3b8;
}

/* ────────────────────────────────────────────────
   Responsive - للهاتف والأجهزة الصغيرة
───────────────────────────────────────────────── */
/* تحسين الجدول للهواتف - منع انقسام الأرقام */
.monthly-calendar td div:first-child {
    font-size: 1.45rem;           /* الحجم الأساسي */
    font-weight: bold;
    line-height: 1.1;             /* يقلل المسافة بين السطور إذا انقسم */
    white-space: nowrap;          /* يمنع الانقسام إلى سطرين تماماً */
    display: inline-block;        /* يساعد في التحكم */
    min-width: 1.8em;             /* يضمن مساحة كافية لأرقام مثل 10–31 */
    text-align: center;
}

/* للأرقام الميلادية الصغيرة */
.monthly-calendar td div:last-child {
    font-size: 0.85rem;
    line-height: 1.2;
    white-space: nowrap;
}

/* ────────────────────────────────────────────────
   Responsive - تعديلات للشاشات الصغيرة
───────────────────────────────────────────────── */

@media (max-width: 600px) {
    .monthly-calendar table {
        font-size: 0.92rem;
        min-width: 100%;
    }

    .monthly-calendar th,
    .monthly-calendar td {
        padding: 0.55rem 0.25rem;   /* حشو أصغر */
    }

    .monthly-calendar td div:first-child {
        font-size: 1.28rem;         /* حجم أصغر لكن لا ينقسم */
        min-width: 1.6em;
        line-height: 1.05;
    }

    .monthly-calendar td div:last-child {
        font-size: 0.78rem;
    }
}

@media (max-width: 480px) {
    .monthly-calendar td div:first-child {
        font-size: 1.18rem;         /* أصغر قليلاً */
        min-width: 1.5em;
    }

    .monthly-calendar td div:last-child {
        font-size: 0.72rem;
    }

    .monthly-calendar th {
        font-size: 0.82rem;
        padding: 0.5rem 0.2rem;
    }
}

/* إضافة لمنع أي انقسام غير مرغوب */
.monthly-calendar td {
    overflow: hidden;
    text-overflow: clip;
}