/* ==========================================================================
   DELIVERY PRO - DRIVER MOBILE EXPERIENCE
   Emulates an iOS/Android native rider app with top notch ergonomics
   ========================================================================== */

.driver-widescreen-container {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 1.25rem;
  height: calc(100vh - 78px);
  padding: 0.85rem 1.5rem;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  flex: 1;
}

.driver-viewport {
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.driver-telemetry-console {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
}

.telemetry-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.telemetry-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.telemetry-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.telemetry-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.telemetry-stat-item {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.telemetry-stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.telemetry-stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.telemetry-route-map {
  height: 300px;
  min-height: 300px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  position: relative;
  background: #0f172a;
}

#driver-map-leaflet {
  width: 100%;
  height: 100%;
  min-height: 300px;
  z-index: 10;
}

@media (max-width: 1080px) {
  .driver-widescreen-container {
    grid-template-columns: 1fr;
    height: auto;
    overflow-y: auto;
    padding: 0.75rem;
  }
  .driver-telemetry-console {
    display: none;
  }
  .driver-viewport {
    max-width: 480px;
    margin: 0 auto;
    height: auto;
    min-height: calc(100vh - 100px);
  }
}

/* Driver Top Status Header */
.driver-top-bar {
  padding: 1.25rem;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.driver-profile-brief {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.driver-avatar-lg {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-emerald), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.driver-name-col h4 {
  font-size: 0.95rem;
  font-weight: 700;
}

.driver-vehicle-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Driver Duty Switcher (Online / Offline) */
.duty-switch-btn {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--accent-emerald);
  color: var(--accent-emerald);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.duty-switch-btn.offline {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-subtle);
  color: var(--text-subtle);
}

/* Driver Earnings Mini-Bar */
.driver-wallet-banner {
  margin: 1rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(99, 102, 241, 0.1));
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wallet-stat-col p {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.wallet-stat-col h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent-emerald);
}

/* RADAR SCREEN (Searching for orders) */
.driver-radar-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  gap: 1.5rem;
}

.radar-animation-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px solid var(--accent-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.radar-animation-circle::before,
.radar-animation-circle::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(16, 185, 129, 0.4);
  animation: radar-sweep 2.5s infinite linear;
}

.radar-animation-circle::after {
  inset: -25px;
  animation-delay: 1.25s;
}

@keyframes radar-sweep {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

.radar-icon-center {
  font-size: 2.5rem;
}

/* INCOMING ORDER OFFER MODAL / CARD */
.incoming-offer-card {
  margin: 1rem;
  background: var(--bg-surface-elevated);
  border: 2px solid var(--accent-orange);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(249, 115, 22, 0.3);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: bounceIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bounceIn {
  0% { transform: scale(0.9); opacity: 0; }
  70% { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 1; }
}

.offer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.offer-fee {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent-emerald);
}

.offer-timer {
  background: rgba(249, 115, 22, 0.15);
  color: var(--accent-orange);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.offer-route-preview {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.route-stop {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.offer-actions-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0.75rem;
}

/* ACTIVE DELIVERY STEP-BY-STEP NAVIGATOR */
.active-nav-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}

.step-action-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.current-step-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-orange);
  letter-spacing: 0.05em;
}

.step-target-name {
  font-size: 1.2rem;
  font-weight: 800;
}

.step-address {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.step-main-btn {
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  color: white;
  border: none;
  padding: 1rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
  transition: all var(--transition-fast);
}

.step-main-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.55);
}

.pin-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

.pin-box {
  width: 45px;
  height: 52px;
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: white;
}

.pin-box:focus {
  border-color: var(--primary);
  outline: none;
}

/* ==========================================================================
   PROOF OF DELIVERY (PoD) - CANVAS & SIGNATURE PAD
   ========================================================================== */
.pod-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pod-order-summary {
  background: rgba(0, 169, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pod-signature-wrapper {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 2px dashed rgba(0, 169, 255, 0.5);
  position: relative;
  overflow: hidden;
  touch-action: none;
}

.pod-signature-canvas {
  width: 100%;
  height: 180px;
  display: block;
  cursor: crosshair;
}

.pod-canvas-guide {
  position: absolute;
  bottom: 35px;
  left: 20px;
  right: 20px;
  border-bottom: 1px dashed #cbd5e1;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 600;
  padding-bottom: 2px;
}

.pod-signature-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.4rem;
}

/* Photo capture dropzone */
.pod-photo-zone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pod-photo-zone:hover {
  border-color: var(--primary);
  background: rgba(0, 169, 255, 0.05);
}

.pod-photo-preview {
  max-width: 100%;
  max-height: 140px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-subtle);
}

/* Cash Collection Banner in PoD */
.pod-cash-banner {
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.4);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fbbf24;
}

/* Driver Cash In Hand Widget */
.driver-cash-card {
  margin: 0 1rem 1rem 1rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.driver-cash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.credit-limit-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.credit-limit-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #f59e0b);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.credit-limit-bar-fill.danger {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

/* ==========================================================================
   THERMAL WAYBILL (GUÍA TÉRMICA & ETIQUETA QR 80MM)
   ========================================================================== */
.thermal-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  padding: 1.5rem;
  border-radius: var(--radius-md);
}

.thermal-ticket {
  width: 320px;
  background: #ffffff;
  color: #000000;
  padding: 1.25rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  line-height: 1.35;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  border: 1px solid #d1d5db;
}

.thermal-header {
  text-align: center;
  border-bottom: 2px dashed #000000;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
}

.thermal-logo-text {
  font-family: 'Montserrat', sans-serif;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: -0.5px;
}

.thermal-title {
  font-weight: 800;
  font-size: 12px;
  margin-top: 2px;
  text-transform: uppercase;
}

.thermal-qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0.75rem 0;
  padding: 0.5rem;
  border: 1px solid #000000;
  background: #ffffff;
}

.thermal-qr-box svg {
  display: block;
}

.thermal-section {
  border-bottom: 1px dashed #000000;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}

.thermal-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
}

.thermal-row strong {
  font-weight: 800;
}

.thermal-pin-box {
  border: 2px solid #000000;
  padding: 4px;
  text-align: center;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 4px;
  margin: 6px 0;
  background: #f3f4f6;
}

.thermal-footer-tear {
  border-top: 2px dashed #000000;
  padding-top: 0.5rem;
  margin-top: 0.75rem;
  text-align: center;
  font-size: 9px;
}

/* Print Stylesheet: prints ONLY the thermal ticket */
@media print {
  body * {
    visibility: hidden !important;
  }
  #thermal-printable-area, #thermal-printable-area * {
    visibility: visible !important;
  }
  #thermal-printable-area {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 80mm !important;
    margin: 0 !important;
    padding: 2mm !important;
    box-shadow: none !important;
    border: none !important;
  }
  .modal-overlay {
    background: transparent !important;
    position: static !important;
    display: block !important;
  }
  .modal-window {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }
  .modal-header, .modal-footer, .modal-close-btn, .header-actions {
    display: none !important;
  }
}

/* ==========================================================================
   EXTERNAL NAVIGATION APP BUTTONS (GOOGLE MAPS & WAZE)
   ========================================================================== */
.btn-nav-app {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-google-maps {
  background: rgba(26, 115, 232, 0.15);
  border-color: rgba(26, 115, 232, 0.4);
  color: #60a5fa;
}

.btn-google-maps:hover {
  background: #1a73e8;
  border-color: #1a73e8;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.35);
}

.btn-waze {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.4);
  color: #38bdf8;
}

.btn-waze:hover {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.nav-coords-badge {
  font-family: monospace;
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.12);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.25);
}

