/* styles.css */

/* ------------------------------------
   1. Reset & Base Styles
------------------------------------ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Cairo', sans-serif;
  background: linear-gradient(135deg, #003366, #1E4A72);
  min-height: 100vh;
  direction: rtl;
  color: #2D3748;
}

/* ------------------------------------
   2. Header
------------------------------------ */
.header {
  background: linear-gradient(90deg, #003366, #1E4A72);
  color: #fff;
  padding: 15px 0;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  border-bottom: 3px solid #D4AF37;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 15px;
}
.logo-icon {
  width: 50px; height: 50px;
  background: #D4AF37;
  border-radius: 10px;
  display: flex;
  align-items: center; justify-content: center;
  font-size: 24px;
}
.logo-text h1 {
  font-size: 20px;
  margin-bottom: 3px;
  color: white;
}
.logo-text p {
  font-size: 12px;
  opacity: 0.8;
  color: white;
}

.user-info {
  text-align: left;
  color: white;
  font-size: 14px;
}

/* ------------------------------------
   3. App Layout
------------------------------------ */
.app-container {
  display: flex;
  margin-top: 80px;
  min-height: calc(100vh - 80px);
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: linear-gradient(180deg, #003366, #2D3748);
  color: #fff;
  padding: 20px 0;
  overflow-y: auto;
}
.sidebar h2 {
  font-size: 18px;
  text-align: center;
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  margin-bottom: 20px;
}
.nav-menu {
  list-style: none;
  padding: 0 15px;
}
.nav-item {
  margin-bottom: 8px;
}
.nav-link {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.3s ease;
  font-weight: 500;
}
.nav-link:hover,
.nav-link.active {
  background: linear-gradient(135deg, #D4AF37, #B8941F);
  color: #003366;
  transform: translateX(-5px);
}
.nav-icon {
  margin-left: 12px;
  font-size: 18px;
}

/* Main Content */
.main-content {
  flex: 1;
  background: #F8F9FA;
  padding: 30px;
  overflow-y: auto;
}

/* ------------------------------------
   4. Page Wrapper
------------------------------------ */
.page {
  display: none;
}
.page.active {
  display: block;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Dashboard-wrap for all pages */
.dashboard-wrap {
  background: #fff;
  border-radius: 15px;
  border: 2px solid #D4AF37;
  border-top-width: 6px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

/* Override default page-header inside dashboard-wrap */
.dashboard-wrap .page-header {
  background: transparent;
  padding: 0;
  margin-bottom: 20px;
  box-shadow: none;
  border: none;
  text-align: center;
}
.dashboard-wrap .page-title {
  font-size: 24px;
  color: #003366;
}
.dashboard-wrap .page-subtitle {
  font-size: 14px;
  color: #718096;
}

/* ------------------------------------
   5. Page Header (only for standalone if needed)
------------------------------------ */
.page-header {
  background: #fff;
  padding: 30px;
  border-radius: 15px;
  border-top: 4px solid #D4AF37;
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
  margin-bottom: 30px;
  text-align: center;
}
.page-header .page-title {
  color: #003366;
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 10px;
}
.page-header .page-subtitle {
  color: #718096;
  font-size: 16px;
}

/* ------------------------------------
   6. Stats Grid (Dashboard)
------------------------------------ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}
.stat-card {
  background: #fff;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
  transition: transform 0.3s ease;
  border-top: 4px solid var(--card-color);
}
.stat-card:hover {
  transform: translateY(-5px);
}
.stat-card.blue   { --card-color: #003366; }
.stat-card.green  { --card-color: #007A3D; }
.stat-card.gold   { --card-color: #D4AF37; }
.stat-card.red    { --card-color: #CE1126; }

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.stat-info h3 {
  color: #718096;
  font-size: 14px;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: #003366;
}
.stat-icon {
  width: 60px; height: 60px;
  background: var(--card-color);
  border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff;
}

/* ------------------------------------
   7. Action Cards
------------------------------------ */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}
.action-card {
  background: #fff;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}
.action-card:hover {
  transform: translateY(-5px);
  border-color: #D4AF37;
}
.action-icon {
  width: 80px; height: 80px;
  margin: 0 auto 15px;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  color: #fff;
  background: var(--action-color);
}
.action-card.materials { --action-color: linear-gradient(135deg, #667eea, #764ba2); }
.action-card.human     { --action-color: linear-gradient(135deg, #f093fb, #f5576c); }
.action-card.budget    { --action-color: linear-gradient(135deg, #4facfe, #00f2fe); }
.action-card.quality   { --action-color: linear-gradient(135deg, #43e97b, #38f9d7); }
.action-title {
  font-size: 18px; font-weight: 700; color: #003366;
  margin-bottom: 8px;
}
.action-desc {
  font-size: 14px; color: #718096;
}

/* ------------------------------------
   8. Charts Grid
------------------------------------ */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}
.chart-container {
  background: #fff;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}
.chart-title {
  font-size: 18px;
  font-weight: 600;
  color: #003366;
  text-align: center;
  margin-bottom: 20px;
}
.chart-canvas {
  width: 100% !important;
  height: 300px !important;
}

/* ------------------------------------
   9. Forms & Inputs
------------------------------------ */
.form-container {
  background: #fff;
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
  max-width: 800px;
  margin: 0 auto;
}
.form-title {
  font-size: 24px; color: #003366;
  margin-bottom: 30px; text-align: center;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}
.form-group {
  display: flex; flex-direction: column;
}
.form-label {
  font-weight: 600; color: #003366;
  margin-bottom: 8px;
}
.form-input,
.form-select,
.form-textarea {
  padding: 12px;
  border: 2px solid #E2E8F0;
  border-radius: 10px;
  font-family: 'Cairo', sans-serif;
  transition: border-color 0.3s ease;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #D4AF37;
}
.form-textarea {
  resize: vertical;
  min-height: 100px;
}
.btn {
  padding: 15px 30px;
  border: none;
  border-radius: 10px;
  font-size: 16px; font-weight: 600;
  cursor: pointer; transition: all 0.3s ease;
  font-family: 'Cairo', sans-serif;
}
.btn-primary {
  background: linear-gradient(135deg, #D4AF37, #B8941F);
  color: #003366;
  width: 100%;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(212,175,55,0.3);
}

/* ------------------------------------
 10. Tables
------------------------------------ */
.table-container {
  background: #fff;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
  overflow: hidden;
  margin-bottom: 30px;
}
.table-header {
  background: linear-gradient(135deg, #003366, #1E4A72);
  color: #fff;
  padding: 20px;
  text-align: center;
}
.table-title {
  font-size: 18px; font-weight: 700;
}
.data-table {
  width: 100%; border-collapse: collapse;
}
.data-table th,
.data-table td {
  padding: 15px; text-align: right;
  border-bottom: 1px solid #E2E8F0;
}
.data-table th {
  background: #F8F9FA; color: #003366;
  font-weight: 600;
}
.data-table tr:hover {
  background: #F7FAFC;
}

/* Status Badges */
.status-badge {
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 11px; font-weight: 600;
}
.status-pending   { background: #FEF5E7; color: #744210; }
.status-approved  { background: #F0FFF4; color: #22543D; }
.status-completed { background: #DCFCE7; color: #14532D; }
.status-rejected  { background: #FED7D7; color: #742A2A; }

/* ------------------------------------
 11. File Upload
------------------------------------ */
.file-upload {
  position: relative;
  width: 100%;
}
.file-upload-area {
  border: 2px dashed #E2E8F0;
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  background: #F9FAFB;
  cursor: pointer;
  transition: all 0.3s ease;
}
.file-upload-area:hover {
  border-color: #D4AF37;
  background: #F0FFF4;
}
.file-upload input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* ------------------------------------
 12. Notifications
------------------------------------ */
.notification {
  position: fixed;
  top: 100px; right: 20px; left: 20px;
  max-width: 500px; margin: 0 auto;
  background: #fff; color: #003366;
  border: 3px solid #D4AF37;
  padding: 20px; border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  font-weight: 600; text-align: center;
  font-family: 'Cairo', sans-serif;
  white-space: pre-line;
  animation: slideDown 0.5s ease;
  z-index: 10000;
}
@keyframes slideDown {
  from { transform: translateY(-100px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ------------------------------------
 13. Responsive
------------------------------------ */
@media (max-width: 768px) {
  .app-container { flex-direction: column; }
  .sidebar { width: 100%; order: 2; }
  .main-content { order: 1; padding: 20px; }
  .stats-grid,
  .action-grid,
  .charts-grid { grid-template-columns: 1fr; }
}
/* ======== تحسينات للهواتف (≤768px) ======== */
@media (max-width: 768px) {
  /* 1) اجعل الـ sidebar يختفي (أو يتحول إلى قائمة همبرغر لاحقًا) */
  .sidebar {
    display: none;
  }

  /* 2) اضبط البادينج في الـ main-content ليقلل الهامش الجانبي */
  .main-content {
    padding: 15px;
  }

  /* 3) اجعل dashboard-wrap يمتلئ الشاشة مع مسافات صغيرة */
  .dashboard-wrap {
    margin: 10px 0;
    padding: 20px;
  }

  /* 4) غيّر شبكات الأعمدة لتكون عمودًا واحدًا بالكامل */
  .stats-grid,
  .action-grid,
  .charts-grid {
    grid-template-columns: 1fr !important;
    gap: 15px;
  }

  /* 5) قلِّل البادينج الداخلي للنماذج والجداول */
  .form-container,
  .table-container {
    padding: 15px;
  }

  /* 6) عدِّل حجم الخط في العناوين لتناسب العرض */
  .dashboard-wrap .page-title,
  .page-header .page-title {
    font-size: 20px;
  }
  .dashboard-wrap .page-subtitle,
  .page-header .page-subtitle {
    font-size: 12px;
  }
}


/* زر القائمة للجوال */
.menu-toggle {
  display: none;
  background: linear-gradient(135deg, #D4AF37, #B8941F);
  color: #003366;
  border: none;
  padding: 8px 14px;
  font-size: 20px;
  font-weight: bold;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
  transition: background 0.3s ease;
}
.menu-toggle:hover {
  background: #e0be45;
}
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }
  .sidebar {
    display: none;
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 250px;
    background: #003366;
    color: white;
    z-index: 2000;
    padding: 30px 20px;
    box-shadow: -5px 0 15px rgba(0,0,0,0.3);
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }
  .sidebar.show {
    display: block;
    transform: translateX(0);
  }
}
