* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: #eff6ff;
  color: #1e293b;
  direction: rtl;
  min-height: 100vh;
  padding: 20px;
}

.page-wrapper {
  max-width: 960px;
  margin: 0 auto;
}

/* Top Bar */
.top-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.btn-db-records {
  background-color: #ffffff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: all 0.2s;
}

.btn-db-records:hover {
  background-color: #2563eb;
  color: #ffffff;
}

/* Cards */
.form-card {
  background-color: #ffffff;
  border-radius: 14px;
  border: 1px solid #bfdbfe;
  padding: 22px 28px;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.08);
}

.margin-top {
  margin-top: 20px;
}

.card-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1e3a8a;
  margin-bottom: 20px;
  text-align: right;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.btn-add-city {
  background-color: #dbeafe;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-city:hover {
  background-color: #2563eb;
  color: white;
}

/* Grid Layout for General Info */
.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 35px;
  row-gap: 18px;
  align-items: center;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.field-row.align-right {
  justify-content: flex-start;
}

.field-row.align-left {
  justify-content: flex-start;
}

.field-row label {
  font-size: 1rem;
  font-weight: 800;
  color: #334155;
  white-space: nowrap;
}

.form-input {
  width: 100%;
  padding: 8px 14px;
  font-size: 0.95rem;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  outline: none;
  background-color: #ffffff;
  color: #1e293b;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.date-picker {
  max-width: 280px;
}

/* Radio Options */
.vehicle-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.vehicle-label {
  font-weight: 800;
}

.radio-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 700;
  color: #334155;
  user-select: none;
}

.radio-item input[type="radio"] {
  accent-color: #2563eb;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Table Design */
.table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
}

.cities-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background-color: #ffffff;
}

.cities-table th {
  background-color: #dbeafe;
  color: #1e40af;
  font-weight: 800;
  font-size: 1rem;
  padding: 10px 14px;
  border-bottom: 1px solid #93c5fd;
  text-align: center;
}

.cities-table th.col-city {
  text-align: right;
  padding-right: 25px;
}

.cities-table th.col-notes {
  text-align: right;
}

.cities-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.col-num {
  width: 45px;
  text-align: center;
  font-weight: 800;
  color: #475569;
}

.col-city {
  width: 210px;
}

.col-count {
  width: 140px;
}

.col-notes {
  width: auto;
}

.col-action {
  width: 40px;
}

.table-input {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  background-color: #ffffff;
  color: #1e293b;
}

.table-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.city-input {
  font-weight: 700;
}

.count-input {
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
}

/* Stepper Styles */
.stepper-container {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: center;
}

.stepper-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #93c5fd;
  background-color: #eff6ff;
  color: #1d4ed8;
  border-radius: 6px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  user-select: none;
}

.stepper-btn:hover {
  background-color: #2563eb;
  color: white;
}

.count-input {
  width: 60px !important;
  text-align: center;
  font-weight: 800;
  padding: 6px 0 !important;
}

/* Notes Toggle styling */
.col-notes {
  position: relative;
}

.notes-wrapper {
  display: block;
}

.btn-toggle-notes {
  display: none;
  background: none;
  border: none;
  color: #1d4ed8;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
}

.btn-toggle-notes.active {
  color: #2563eb;
}

.btn-delete-row {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 1rem;
}

/* Total Bar */
.total-bar {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
  font-size: 1.1rem;
  font-weight: 800;
  color: #1e3a8a;
}

/* Submit Section */
.submit-section {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 24px;
}

.btn-submit {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.45);
}

.btn-reset {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  color: #64748b;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-reset:hover {
  background-color: #f1f5f9;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: white;
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-card.small { max-width: 500px; }

.modal-header {
  padding: 16px 24px;
  background: #eff6ff;
  border-bottom: 1px solid #dbeafe;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: #64748b;
}

.modal-toolbar {
  padding: 12px 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.modal-toolbar input {
  padding: 6px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  width: 250px;
}

.btn-export {
  background-color: #2563eb;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

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

.records-table th, .records-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
}

.records-table th { background: #f8fafc; font-weight: 800; }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: white;
  padding: 12px 20px;
  border-radius: 8px;
  border-right: 5px solid #2563eb;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  font-weight: 700;
}

.toast.error { border-right-color: #ef4444; }

@media (max-width: 600px) {
  .card-grid {
    grid-template-columns: 1fr;
    row-gap: 12px;
  }
  .field-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .field-row.align-left {
    justify-content: flex-start;
  }
  .vehicle-row {
    align-items: flex-start;
  }
  .radio-options {
    flex-direction: row;
    gap: 15px;
  }
  .date-picker {
    max-width: 100%;
  }

  .cities-table, .cities-table tbody, .cities-table tr, .cities-table td {
    display: block;
    width: 100%;
  }
  
  .cities-table thead {
    display: none;
  }

  .cities-table tr {
    background-color: #ffffff;
    border: 1.5px solid #bfdbfe;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 10px;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.08);
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    row-gap: 8px;
    column-gap: 8px;
    align-items: center;
  }

  .cities-table td {
    padding: 0;
    border: none;
  }

  .cities-table td.col-num {
    grid-column: 1;
    grid-row: 1;
    background-color: #dbeafe;
    color: #1d4ed8;
    font-size: 0.9rem;
    font-weight: 800;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .cities-table td.col-city {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
  }

  .cities-table td.col-notes {
    display: contents;
  }

  .btn-toggle-notes {
    display: inline-block;
    grid-column: 3;
    grid-row: 1;
    justify-self: center;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #93c5fd;
    background-color: #eff6ff;
    border-radius: 6px;
  }

  .cities-table td.col-action {
    grid-column: 4;
    grid-row: 1;
    justify-self: end;
  }

  .cities-table td.col-count {
    grid-column: 1 / span 4;
    grid-row: 2;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .cities-table td.col-count::before {
    content: "عدد الطلبيات:";
    font-weight: 800;
    color: #475569;
    font-size: 0.88rem;
    min-width: 85px;
  }

  .notes-wrapper {
    display: none;
    grid-column: 1 / span 4;
    grid-row: 3;
    width: 100%;
    margin-top: 2px;
  }

  .notes-wrapper.expanded {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .notes-wrapper::before {
    content: "الملاحظات:";
    font-weight: 800;
    color: #475569;
    font-size: 0.88rem;
    min-width: 85px;
  }
}

