:root {
  --bg-main: #09090b;
  --bg-card: #18181b;
  --bg-alt: #27272a;
  --text-main: #ffffff;
  --text-muted: #a1a1aa;
  --border-color: #3f3f46;
  --border-light: #ffffff;
  --primary: #ffffff;
  --primary-hover: #e4e4e7;
  --radius: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Cairo', 'Tajawal', system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  direction: rtl;
  text-align: right;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: #18181b;
}
::-webkit-scrollbar-thumb {
  background: #3f3f46;
  border-radius: 3px;
}

/* Layout */
#app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header Navbar */
.navbar {
  background: #18181b;
  border-bottom: 2px solid var(--border-color);
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 900;
  color: #ffffff;
}

.mobile-menu-btn {
  display: none;
  background: #27272a;
  border: 1px solid var(--border-color);
  color: #ffffff;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  font-size: 1.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.nav-links {
  display: flex;
  gap: 6px;
  list-style: none;
}

.nav-btn {
  background: #18181b;
  border: 1px solid var(--border-color);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.nav-btn:hover {
  background: #27272a;
}

.nav-btn.active {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

.logout-btn {
  background: #18181b;
  color: #ef4444;
  border: 1px solid #7f1d1d;
}
.logout-btn:hover {
  background: #450a0a;
  color: #ffffff;
}

/* MOBILE SIDEBAR DRAWER & OVERLAY */
.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 998;
}

.mobile-sidebar-overlay.active {
  display: block;
}

.mobile-sidebar {
  position: fixed;
  top: 0;
  right: -280px;
  width: 280px;
  height: 100%;
  background: #18181b;
  border-left: 2px solid var(--border-color);
  z-index: 999;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -5px 0 25px rgba(0,0,0,0.5);
}

.mobile-sidebar.active {
  right: 0;
}

.sidebar-header {
  padding: 1.25rem;
  border-bottom: 1.5px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-sidebar-btn {
  background: #27272a;
  border: 1px solid var(--border-color);
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-body {
  padding: 1rem;
  flex: 1;
  overflow-y: auto;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-btn {
  width: 100%;
  justify-content: flex-start;
  padding: 12px 16px;
  font-size: 1rem;
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1.5px solid var(--border-color);
}

/* Main Content Views */
.content-wrapper {
  flex: 1;
  padding: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

/* Category Tabs Bar */
.category-tabs-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 1.25rem;
  -webkit-overflow-scrolling: touch;
}

.cat-tab-btn {
  background: #18181b;
  border: 1px solid var(--border-color);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
}

.cat-tab-btn:hover {
  background: #27272a;
}

.cat-tab-btn.active {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

/* Trips Catalog Grid & Cards */
.trips-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}

.trip-card {
  background: #18181b;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.trip-card:hover {
  border-color: #ffffff;
}

.trip-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.6rem;
}

.trip-title {
  font-size: 1.15rem;
  font-weight: 900;
  color: #ffffff;
}

.trip-price-tag {
  background: #27272a;
  color: #ffffff;
  border: 1px solid #ffffff;
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 900;
  font-size: 0.9rem;
}

.trip-badge-schedule {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 0.6rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
  background: #27272a;
  color: #ffffff;
}

.trip-details-text {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1rem;
  flex: 1;
}

.trip-times-list {
  background: #09090b;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 1rem;
}

.trip-times-title {
  font-size: 0.8rem;
  color: #ffffff;
  font-weight: 700;
  margin-bottom: 4px;
}

.trip-time-pill {
  background: #27272a;
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  display: inline-block;
  margin: 2px;
  border: 1px solid var(--border-color);
}

/* Cards & Sections */
.card {
  background: #18181b;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 8px;
}

/* Form Styles & Grids */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-weight: 700;
  color: #ffffff;
  font-size: 0.9rem;
}

.form-control {
  background: #09090b;
  border: 1.5px solid var(--border-color);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  outline: none;
  min-height: 44px;
  width: 100%;
}

.form-control:focus {
  border-color: #ffffff;
}

select.form-control {
  cursor: pointer;
}

.form-range {
  width: 100%;
  accent-color: #ffffff;
  cursor: pointer;
  height: 24px;
}

/* Inline Add Forms (Category & Agent Forms) */
.inline-add-form {
  display: flex;
  gap: 10px;
  margin-bottom: 1.25rem;
}

/* Visual Canvas Editor Layout */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
  align-items: start;
}

.editor-canvas-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #000000;
  padding: 10px;
  border-radius: var(--radius);
  border: 2px solid var(--border-color);
}

