/* 
  Yummy Food Delivery - App Modern Design System
  Maintained by Antigravity (Google DeepMind)
*/

:root {
  /* Colors - Modern Vibrance */
  --primary: #f77f00;
  --primary-hover: #e67500;
  --primary-soft: rgba(247, 127, 0, 0.1);
  --secondary: #1a1a2e;
  --success: #2ecc71;
  --danger: #e74c3c;
  --warning: #f1c40f;
  --info: #3498db;

  /* Neutrals */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #1a1a2e;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  --border-color: #e2e8f0;

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 70px;
  --header-height: 70px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables */
[data-theme="dark"] {
  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --bg-sidebar: #0f172a;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
}

/* General Styles */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: 'Tajawal', 'Inter', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  transition: var(--transition);
}

/* Layout System */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  position: relative;
}

/* Sidebar Styling */
.app-sidebar {
  width: var(--sidebar-width) !important;
  background-color: var(--bg-sidebar) !important;
  color: #fff !important;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
  height: 100vh !important;
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  z-index: 2000 !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: 4px 0 15px rgba(0,0,0,0.1) !important;
}

[dir="rtl"] .app-sidebar {
  left: auto !important;
  right: 0 !important;
  box-shadow: -4px 0 15px rgba(0,0,0,0.1) !important;
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-brand {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none !important;
}

.sidebar-brand span {
  color: #fff;
}

.sidebar-nav {
  padding: 20px 0;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  list-style: none;
  margin-bottom: 4px;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: rgba(255,255,255,0.7);
  text-decoration: none !important;
  transition: var(--transition);
  border-left: 4px solid transparent;
}

[dir="rtl"] .nav-link-custom {
  border-left: none;
  border-right: 4px solid transparent;
}

.nav-link-custom:hover, .nav-link-custom.active {
  background: rgba(255,255,255,0.05);
  color: var(--primary);
  border-left-color: var(--primary);
}

[dir="rtl"] .nav-link-custom:hover, [dir="rtl"] .nav-link-custom.active {
  border-right-color: var(--primary);
}

.nav-link-custom i {
  font-size: 1.25rem;
}

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

[dir="rtl"] .app-main {
  margin-left: 0;
  margin-right: var(--sidebar-width);
}

/* Mobile Responsive Logic */
@media (max-width: 991px) {
  .app-sidebar {
    width: 280px !important;
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: auto !important;
    transform: translateX(-102%) !important;
    box-shadow: none !important;
    z-index: 9999 !important;
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s !important;
    height: 100% !important;
  }

  [dir="rtl"] .app-sidebar {
    left: auto !important;
    right: 0 !important;
    transform: translateX(102%) !important;
  }

  .app-sidebar.active {
    transform: translateX(0) !important;
    visibility: visible !important;
    box-shadow: 0 0 30px rgba(0,0,0,0.4) !important;
  }

  .app-main, [dir="rtl"] .app-main {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    min-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    flex: 1 !important;
    position: relative !important;
  }

  .sidebar-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0,0,0,0.5) !important;
    backdrop-filter: blur(2px) !important;
    z-index: 9998 !important;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease !important;
  }

  .sidebar-overlay.active {
    display: block !important;
    opacity: 1 !important;
  }
}

.app-header {
  height: var(--header-height);
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 28px;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 999;
  backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .app-header {
  background-color: rgba(30, 41, 59, 0.8);
}

.content-body {
  padding: 20px;
  flex: 1;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

@media (max-width: 991px) {
  .app-header {
    padding: 0 15px !important;
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
  }
}

/* Modern Components */
.card-modern {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: var(--transition);
  margin-bottom: 24px;
}

.card-modern:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.stat-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
}

/* Header UI Elements */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-main);
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

/* Responsive Table */
.table-modern {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.table-modern thead th {
  padding: 12px 20px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
}

.table-modern tbody tr {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.table-modern tbody tr:hover {
  background: var(--primary-soft);
  transform: scale(1.01);
}

.table-modern td {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.table-modern td:first-child {
  border-left: 1px solid var(--border-color);
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.table-modern td:last-child {
  border-right: 1px solid var(--border-color);
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

/* Glassmorphism Classes */
.glass {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .glass {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Combined Sidebar Mobile (already handled above) */

/* Sidebar Toggle Button for Mobile */
.mobile-toggle {
  display: none;
}

@media (max-width: 991px) {
  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: #fff;
    border-radius: 12px;
    border: none;
    margin-right: 15px;
  }

  [dir="rtl"] .mobile-toggle {
    margin-right: 0;
    margin-left: 15px;
  }
}

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

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

/* Dark Mode Toggle Switch */
.theme-switch {
  position: relative;
  width: 50px;
  height: 26px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
  border-radius: 34px;
}

.slider-round:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 4px; bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider-round {
  background-color: var(--primary);
}

input:checked + .slider-round:before {
  transform: translateX(24px);
}
