/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f0f2f5;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* Login Styles (keeping existing functionality) */
.login-container {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 40px 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  text-align: center;
}

.logo-section {
  margin-bottom: 30px;
}

.logo-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 10px;
}

.login-card h1 {
  font-size: 24px;
  color: #0d482d;
  margin-bottom: 5px;
}

.login-card p {
  color: #666;
  font-size: 14px;
}

.login-card input {
  width: 100%;
  padding: 15px;
  margin-bottom: 15px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 16px;
  background: #f8f9fa;
}

.login-card input:focus {
  outline: none;
  border-color: #0d482d;
  background: white;
}

.login-card button {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #0d482d, #2e8b57);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.login-card button:hover {
  background: linear-gradient(135deg, #2e8b57, #0d482d);
}

/* Main App Container */
.main-app {
  width: 100%;
  min-height: 100vh;
  background: #f0f2f5;
}

.app-container {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  background: #f0f2f5;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: linear-gradient(135deg, #0d482d, #2e8b57);
  color: white;
  padding: 50px 15px 15px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-text h1 {
  font-size: 16px;
  margin: 0;
}

.logo-text p {
  font-size: 11px;
  opacity: 0.8;
  margin: 0;
}

.driver-info {
  text-align: right;
}

.driver-name {
  font-size: 14px;
  font-weight: 600;
}

.gps-status {
  font-size: 11px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.gps-dot {
  width: 8px;
  height: 8px;
  background: #28a745;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Content */
.content {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
}

.card {
  background: white;
  border-radius: 10px;
  margin-bottom: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
}

/* Current Order */
.current-order {
  background: linear-gradient(135deg, #e6f2ff, #f0f8ff);
  border-left: 4px solid #0d482d;
}

.order-header {
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-number {
  font-size: 18px;
  font-weight: 700;
  color: #0d482d;
}

.status {
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 600;
  background: #ffc107;
  color: #000;
}

.order-details {
  padding: 0 15px 15px;
  font-size: 13px;
  color: #666;
}

.dates {
  margin-bottom: 5px;
}

.info {
  color: #888;
}

/* Location Cards */
.location-card {
  display: flex;
  align-items: center;
  padding: 15px;
  background: #f8f9fa;
}

.location-icon {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 14px;
  color: white;
}

.pickup-icon {
  background: #0d482d;
}

.delivery-icon {
  background: #28a745;
}

.location-text h3 {
  font-size: 14px;
  margin: 0 0 3px 0;
  color: #333;
}

.location-address {
  font-size: 12px;
  color: #666;
  margin: 0 0 2px 0;
}

.location-contact {
  font-size: 11px;
  color: #888;
  margin: 0 0 5px 0;
}

.nav-btn {
  background: #2e8b57;
  color: white;
  padding: 5px 10px;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

/* Progress Section */
.progress-section {
  padding: 15px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
}

.progress-bar {
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 15px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0d482d, #2e8b57);
  width: 0%;
  transition: width 0.3s ease;
}

.main-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #0d482d, #2e8b57);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Action Buttons */
.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 15px;
}

.actions-grid .warning {
  grid-column: span 2;
}

/* When document view buttons are shown, adjust layout */
.actions-grid.has-documents {
  grid-template-columns: 1fr 1fr 1fr;
}

.actions-grid.has-documents .warning {
  grid-column: span 3;
}

.action-btn {
  padding: 12px 8px;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.primary {
  background: #0d482d;
  color: white;
}

.success {
  background: #28a745;
  color: white;
}

.warning {
  background: #ffc107;
  color: #000;
  grid-column: span 2;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .content {
    padding: 10px;
  }

  .header {
    padding: 45px 12px 12px 12px;
  }
}
.warning {
  background: #ffc107;
  color: #000;
  grid-column: span 2;
}
/* Section Headers */
.section-header {
  padding: 15px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Order Items */
.order-item {
  padding: 15px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.2s;
}

.order-item:hover {
  background: #f8f9fa;
}

.order-item:last-child {
  border-bottom: none;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.item-number {
  font-size: 14px;
  font-weight: 600;
  color: #0d482d;
}

.item-details {
  font-size: 12px;
}

.item-dates {
  color: #666;
  margin-bottom: 3px;
}

.item-route {
  font-weight: 600;
  color: #333;
  margin-bottom: 3px;
}

.item-info {
  color: #888;
  font-size: 11px;
}

/* Status badges for different order states */
.status-dispatched {
  background: #e6f7e6;
  color: #1e7e1e;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 600;
}

.status-delivered {
  background: #e6f2ff;
  color: #0055b3;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 600;
}

.status-cancelled {
  background: #ffe6e6;
  color: #cc0000;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 600;
}

.status-picked-up {
  background: #d1ecf1;
  color: #0c5460;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 600;
}

.status-pending {
  background: #fff3cd;
  color: #856404;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 600;
}

/* ===================== */
/* Collapsible Archive */
/* ===================== */
.collapsible-header {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
  position: relative;
}

.collapsible-header:hover {
  background: #e9ecef;
}

.collapsible-header:active {
  background: #dee2e6;
}

.collapse-icon {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #666;
  transition: transform 0.3s ease;
  font-weight: normal;
}

.collapse-icon.collapsed {
  transform: translateY(-50%) rotate(-90deg);
}

.collapsible-content {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  max-height: 1000px;
  opacity: 1;
}

.collapsible-content.collapsed {
  max-height: 0;
  opacity: 0;
}

/* Archive collapsed state indicator */
.archive-collapsed-info {
  padding: 10px 15px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  font-size: 12px;
  color: #666;
  text-align: center;
  font-style: italic;
}

/* Empty state */
.empty-state {
  padding: 20px;
  text-align: center;
  color: #888;
  font-style: italic;
}

/* Profile Dropdown Styles */
.driver-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-dropdown {
  position: relative;
}

.profile-btn {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.profile-icon {
  font-size: 16px;
}

.dropdown-menu {
  position: absolute;
  top: 45px;
  right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  min-width: 220px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  padding: 15px;
  border-bottom: 1px solid #e9ecef;
}

.dropdown-driver-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 2px;
}

.dropdown-driver-code {
  font-size: 12px;
  color: #666;
  margin-bottom: 2px;
}

.dropdown-carrier {
  font-size: 11px;
  color: #888;
  font-style: italic;
}

.dropdown-divider {
  height: 1px;
  background: #e9ecef;
}

.dropdown-item {
  width: 100%;
  padding: 12px 15px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #333;
  transition: background 0.2s ease;
}

.dropdown-item:hover {
  background: #f8f9fa;
}

.logout-btn {
  color: #dc3545;
}

.logout-btn:hover {
  background: #fff5f5;
}

/* Three Card Row Styles */
.three-card-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  padding: 15px;
  background: white;
  border-radius: 10px;
  margin-bottom: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.small-card {
  text-align: center;
  padding: 12px 8px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.eta-card {
  background: linear-gradient(135deg, #fff3cd, #ffeaa7);
  border-left: 3px solid #ffc107;
}

.card-icon {
  font-size: 16px;
  margin-bottom: 4px;
}

.card-title {
  font-size: 10px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.card-value {
  font-size: 16px;
  font-weight: 700;
  color: #0d482d;
  margin-bottom: 2px;
}

.card-subtitle {
  font-size: 9px;
  color: #888;
  margin-bottom: 2px;
}

.card-note {
  font-size: 7px;
  color: #999;
  font-style: italic;
  line-height: 1.2;
}

/* Responsive adjustments */
@media (max-width: 350px) {
  .three-card-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .small-card {
    padding: 10px;
  }
}

/* Enhanced Issue Modal Styles */
.form-group select option {
  padding: 8px;
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23666'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 40px;
}

#customTextGroup {
  transition: all 0.3s ease;
  overflow: hidden;
}

#customIssue {
  min-height: 60px;
  font-family: inherit;
}

.form-group label {
  font-size: 13px;
}

/* Success state styling */
.btn-primary:disabled {
  background: #28a745;
  cursor: not-allowed;
}

/* Issue type icons in select */
.form-group select option {
  background: white;
  color: #333;
}

/* Mobile responsive adjustments */
@media (max-width: 400px) {
  .modal-content {
    margin: 10px;
    width: calc(100% - 20px);
  }
  
  .form-group label {
    font-size: 12px;
  }
  
  .form-group select,
  .form-group textarea {
    font-size: 14px;
  }
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: 20px 20px 15px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: #f0f0f0;
  color: #333;
}

.modal-body {
  padding: 20px;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 5px;
  color: #333;
  font-size: 14px;
}

.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #f8f9fa;
}

.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #0d482d;
  background: white;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #e9ecef;
}

.btn-primary,
.btn-secondary {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #0d482d, #2e8b57);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2e8b57, #0d482d);
}

.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.btn-secondary {
  background: #f8f9fa;
  color: #666;
  border: 1px solid #e9ecef;
}

.btn-secondary:hover {
  background: #e9ecef;
  color: #333;
}

/* ===================== */
/* Order Detail Modal */
/* ===================== */
.order-detail-modal .modal-content {
  width: 95%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
}

.order-detail-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.order-detail-body {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.loading-spinner {
  font-size: 24px;
  margin-bottom: 10px;
}

/* Key Stats for Mobile */
.key-stats-mobile {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.stat-item {
  flex: 1;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px 8px;
  text-align: center;
  border: 1px solid #e9ecef;
}

.stat-item .stat-value {
  font-size: 16px;
  font-weight: bold;
  color: #0d482d;
  margin-bottom: 2px;
}

.stat-item .stat-label {
  font-size: 11px;
  color: #666;
  font-weight: 500;
}

/* Detail Sections */
.detail-section {
  background: #fff;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  border: 1px solid #e9ecef;
}

.detail-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #0d482d;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f0;
}

/* Detail Grid */
.detail-grid {
  display: grid;
  gap: 8px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #f8f9fa;
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 12px;
  color: #666;
  font-weight: 500;
  min-width: 80px;
}

.detail-value {
  font-size: 12px;
  color: #333;
  font-weight: 500;
  text-align: right;
  flex: 1;
}

/* Location Details */
.location-details {
  font-size: 13px;
}

.location-name {
  font-weight: 600;
  color: #0d482d;
  margin-bottom: 5px;
}

.location-address {
  color: #333;
  margin-bottom: 8px;
  line-height: 1.4;
}

.location-contact {
  font-size: 12px;
  color: #666;
  line-height: 1.4;
}

/* Document Buttons */
.document-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.doc-btn {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  color: #0d482d;
  cursor: pointer;
  transition: background-color 0.2s;
  font-weight: 500;
}

.doc-btn:hover {
  background: #e9ecef;
}

.doc-btn:active {
  background: #dee2e6;
}

/* Notes Content */
.notes-content {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 12px;
  font-size: 12px;
  color: #666;
  line-height: 1.5;
  min-height: 40px;
  white-space: pre-line;
}

/* Route Button */
.route-btn {
  width: 100%;
  background: #0d482d;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.route-btn:hover {
  background: #1c6a41;
}

.route-btn:active {
  background: #0a3d26;
}

/* Modal Responsiveness */
@media (max-width: 375px) {
  .order-detail-modal .modal-content {
    width: 98%;
    margin: 1% auto;
  }
  
  .key-stats-mobile {
    gap: 5px;
  }
  
  .stat-item {
    padding: 10px 6px;
  }
  
  .stat-item .stat-value {
    font-size: 14px;
  }
  
  .stat-item .stat-label {
    font-size: 10px;
  }
}