@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');

:root {
  --bg-color: #f1f5f9;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --border: #e2e8f0;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

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

body {
  font-family: 'Tajawal', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  direction: rtl;
  min-height: 100vh;
  line-height: 1.6;
}

/* Layout for Admin with Sidebar */
.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 32px;
  text-align: center;
}

.sidebar-nav {
  list-style: none;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.nav-item:hover {
  background: var(--bg-color);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
}

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

.header-content h1 {
  font-size: 20px;
  font-weight: 700;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
}

.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 13px;
}

input, select, textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.btn {
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}

.btn-primary { 
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); 
  color: white; 
  box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.39);
}
.btn-primary:hover { 
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.23);
}

.btn-success { 
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%); 
  color: white; 
}
.btn-danger { 
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%); 
  color: white; 
}
.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-outline {
  background: white;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-color);
  border-color: var(--text-muted);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th {
  background: #f8fafc;
  padding: 16px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:hover td {
  background: #fafafa;
}

.badge {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.bg-approved { background: #d1fae5; color: #065f46; }
.bg-pending { background: #fef3c7; color: #92400e; }
.bg-rejected { background: #fee2e2; color: #991b1b; }

.flex-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}

.error-msg {
  background: #fee2e2;
  color: #991b1b;
  padding: 16px;
  border-radius: 10px;
  margin-bottom: 24px;
  display: none;
}

footer {
  background: var(--card-bg);
  padding: 40px 0;
  margin-top: auto;
  border-top: 1px solid var(--border);
}

/* Mobile Bottom Nav */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  height: 64px;
  z-index: 1000;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  flex: 1;
  padding: 8px 0;
  cursor: pointer;
}

.mobile-nav-item .nav-icon {
  font-size: 20px;
}

.mobile-nav-item.active {
  color: var(--accent);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  animation: fadeIn 0.4s ease-out;
}

/* Mobile */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    width: 100vw;
    position: relative;
  }
  .admin-layout {
    display: block;
    width: 100%;
    padding-bottom: 80px; 
    overflow-x: hidden;
  }
  main {
    width: 100%;
    display: block !important;
    overflow-x: hidden;
  }
  .sidebar {
    display: none;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  .grid-2 {
    display: block;
  }
  .grid-2 .card {
    margin-bottom: 16px;
  }
  header {
    padding: 16px 12px;
  }
  .header-content {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  .container {
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
  }
  .card {
    padding: 16px;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
    overflow-x: hidden; /* Card itself shouldn't scroll */
  }
  /* Table container for scrolling */
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 16px;
  }
  table {
    min-width: 600px; /* Force scroll internally for readability */
  }
  h2 {
    font-size: 16px;
  }
  .flex-filters {
    flex-direction: column;
    gap: 12px;
  }
}

