/* نظام إدارة طلبات شركة السمو - تحسينات تصميمية */
:root {
  --primary: #FFA500;
  --primary-light: #FBBF24;
  --primary-dark: #e59400;
  --primary-soft: rgba(255, 165, 0, 0.12);
  --white: #FFFFFF;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-800: #1F2937;
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);
  --warning-soft: rgba(245, 158, 11, 0.12);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-primary: 0 4px 14px rgba(255, 165, 0, 0.25);
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
  scroll-behavior: smooth;
}
@media (max-width: 767.98px) {
  html {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  body {
    overscroll-behavior-y: contain;
  }
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin-bottom: 60px;
  font-family: 'Tajawal', sans-serif;
  color: var(--gray-800);
  background-color: var(--gray-100);
}
@media (max-width: 767.98px) {
  body {
    margin-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  body.has-bottom-nav {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }
}

/* Typography */
h1, .h1 { letter-spacing: -0.02em; font-weight: 800; }
h2, .h2, .card h2 { font-weight: 700; color: var(--gray-800); border-inline-start: 4px solid var(--primary); padding-inline-start: 0.75rem; }
.page-title { font-weight: 700; color: var(--gray-800); margin-bottom: 1.25rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--gray-200); }

/* Primary buttons and accents */
.btn-primary, .btn-warning {
  background-color: var(--primary);
  border-color: var(--primary);
  color: var(--white);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.btn-primary:hover, .btn-warning:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-light);
  color: var(--white);
  transform: translateY(-1px);
}
.btn-primary:active, .btn-warning:active, .btn-outline-primary:active {
  transform: translateY(0);
}
.btn-outline-primary {
  border-color: var(--primary);
  color: var(--primary);
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.btn-outline-primary:hover {
  background-color: var(--primary);
  border-color: var(--primary);
  color: var(--white);
  transform: translateY(-1px);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(255, 165, 0, 0.25);
}

/* Navbar */
.navbar-brand, .nav-link {
  color: var(--gray-800) !important;
}
.navbar {
  background-color: var(--white) !important;
  border-bottom: 1px solid var(--gray-200);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.navbar-brand {
  gap: 0.5rem;
}
.navbar-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
  margin-inline-end: 4px;
}
.nav-link {
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
}
.nav-link:hover {
  color: var(--primary) !important;
}
.nav-link.active {
  color: var(--primary) !important;
  font-weight: 700;
  position: relative;
}
.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0.75rem;
  left: 0.75rem;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

/* Section headers (استمارة style) */
.section-header {
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  padding: 0.6rem 1rem;
  margin: 1.25rem 0 0.75rem 0;
  font-weight: 700;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 6px rgba(255, 165, 0, 0.2);
}

/* Cards and forms */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm), 0 1px 2px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--gray-200);
  padding: 1.5rem;
  transition: box-shadow 0.2s ease;
}
.card:hover {
  box-shadow: var(--shadow-md), 0 2px 4px rgba(0, 0, 0, 0.05);
}
.card .card-title,
.card h2 {
  margin-bottom: 1rem;
}
.form-label {
  color: var(--gray-800);
  font-weight: 500;
}
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--gray-200);
}
.form-control:focus {
  border-color: var(--primary-light);
}
.form-control::placeholder {
  color: #9ca3af;
}

/* Alerts */
.alert {
  border-radius: var(--radius-sm);
  border-width: 1px;
  box-shadow: var(--shadow-sm);
}
.alert-success {
  background-color: #dcfce7;
  color: #166534;
  border-color: var(--success);
}
.alert-danger {
  background-color: #fee2e2;
  color: #991b1b;
  border-color: var(--danger);
}
.alert-warning {
  background-color: #fef3c7;
  color: #92400e;
  border-color: #f59e0b;
  border-radius: var(--radius-sm);
}

