/* public/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-color: #f1f5f9;
  /* Light grey/blue background for the app */
  --card-bg: #ffffff;
  /* Solid white for panels and sidebar */
  --border-color: #e2e8f0;
  /* Subtle light borders */
  --text-primary: #1e293b;
  /* Dark slate for high contrast */
  --text-secondary: #64748b;
  /* Medium slate for secondary info */
  --primary-color: #0D9488;
  /* Naqrh V3 Teal */
  --primary-hover: #0f766e;
  /* Darker Teal for interactions */
  --danger-color: #ef4444;
  --success-color: #10b981;
  --card-radius: 12px;
  --transition: all 0.2s ease-in-out;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Cairo', 'Outfit', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  margin: 0;
  display: flex;
}

/* Auth Page Specific */
.auth-wrapper {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-color);
}

.glass-panel {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 2.5rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  width: 100%;
  max-width: 400px;
}

h1,
h2,
h3,
h4 {
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: 1rem;
}

.brand-text {
  color: var(--primary-color);
  font-weight: 700;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-color);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-danger {
  background: #fee2e2;
  color: var(--danger-color);
  border: 1px solid #fca5a5;
}

.btn-danger:hover {
  background: #fecaca;
}

.btn-success {
  background: #d1fae5;
  color: var(--success-color);
  border: 1px solid #6ee7b7;
}

.btn-success:hover {
  background: #a7f3d0;
}

.btn-info {
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.btn-info:hover {
  background: #bae6fd;
  color: #0369a1;
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

/* Error/Success Messages */
.alert {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
}

.alert-error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.alert-success {
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  color: #065f46;
}

/* Dashboard Layout */
.sidebar {
  width: 280px;
  background: var(--card-bg);
  border-right: 1px solid var(--border-color);
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

.sidebar-logo {
  font-size: 1.5rem;
  margin-bottom: 2.5rem;
  text-align: center;
  letter-spacing: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  transition: var(--transition);
}

.nav-item i {
  margin-right: 1rem;
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.nav-item:hover {
  background: #f8fafc;
  color: var(--primary-color);
}

.nav-item.active {
  background: var(--primary-color);
  color: #ffffff;
}

.sidebar-footer {
  margin-top: auto;
}

.sidebar-footer .nav-item {
  background: #f8fafc;
  border: 1px solid var(--border-color);
}

.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 2.5rem;
  max-width: 1400px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--card-radius);
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 1.25rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #f8fafc;
}

td {
  vertical-align: middle;
  color: var(--text-primary);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: #f8fafc;
}

.badge {
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-active {
  background: #d1fae5;
  color: #065f46;
}

.badge-inactive {
  background: #fee2e2;
  color: #991b1b;
}

.actions {
  display: flex;
  gap: 0.5rem;
}

/* Modals & Forms inside dashboard */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.code-block {
  background: #1e293b;
  padding: 1rem;
  border-radius: 8px;
  font-family: monospace;
  color: #e2e8f0;
  border: 1px solid var(--border-color);
  margin-top: 0.5rem;
}

/* Layout utilities */
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mt-1 {
  margin-top: 0.25rem;
}

.mt-3 {
  margin-top: 1rem;
}

.mt-4 {
  margin-top: 1.5rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.text-sm {
  font-size: 0.875rem;
}

.text-muted {
  color: var(--text-secondary) !important;
}

/* Dashboard Specific Metric Cards Overrides */
.card h3:first-child[style*="font-size: 3rem"] {
  color: var(--primary-color) !important;
}

/* RTL (Arabic) Support Updates */
[dir="rtl"] body {
  font-family: 'Cairo', sans-serif;
}

[dir="rtl"] .sidebar {
  border-right: none;
  border-left: 1px solid var(--border-color);
  right: 0;
  left: auto;
  top: 0;
}

.sidebar {
  left: 0;
  top: 0;
}

[dir="rtl"] .main-content {
  margin-left: 0;
  margin-right: 280px;
}

[dir="rtl"] .nav-item i,
[dir="rtl"] .btn i {
  margin-right: 0;
  margin-left: 1rem;
}

[dir="rtl"] th,
[dir="rtl"] td {
  text-align: right;
}

[dir="rtl"] .alert i {
  margin-right: 0;
  margin-left: 0.5rem;
}

[dir="rtl"] .user-info i {
  margin-right: 0;
  margin-left: 0.5rem;
}

/* =========================================
   Responsive Design & Mobile Support
   ========================================= */

/* Mobile Toggle Base (Hidden on Desktop) */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: var(--transition);
}

.mobile-toggle:hover {
  background: var(--border-color);
}

/* Sidebar Overlay Base */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  z-index: 9;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Media Queries for Mobile/Tablets (< 992px) */
@media (max-width: 992px) {

  .mobile-toggle {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }

  [dir="rtl"] .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0 !important;
    padding: 1.5rem 1rem;
    width: 100%;
  }

  [dir="rtl"] .main-content {
    margin-right: 0 !important;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 1.5rem;
  }

  /* Tables horizontally scrollable */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}