@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css');

/* باقي كود التنسيق الخاص بك (Root, Body, Cards) يبدأ من هنا */
:root {
  --main: #2c3e50;
  ...
}
/* =========================
   Root & Reset
========================= */
:root {
  --main: #2c3e50;
  --acc: #27ae60;
  --fb: #1877f2;
  --bg: #f4f7f6;
  --orange: #e67e22;
  --blue: #2980b9;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  font-family: 'Cairo', sans-serif;
}

body {
  background: var(--bg);
  color: #333;
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* =========================
   Layout & Container
========================= */
.container {
  max-width: 1200px;
  margin: auto;
  padding: 20px;
  flex: 1;
}

/* =========================
   Header & Navigation
========================= */
.site-header {
  background: #fff;
  border-bottom: 2px solid #ddd;
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1200px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.logo img {
  height: 55px;
  max-width: 100%;
}

.fb-link {
  background: var(--fb);
  color: #fff;
  padding: 8px 15px;
  border-radius: 5px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.menu-toggle {
  display: none;
  background: var(--main);
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}

.nav-menu {
  display: flex;
  justify-content: center;
  gap: 5px;
  background: var(--main);
  padding: 5px;
  flex-wrap: wrap;
}

.nav-menu a {
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  padding: 10px 14px;
}

.nav-menu a:hover {
  background: var(--acc);
  border-radius: 4px;
}

/* =========================
   Scrap Cards System (The Fix)
========================= */
/* تحويل الجدول إلى Grid لعرض 3 كروت على الكمبيوتر */
.scrap-table {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important; /* 3 أعمدة */
  gap: 20px;
  width: 100%;
  margin: 20px 0;
  border: none !important;
}

/* إخفاء الهيدر لأنه نظام كروت */
.scrap-table thead { display: none !important; }
.scrap-table tbody { display: contents !important; }

/* تحويل كل صف (tr) إلى كارت */
.scrap-table tr {
  display: flex !important;
  flex-direction: column !important;
  background: #fff;
  border: 1px solid #eee !important;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  align-items: center;
  text-align: center;
}

.scrap-table td {
  display: block !important;
  width: 100% !important;
  border: none !important;
  padding: 5px 0 !important;
}

/* =========================
   Price Grid (The 3 Cards)
========================= */
.price-grid {
  display: flex;
  gap: 8px;
  justify-content: center;
  width: 100%;
  margin-top: 10px;
}

.price-card {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fdfdfd;
  display: flex;
  flex-direction: column;
}

.price-card .label { font-size: 10px; color: #888; margin-bottom: 3px; }
.price-card .val { font-weight: bold; font-size: 13px; }

.usd-card { border-top: 3px solid var(--acc); }
.egp-card { border-top: 3px solid var(--orange); }
.kwd-card { border-top: 3px solid var(--blue); }

/* =========================
   Responsive Adjustments
========================= */

/* التابلت: كارتين بجانب بعض */
@media screen and (max-width: 1024px) {
  .scrap-table {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* الموبايل: كارت واحد عريض */
@media screen and (max-width: 650px) {
  .scrap-table {
    grid-template-columns: 1fr !important;
  }
  .menu-toggle { display: block; }
  .nav-menu {
    display: none;
    flex-direction: column;
    width: 100%;
    position: fixed;
    top: 70px; left: 0; z-index: 9999;
    background: var(--main); padding: 10px 0;
  }
  .nav-menu.active { display: flex; }
}

/* =========================
   Footer & Modals
========================= */
.site-footer {
  background: var(--main);
  color: #fff;
  text-align: center;
  padding: 40px 20px;
  margin-top: auto;
  border-top: 4px solid var(--acc);
}

.modal {
  display: none; position: fixed; z-index: 10001;
  left: 0; top: 0; width: 100%; height: 100%;
  background-color: rgba(0,0,0,0.9);
}
.modal-content {
  margin: auto; display: block; width: 90%; max-width: 500px;
  position: relative; top: 50%; transform: translateY(-50%); border-radius: 10px;
}
.close { position: absolute; top: 20px; right: 35px; color: #fff; font-size: 40px; cursor: pointer; }
/* =========================
   Root & Variables
========================= */
:root {
  --main: #2c3e50;
  --acc: #27ae60;
  --fb: #1877f2;
  --bg: #f4f7f6;
  --orange: #e67e22;
  --blue: #2980b9;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: #333;
  font-family: 'Cairo', sans-serif;
  line-height: 1.6;
  direction: rtl;
}

.container {
  max-width: 1200px;
  margin: auto;
  padding: 20px;
}

/* =========================
   Header & Nav
========================= */
.site-header {
  background: #fff;
  border-bottom: 2px solid #ddd;
  padding: 10px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.nav-menu {
  display: flex;
  background: var(--main);
  justify-content: center;
  gap: 5px;
  padding: 10px;
}

.nav-menu a {
  color: #fff;
  text-decoration: none;
  padding: 8px 15px;
  font-size: 14px;
}

.nav-menu a:hover {
  background: var(--acc);
  border-radius: 5px;
}

/* =========================
   Grid System (3 Columns on Desktop)
========================= */
/* هذا الكلاس يستخدم في صفحة all-prices وصفحات الجداول المحولة */
.main-grid, .scrap-table {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important; /* 3 كروت للكمبيوتر */
  gap: 20px;
  margin: 20px 0;
}

/* =========================
   Card Styles
========================= */
.cat-card, .scrap-card, .scrap-table tr {
  background: #fff;
  border-radius: 15px;
  padding: 25px;
  text-align: center;
  text-decoration: none;
  color: var(--main);
  border: 1px solid #eee;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  transition: 0.3s;
  display: flex !important;
  flex-direction: column;
  align-items: center;
}

.cat-card:hover, .scrap-card:hover {
  transform: translateY(-5px);
  border-color: var(--acc);
}

.zoom-img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 15px;
}

.item-name {
  font-size: 1.2rem;
  font-weight: bold;
  margin: 10px 0;
}

/* =========================
   Price Grid inside Cards
========================= */
.price-grid {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 15px;
}

.price-card {
  flex: 1;
  padding: 10px 5px;
  border-radius: 8px;
  background: #fdfdfd;
  border: 1px solid #eee;
}

.price-card .label { font-size: 10px; color: #888; display: block; }
.price-card .val { font-weight: bold; font-size: 13px; color: #333; }

.usd-card { border-top: 3px solid var(--acc); }
.egp-card { border-top: 3px solid var(--orange); }
.kwd-card { border-top: 3px solid var(--blue); }

/* =========================
   Responsive Design
========================= */

/* التابلت: كارتين بجانب بعض */
@media (max-width: 1024px) {
  .main-grid, .scrap-table {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* الموبايل: كارت واحد */
@media (max-width: 700px) {
  .main-grid, .scrap-table {
    grid-template-columns: 1fr !important;
  }
  
  .menu-toggle { display: block; }
  
  .nav-menu {
    display: none; /* يتم التحكم فيه عبر JS بإضافة class active */
    flex-direction: column;
    position: absolute;
    top: 60px;
    width: 100%;
    right: 0;
  }
  
  .nav-menu.active { display: flex; }
}

/* =========================
   Footer
========================= */
.site-footer {
  background: var(--main);
  color: #fff;
  padding: 40px 20px;
  text-align: center;
  border-top: 5px solid var(--acc);
}