.editor-controls-card {
  background: #18181b;
  padding: 1rem;
  border-radius: var(--radius);
  border: 2px solid var(--border-color);
}

/* Buttons */
.btn {
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1.5px solid #ffffff;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
}

.btn-primary {
  background: #ffffff;
  color: #000000;
}

.btn-primary:hover {
  background: #e4e4e7;
}

.btn-secondary {
  background: #18181b;
  color: #ffffff;
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: #27272a;
}

.btn-danger {
  background: #18181b;
  color: #fca5a5;
  border-color: #7f1d1d;
}
.btn-danger:hover {
  background: #450a0a;
}

.btn-success {
  background: #18181b;
  color: #86efac;
  border-color: #14532d;
}
.btn-success:hover {
  background: #052e16;
}

/* Tables & Responsive Wrappers */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1.5px solid var(--border-color);
  -webkit-overflow-scrolling: touch;
  display: block;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
}

.custom-table th, .custom-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.custom-table th {
  background: #27272a;
  color: #ffffff;
  font-weight: 900;
  white-space: nowrap;
}

.custom-table tr:hover {
  background: #27272a;
}

.badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-block;
  border: 1px solid var(--border-color);
}
.badge-success { background: #052e16; color: #86efac; border-color: #14532d; }
.badge-warning { background: #422006; color: #fde047; border-color: #713f12; }

/* Action Buttons Inside Tables */
.table-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
}

.table-actions .btn {
  min-height: 36px;
  padding: 4px 10px;
  font-size: 0.82rem;
  white-space: nowrap;
}

/* Login Container */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: #09090b;
}

.login-card {
  width: 100%;
  max-width: 400px;
  text-align: center;
  border: 2px solid #ffffff;
}

.login-card .brand {
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
}

.login-subtitle {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
}

/* Modal */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 0.75rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal-content {
  background: #18181b;
  border: 2px solid #ffffff;
  border-radius: var(--radius);
  max-width: 850px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 0.8rem 1.2rem;
  border-bottom: 2px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  color: #ffffff;
  font-size: 1.1rem;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
}
.close-btn:hover { color: #ffffff; }

.modal-body {
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-footer {
  padding: 0.8rem 1.2rem;
  border-top: 2px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* Canvas Container */
.canvas-wrapper {
  width: 100%;
  overflow-x: auto;
  text-align: center;
  background: #000000;
  padding: 4px;
  border-radius: 4px;
  border: 1.5px solid var(--border-color);
  -webkit-overflow-scrolling: touch;
}

canvas {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border-color);
}

#editor-canvas {
  cursor: crosshair;
}

/* Notification Toast */
.toast-container {
  position: fixed;
  bottom: 15px;
  left: 15px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 90%;
}

.toast {
  padding: 10px 16px;
  border-radius: 4px;
  background: #ffffff;
  color: #000000;
  border-right: 4px solid #000000;
  font-weight: 700;
  font-size: 0.88rem;
}

/* MEDIA QUERIES FOR MOBILE PHONES */
@media (max-width: 850px) {
  .desktop-nav {
    display: none !important;
  }
  
  .mobile-menu-btn {
    display: flex;
  }

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .two-col-grid {
    grid-template-columns: 1fr !important;
  }

  .content-wrapper {
    padding: 0.75rem 0.5rem;
  }

  .card {
    padding: 0.88rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .inline-add-form {
    flex-direction: column;
  }

  .inline-add-form .btn {
    width: 100%;
  }

  .modal-footer {
    justify-content: stretch;
  }

  .modal-footer .btn {
    flex: 1;
  }

  .custom-table th, .custom-table td {
    padding: 8px 6px;
    font-size: 0.85rem;
  }

  .table-actions .btn {
    padding: 4px 6px;
    font-size: 0.78rem;
  }
}
