/* Create Order Page Styles */
@import url("./base.css");

body {
  background-color: var(--gray-100);
  padding: var(--spacing-md);
  min-height: 100vh;
}

.container {
  max-width: var(--container-lg);
  margin: 0 auto;
  background: white;
  padding: var(--spacing-lg);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow-md);
}

@media (max-width: 768px) {
  .container {
    width: 97% !important;
    /* Updated from full width */
    margin: 20px auto;
    padding: 20px;
  }

  .order-header {
    flex-direction: column;
    gap: 12px;
  }

  .order-header input,
  .order-header select,
  .custom-customer-select {
    width: 100%;
    flex: none;
  }
}

.responsive-input {
  flex: 1 1 30%;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 16px;
  background-color: #f1f3f5;
  color: #555;
}

@media (max-width: 576px) {
  .responsive-input {
    flex: 1 1 100%;
    font-size: 14px;
    padding: 10px;
    height: 40px;
  }
}

.responsive-input {
  background-color: #f2f3f5;
  width: 100%;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 16px;
}

.input-container {
  flex: 1 1 30%;
  position: relative;
}

.barcode-suggestions.dropdown-list {
  position: relative;
  z-index: 100;
  margin-top: 5px;
  list-style: none;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius-sm);
  background: white;
  max-height: 200px;
  overflow-y: auto;
  padding: 0;
  width: 100%;
}

.barcode-suggestions.dropdown-list li {
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--gray-100);
}

.barcode-suggestions.dropdown-list li:hover {
  background-color: var(--gray-100);
}

#customer-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: white;
  border: 1px solid var(--gray-300);
  border-top: none;
  max-height: 200px;
  overflow-y: auto;
  list-style: none;
  padding: 0;
  margin: 0;
  display: none;
}

#customer-suggestions li {
  padding: var(--spacing-xs);
  cursor: pointer;
}

.dropdown-list {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  position: absolute;
  background: white;
  z-index: 10;
  width: 100%;
}

/* Mobile view adjustments */
@media (max-width: 576px) {
  .input-container {
    flex: 1 1 100%;
  }

  .responsive-input {
    font-size: 14px;
    padding: 8px 12px;
    height: 40px;
  }
}

/* Customer Visit Styles */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  padding: 20px;
}

.container {
  display: grid;
  gap: 16px;
  max-width: 700px;
  margin: auto;
}

.input-container {
  position: relative;
}

#map {
  height: 450px;
  border: 1px solid #ddd;
  border-radius: 8px;
}

button {
  padding: 10px 16px;
  border: 1px solid #fff;
  border-radius: 6px;
  cursor: pointer;
  background: #4caf50;
  color: white;
  font-size: 16px;
  width: 100% !important;
}

button:hover {
  background: #45a049;
}

.dropdown-list {
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 100%;
  max-height: 300px;
  /* Increased height for the dropdown */
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-sizing: border-box;
}

.dropdown-list li {
  padding: 8px;
  cursor: pointer;
}

.dropdown-list li:hover {
  background: #f0f0f0;
}

textarea {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 14px;
  box-sizing: border-box;
}

.address-dropdown {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 14px;
  box-sizing: border-box;
}


/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    height: 100vh;
  }

  .container {
    gap: 12px;
    flex: 0 0 auto;
  }

  .top-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .top-inputs>div {
    width: 100% !important;
    flex: unset !important;
  }

  .input-container input,
  .status-select select {
    width: 100% !important;
    height: 48px;
    font-size: 16px;
    padding: 0 12px;
    border-radius: 8px;
    box-sizing: border-box;
  }

  button {
    width: 100% !important;
  }

  #map {
    flex: 1;
    height: auto;
    min-height: 250px;
  }
}

@media (min-width: 768px) {
  .top-inputs {
    flex-direction: row;
  }

  .status-select {
    flex: 0 0 200px;
  }

  #checkInBtn {
    width: auto;
    padding: 12px 24px;
  }
}

/* 🌙 Dark Mode — Customer Visit (Check-In) */
body.dark-mode {
  background-color: #121212;
  color: #e7e7ea;
}

/* Card/container */
body.dark-mode .container {
  background: #151923;
  color: #e7e7ea;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .6);
  border: 1px solid #2a3142;
}

/* Inputs, selects, textarea */
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea,
body.dark-mode .address-dropdown {
  background: #1f2430;
  color: #e7e7ea;
  border: 1px solid #2a3142;
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
  color: #9aa3b2;
}

/* “Type-ahead” dropdowns */
body.dark-mode .dropdown-list,
body.dark-mode #customer-suggestions {
  background: #151923;
  color: #e7e7ea;
  border: 1px solid #2a3142;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
}

body.dark-mode .dropdown-list li:hover,
body.dark-mode #customer-suggestions li:hover {
  background: #1d2432;
}

/* Buttons (keep your green, just tune contrast a bit) */
body.dark-mode button {
  background: #2e7d32;
  /* darker green for dark bg */
  border-color: #2e7d32;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}

body.dark-mode button:hover {
  background: #256b28;
}

/* Map container + Leaflet controls */
body.dark-mode #map {
  border-color: #2a3142;
  background: #0f1220;
  /* behind tiles while loading */
}

/* Zoom buttons */
body.dark-mode .leaflet-bar a {
  background: #232a3b;
  color: #e7e7ea;
  border-color: #2a3142;
}

body.dark-mode .leaflet-bar a:hover {
  background: #2a3142;
}

/* Popups */
body.dark-mode .leaflet-popup-content-wrapper,
body.dark-mode .leaflet-popup-tip {
  background: #1f2430;
  color: #e7e7ea;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .5);
  border: 1px solid #2a3142;
}

/* Mobile tweaks */
@media (max-width: 768px) {

  body.dark-mode .top-inputs>div,
  body.dark-mode .input-container {
    background: transparent;
  }
}