/* Floating action (optional) */
.fab {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 1000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  border: none;
  box-shadow: 0 4px 12px rgba(255,165,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1.5rem;
}
.fab:hover {
  background: var(--primary-light);
  color: var(--white);
}

/* Home page hero */
.home-hero {
  padding: 2.5rem 1.5rem 3rem;
  background: linear-gradient(165deg, rgba(255, 165, 0, 0.07) 0%, rgba(251, 191, 36, 0.03) 40%, transparent 70%);
  border-radius: var(--radius-lg);
  margin: 0 -0.25rem;
  border: 1px solid rgba(255, 165, 0, 0.12);
  box-shadow: 0 4px 20px rgba(255, 165, 0, 0.06);
  animation: fadeIn 0.5s ease-out;
}
.home-hero .display-5 {
  color: var(--gray-800);
  text-shadow: 0 1px 0 rgba(255,255,255,0.8);
}
.home-logo-wrap {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-logo {
  max-width: 240px;
  max-height: 140px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.home-logo-fallback {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border: 2px solid #86efac;
  box-shadow: 0 4px 14px rgba(255, 165, 0, 0.25);
}
.home-tagline {
  font-size: 1.05rem;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}
.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: center;
  margin-top: 2.5rem;
}
.hero-btn {
  min-width: 240px;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hero-btn-card {
  padding: 1.25rem 1.5rem;
  min-width: 260px;
}
.hero-icon {
  font-size: 1.5rem;
  opacity: 0.95;
}
.hero-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.hero-btn.btn-outline-primary {
  border: 2px solid var(--primary);
  background: transparent;
}
.hero-btn.btn-outline-primary:hover {
  border-color: var(--primary-light);
}
.hero-btn .bi {
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 576px) {
  .hero-buttons {
    flex-direction: column;
  }
  .hero-btn {
    width: 100%;
  }
}

/* Mobile navbar: تسجيل الخروج أوضح وعرض أفضل للجوال */
@media (max-width: 575.98px) {
  .navbar-user-section {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
  }
  .navbar-user-section .user-email {
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }
  .navbar-logout-form {
    width: 100%;
  }
  .navbar-logout-btn {
    width: 100%;
    text-align: center;
    padding: 0.5rem 1rem;
  }
}

/* Tables */
.table-responsive {
  border-radius: var(--radius-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}
.table {
  margin-bottom: 0;
}
.table thead th {
  background: linear-gradient(180deg, var(--gray-200) 0%, #d1d5db 100%);
  color: var(--gray-800);
  font-weight: 700;
  border-bottom: 2px solid var(--gray-200);
  padding: 0.75rem 1rem;
}
.table tbody tr {
  transition: background-color 0.15s ease;
}
.table tbody tr:hover {
  background-color: rgba(255, 165, 0, 0.06);
}
.table tbody td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
}
.table-items th {
  background: linear-gradient(180deg, var(--gray-200) 0%, #d1d5db 100%);
  color: var(--gray-800);
  font-weight: 700;
  padding: 0.6rem 0.5rem;
}

/* Footer */
.footer {
  background: linear-gradient(180deg, var(--white) 0%, var(--gray-100) 100%);
  color: var(--gray-800);
  border-top: 1px solid var(--gray-200);
  padding: 1.25rem 0;
  margin-top: 2rem;
  font-size: 0.9rem;
}
.footer .container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

/* List cards (بديل للجداول) - تصميم محسّن */
.list-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, var(--white) 0%, var(--primary-soft) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 165, 0, 0.2);
  box-shadow: var(--shadow-sm);
}
.list-header h2 {
  border: none;
  padding: 0;
  background: linear-gradient(135deg, var(--gray-800) 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
}
.btn-back {
  flex-shrink: 0;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}
.btn-back:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
}
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: linear-gradient(180deg, var(--white) 0%, var(--primary-soft) 50%);
  border-radius: var(--radius-xl);
  border: 2px dashed rgba(255, 165, 0, 0.3);
  box-shadow: 0 4px 20px rgba(255, 165, 0, 0.08);
}
.empty-icon {
  font-size: 3.5rem;
  color: var(--primary);
  opacity: 0.5;
  margin-bottom: 1rem;
  display: block;
}
.card-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.card-list .list-card {
  animation: cardSlideIn 0.4s ease-out backwards;
}
.card-list .list-card:nth-child(1) { animation-delay: 0.05s; }
.card-list .list-card:nth-child(2) { animation-delay: 0.1s; }
.card-list .list-card:nth-child(3) { animation-delay: 0.15s; }
.card-list .list-card:nth-child(4) { animation-delay: 0.2s; }
.card-list .list-card:nth-child(5) { animation-delay: 0.25s; }
.card-list .list-card:nth-child(n+6) { animation-delay: 0.3s; }
.list-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all 0.25s ease;
  position: relative;
}
.list-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  background: var(--gray-200);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  transition: background 0.25s ease;
}
.list-card.status-approved::before { background: linear-gradient(180deg, var(--success) 0%, #16a34a 100%); }
.list-card.status-pending::before { background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%); }
.list-card.status-rejected::before { background: linear-gradient(180deg, var(--danger) 0%, #dc2626 100%); }
.list-card.status-info::before { background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%); }
.list-card.status-secondary::before { background: linear-gradient(180deg, #6b7280 0%, #4b5563 100%); }
.list-card:hover {
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(255, 165, 0, 0.15);
  transform: translateY(-2px);
}
.list-card-body {
  padding: 1.35rem 1.5rem;
}
.list-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.list-card-title {
  font-weight: 700;
  color: var(--gray-800);
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.list-card .badge {
  font-weight: 600;
  padding: 0.4em 0.75em;
  border-radius: 50px;
  font-size: 0.75rem;
  text-transform: none;
}
.list-card .badge.bg-success { background: linear-gradient(135deg, var(--success) 0%, #16a34a 100%) !important; box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3); }
.list-card .badge.bg-warning { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important; color: var(--white) !important; box-shadow: 0 2px 6px rgba(255, 165, 0, 0.3); }
.list-card .badge.bg-danger { background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%) !important; box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3); }
.list-card .badge.bg-info { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important; box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3); }
.list-card .badge.bg-secondary { background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%) !important; box-shadow: 0 2px 6px rgba(107, 114, 128, 0.3); }
.list-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  color: var(--gray-800);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  opacity: 0.9;
}
.list-card-meta span {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  background: var(--gray-100);
  border-radius: 50px;
  font-weight: 500;
}
.list-card-meta span i {
  color: var(--primary);
  opacity: 0.9;
}
.list-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--gray-200);
}
.list-card-actions .btn-primary {
  box-shadow: 0 2px 8px rgba(255, 165, 0, 0.35);
}
.list-card-actions .btn-primary:hover {
  box-shadow: 0 4px 12px rgba(255, 165, 0, 0.45);
}
.list-card-actions .btn-success {
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cardSlideIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.main-content-enter {
  animation: fadeIn 0.35s ease-out;
}

/* Bottom navigation - mobile app-like */
.bottom-nav {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  z-index: 1030;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(60px + env(safe-area-inset-bottom));
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.25rem;
  color: var(--gray-800);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item i {
  font-size: 1.25rem;
  margin-bottom: 0.2rem;
  display: block;
}
.bottom-nav-item.active {
  color: var(--primary);
  font-weight: 700;
  position: relative;
}
.bottom-nav-item.active::after {
  content: "";
  position: absolute;
  top: 0;
  right: 50%;
  transform: translateX(50%);
  width: 28px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 0 0 3px 3px;
}
.bottom-nav-item.active i {
  color: var(--primary);
}
.bottom-nav-logout {
  padding: 0;
  margin: 0;
  border: none;
  background: none;
}
.bottom-nav-btn {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.25rem;
  color: var(--gray-800);
  font-size: 0.7rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-btn i {
  font-size: 1.25rem;
  margin-bottom: 0.2rem;
  display: block;
}
.bottom-nav-logout .bottom-nav-btn:hover {
  color: var(--danger);
}

/* Mobile app-like: simplified header on small screens */
@media (max-width: 767.98px) {
  .navbar .navbar-collapse {
    max-height: 70vh;
    overflow-y: auto;
  }
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  main {
    padding-bottom: 1rem;
  }
}

/* App-like: full width content on mobile */
@media (max-width: 767.98px) {
  .container {
    max-width: 100%;
  }
  .list-card-actions .btn {
    flex: 1;
    min-width: fit-content;
  }
}
@media (min-width: 768px) {
  .w-md-auto { width: auto !important; }
}
.account-status-msg p { line-height: 1.6; }
