/* Salesperson Dashboard Styles */

.dashboard-container {
  height: calc(100vh - 60px);
  height: calc(100dvh - 60px); /* Dynamic viewport height for mobile */
  background: var(--bg);
  overflow: hidden;
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
}

/* Login Screen */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 20px;
}

.login-card {
  background: var(--glass);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.login-card h1 {
  color: var(--text);
  margin-bottom: 10px;
  font-size: 1.75rem;
}

.login-card p {
  color: var(--text-dim);
  margin-bottom: 25px;
  font-size: 0.9rem;
}

.login-card select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--glass-light-border);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 20px;
  cursor: pointer;
}

.login-card select:focus {
  outline: none;
  border-color: var(--accent);
}

.login-card .btn {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
}

/* Dashboard Screen */
.dashboard-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: var(--glass);
  border-bottom: 1px solid var(--border);
}

.header-left h1 {
  color: var(--text);
  font-size: 1.25rem;
  margin-bottom: 2px;
}

.header-left span {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.75rem;
}

/* Main Content */
.dashboard-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.route-panel {
  width: 400px;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--glass);
  border-right: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.map-panel {
  flex: 1;
}

.map-panel #map {
  width: 100%;
  height: 100%;
}

/* Date Selector */
.date-selector {
  margin-bottom: 15px;
}

.date-selector label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dim);
}

.date-selector input {
  padding: 10px 12px;
  border: 1px solid var(--glass-light-border);
  border-radius: 6px;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
}

.date-selector input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Starting Location */
.starting-location {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.starting-location label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dim);
}

.starting-location .help-text {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.starting-location input {
  padding: 10px 12px;
  border: 1px solid var(--glass-light-border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text);
  width: 100%;
}

.starting-location input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Directions Panel */
.directions-panel {
  background: var(--glass-light);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
}

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

.directions-header h2 {
  color: var(--text);
  font-size: 1rem;
  margin: 0;
}

.stop-count {
  background: var(--accent);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.directions-panel .directions-controls {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: transparent;
  padding: 0;
  margin: 0;
}

.directions-panel .directions-controls label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.directions-panel .directions-controls select {
  padding: 10px 12px;
  border: 1px solid var(--glass-light-border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text);
}

.directions-panel .btn {
  white-space: nowrap;
}

/* Stop List */
.stop-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stop-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--bg);
  border-radius: 8px;
  border-left: 4px solid var(--accent);
}

.stop-item.first {
  border-left-color: var(--green);
}

.stop-item.last {
  border-left-color: var(--red);
}

.stop-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.stop-item.first .stop-number {
  background: var(--green);
}

.stop-item.last .stop-number {
  background: var(--red);
}

.stop-details {
  flex: 1;
  min-width: 0;
}

.stop-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.stop-address {
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.4;
}

.stop-actions {
  flex-shrink: 0;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: var(--glass-light-border);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.btn-icon:hover {
  background: var(--accent);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

/* Route Status Messages */
#routeStatus {
  margin-bottom: 15px;
}

#routeStatus:empty {
  display: none;
}

/* No Route Message */
.no-route {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}

.no-route h3 {
  color: var(--text-dim);
  margin-bottom: 10px;
}

/* Map Toggle Button (mobile) */
.map-toggle-btn {
  display: none;
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  background: var(--glass-light);
  border: 1px solid var(--glass-light-border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.map-toggle-btn:hover {
  background: var(--glass-light-border);
}

.map-toggle-btn svg {
  width: 18px;
  height: 18px;
}

.map-toggle-btn.map-open {
  background: var(--accent);
  border-color: var(--accent);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .map-toggle-btn {
    display: flex;
  }

  .dashboard-main {
    flex-direction: column;
    overflow: hidden;
  }

  .route-panel {
    width: 100%;
    flex: 1;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .map-panel {
    height: 50vh;
    flex-shrink: 0;
    display: none; /* Hidden by default on mobile */
    position: relative;
  }

  .map-panel.show {
    display: block;
  }

  /* When map is shown, limit panel height */
  .route-panel.map-visible {
    flex: none;
    height: 50vh;
  }

  .dashboard-header {
    padding: 12px 15px;
  }

  .header-left h1 {
    font-size: 1.1rem;
  }

  .directions-panel .directions-controls {
    flex-direction: column;
  }

  .directions-panel .btn {
    width: 100%;
  }

  .stop-item {
    padding: 12px;
  }

  .stop-number {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .stop-name {
    font-size: 0.9rem;
  }

  .stop-address {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 30px 20px;
  }

  .login-card h1 {
    font-size: 1.5rem;
  }

  .route-panel {
    padding: 15px;
  }
}

/* Prevent iOS zoom on input focus - inputs must be 16px+ */
@media (max-width: 768px) {
  input[type="text"],
  input[type="date"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* ============================================
   BATCH NAVIGATION STYLES
   ============================================ */

/* Batch Navigation Header */
.batch-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--glass-light);
  padding: 12px 15px;
  border-radius: 8px;
  margin-bottom: 15px;
}

.batch-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.batch-title {
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
}

.batch-range {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.batch-buttons {
  display: flex;
  gap: 8px;
}

.batch-buttons .btn {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Batch Directions Section */
.batch-directions {
  margin-bottom: 20px;
}

.batch-start-from {
  margin-bottom: 12px;
}

.batch-start-from label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.batch-start-from select {
  padding: 10px 12px;
  border: 1px solid var(--glass-light-border);
  border-radius: 6px;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
}

.custom-start-wrapper {
  margin-top: 8px;
}

.custom-start-wrapper input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--glass-light-border);
  border-radius: 6px;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
}

.custom-start-wrapper input:focus {
  outline: none;
  border-color: var(--accent);
}

.batch-directions .btn-block {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
}

.batch-help {
  color: var(--text-dim);
  font-size: 0.8rem;
  text-align: center;
  margin-top: 8px;
  margin-bottom: 0;
}

/* All Stops Header */
.all-stops-header {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.all-stops-header h4 {
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0;
}

/* Batch Groups */
.batch-group {
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.batch-group.current {
  border-color: var(--accent);
}

.batch-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: var(--bg);
  cursor: pointer;
  transition: background-color 0.2s;
}

.batch-group-header:hover {
  background: var(--bg-input);
}

.batch-group.current .batch-group-header {
  background: var(--glass-light);
}

.batch-group-header span:first-child {
  font-weight: 500;
  color: var(--text);
  font-size: 0.9rem;
}

.batch-stop-count {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.batch-group.current .batch-stop-count {
  color: var(--accent);
}

/* Stops within expanded batch */
.batch-group .stop-item {
  border-radius: 0;
  border-left-width: 3px;
  margin: 0;
  border-top: 1px solid var(--border);
}

.batch-group .stop-item:last-child {
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

/* Current batch marker highlight */
.marker.current-batch {
  background: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.4);
  transform: scale(1.1);
}

/* Mobile adjustments for batch UI */
@media (max-width: 768px) {
  .batch-navigation {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .batch-info {
    align-items: center;
  }

  .batch-buttons {
    width: 100%;
    justify-content: center;
  }

  .batch-buttons .btn {
    flex: 1;
    max-width: 120px;
  }

  .batch-group-header {
    padding: 10px 12px;
  }

  .batch-group .stop-item {
    padding: 10px 12px;
  }
}
