/* Blinking effect for .ontime-status (same as .cash) */
.ontime-status.flash-blink {
  animation: flash 1.5s infinite;
  box-shadow: 0 2px 6px rgba(0, 184, 148, 0.3);
}
/* Cash indicator flash animation */
@keyframes flash {
  0%, 100% {
    opacity: 1;
    background: #e53935;
  }
  50% {
    opacity: 0.6;
    background: #c62828;
  }
}

/* Free-Style Input section description margin */
.free-style-section p {
  margin: 10px 0;
}
/* Free-Style Input section heading style (was h3, now h4) */
.free-style-section h4 {
  margin: 0 0px 10px 0px;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: row;
}

.free-style-section h4::before {
  content: '📝';
  font-size: 22px;
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
  margin-right: 6px;
}
h3 {
  font-size: 13px;
}
/* Set page counter font size to 8px */
#pageCounter {
  font-size: 8px !important;
}
/* Set @Boris mail link font size to 13px */
#borisMail {
  font-size: 10px !important;
}
/* Make h5 headings (e.g., Standard Input) font size 15px */
h5 {
  font-size: 18px;
  margin-top: 0px;
  margin-bottom: 10px;
}
/* Theme Variables */
:root {
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f8f9fa;
  --bg-gradient-start: #fff3cd;
  --bg-gradient-end: #ffeaa7;
  --text-primary: #333;
  --text-secondary: #2d3748;
  --text-tertiary: #4a5568;
  --border-color: #e2e8f0;
  --shadow-light: rgba(0,0,0,0.1);
  --shadow-medium: rgba(0,0,0,0.2);
  --input-bg: #ffffff;
}

html[data-theme="dark"], body[data-theme="dark"] {
  --bg-primary: #1a202c;
  --bg-secondary: #2d3748;
  --bg-tertiary: #4a5568;
  --bg-gradient-start: #3d3d00;
  --bg-gradient-end: #5a5a00;
  --text-primary: #e2e8f0;
  --text-secondary: #cbd5e0;
  --text-tertiary: #a0aec0;
  --border-color: #4a5568;
  --shadow-light: rgba(0,0,0,0.3);
  --shadow-medium: rgba(0,0,0,0.5);
  --input-bg: #2d3748;
}

/* Base styles */
#map {
  height: 500px;
  width: 100%;
  margin-bottom: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px var(--shadow-light);
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  margin: 20px auto;
  max-width: 1200px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
  background: var(--bg-secondary);
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 2px 20px var(--shadow-light);
}

.summary {
  margin-top: 20px;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 10px;
  box-shadow: 0 4px 15px var(--shadow-medium);
}

.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 50px;
  padding: 10px 20px;
  cursor: pointer;
  box-shadow: 0 2px 10px var(--shadow-light);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--shadow-medium);
}

.alert-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-left: 10px;
  animation: pulse 2s infinite;
}

.alert-danger {
  background: #e74c3c;
  color: white;
}

.alert-warning {
  background: #f39c12;
  color: white;
}

.alert-success {
  background: #27ae60;
  color: white;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.share-button {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  margin-left: 10px;
}

.maps-button {
  background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
  margin-left: 10px;
}

.input-section {
  margin-bottom: 25px;
  padding: 25px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 15px var(--shadow-light);
  position: relative;
  overflow: hidden;
}

.input-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
}

.input-section h3 {
  margin: 0 0 20px 0;
  color: var(--text-secondary);
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-section h3::before {
  content: '📝';
  font-size: 24px;
}

.input-group {
  margin-bottom: 12px;
  background: var(--input-bg);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  position: relative;
}

.input-group:hover {
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
  transform: translateY(-2px);
  border-color: #667eea;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

input, select, textarea {
  width: 94%;
  padding: 6px 8px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 0;
  font-size: 14px;
  transition: all 0.3s ease;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 500;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
  background-color: var(--input-bg);
  transform: scale(1.01);
}

input::placeholder, textarea::placeholder {
  color: var(--text-tertiary);
  opacity: 0.6;
}

#freeStyleInput {
  min-height: 120px;
  resize: vertical;
  font-family: 'Courier New', monospace;
  line-height: 1.4;
}

button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s;
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.free-style-section {
  margin-top: 25px;
  padding: 20px;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  border-radius: 8px;
  border-left: 4px solid #ffd43b;
}

.parsed-info {
  margin-top: 15px;
  padding: 15px;
  background-color: rgba(40, 167, 69, 0.2);
  border-radius: 6px;
  border-left: 4px solid #28a745;
  display: none;
  color: var(--text-primary);
  font-size: 18px;
}

.analysis-box {
  background: var(--bg-secondary);
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 4px 20px var(--shadow-light);
  margin-top: 25px;
  border: 1px solid var(--border-color);
}

.analysis-header {
  text-align: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid #667eea;
}

.analysis-header h3 {
  margin: 0;
  color: var(--text-secondary);
  font-size: 28px;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.metric-group {
  background: var(--bg-tertiary);
  padding: 20px;
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.metric-group h4 {
  margin: 0 0 15px 0;
  color: var(--text-secondary);
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.metric:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.metric-label {
  color: var(--text-tertiary);
  font-weight: 500;
  font-size: 16px;
}

.metric-value {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 16px;
}

.earnings-summary {
  background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
  color: white;
  padding: 25px;
  border-radius: 8px;
  text-align: center;
  margin-top: 20px;
}

.earnings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 15px;
}

.earnings-card {
  background: rgba(255,255,255,0.2);
  padding: 15px;
  border-radius: 6px;
  backdrop-filter: blur(10px);
}

.earnings-value {
  font-size: 24px;
  font-weight: 700;
  margin: 10px 0;
}

.earnings-label {
  font-size: 14px;
  opacity: 0.9;
}

.progress-container {
  margin: 15px 0;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 14px;
  color: #4a5568;
}

.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  min-width: 2px;
}

.progress-fill::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
  z-index: 1;
  pointer-events: none;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.route-breakdown {
  background: var(--bg-tertiary);
  padding: 20px;
  border-radius: 8px;
  margin-top: 20px;
  border: 1px solid var(--border-color);
}

.route-breakdown h4 {
  margin: 0 0 15px 0;
  color: var(--text-secondary);
  font-size: 18px;
}

.efficiency-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid var(--border-color);
}

.efficiency-row-last {
  padding: 15px 0;
}

.efficiency-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  width: 100%;
}

.efficiency-label {
  font-size: 16px;
  color: var(--text-tertiary);
}

.efficiency-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}

.efficiency-value-large {
  font-size: 24px;
  font-weight: 700;
  color: #00b894;
}

.route-segment {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.route-segment:last-child {
  border-bottom: none;
}

.segment-info {
  display: flex;
  gap: 15px;
}

.segment-distance, .segment-time {
  color: var(--text-tertiary);
}

h2, h3 {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

h2 {
  border-bottom: 3px solid #667eea;
  padding-bottom: 10px;
  font-size: 28px;
}

.fuel-cost-menu {
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.15) 0%, rgba(33, 150, 243, 0.05) 100%);
  padding: 12px 15px;
  border-radius: 10px;
  margin-bottom: 15px;
  border: 2px solid rgba(33, 150, 243, 0.3);
  box-shadow: 0 3px 10px rgba(33, 150, 243, 0.1);
  position: relative;
  overflow: hidden;
}

.fuel-cost-menu::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: #2196f3;
}

.fuel-cost-menu h4 {
  margin: 0 0 10px 0;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.fuel-cost-menu h4::before {
  content: '⛽';
  font-size: 20px;
}

.whatsapp-examples {
  background: #e8f5e9;
  padding: 15px;
  border-radius: 6px;
  margin-top: 15px;
  border-left: 4px solid #4caf50;
}

.whatsapp-examples h4 {
  margin: 0 0 10px 0;
  color: #2d3748;
}

.example-item {
  background: white;
  padding: 10px;
  margin: 5px 0;
  border-radius: 4px;
  border-left: 3px solid #4caf50;
  cursor: pointer;
  transition: all 0.3s;
}

.example-item:hover {
  background: #f1f8e9;
  transform: translateX(5px);
}

.editable-field {
  cursor: pointer;
  color: #667eea;
  text-decoration: underline;
  text-decoration-style: dotted;
  transition: all 0.2s;
}

.editable-field:hover {
  color: #764ba2;
  background: rgba(102, 126, 234, 0.1);
  padding: 2px 4px;
  border-radius: 3px;
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
  body {
    margin: 10px auto;
    font-size: 14px;
    padding: 0 10px;
  }
  
  .container {
    padding: 15px;
    margin: 0 auto;
  }
  
  h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
  }
  
  h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
  }
  
  #map {
    height: 500px;
    margin-bottom: 15px;
  }
  
  .input-section, .free-style-section, .analysis-box {
    padding: 15px;
    margin-bottom: 20px;
  }
  
  .analysis-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .earnings-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .earnings-summary {
    padding: 20px 15px;
  }
  
  .earnings-value {
    font-size: 20px;
  }
  
  .metric-group {
    padding: 15px;
  }
  
  .route-segment {
    flex-direction: column;
    gap: 5px;
  }
  
  .segment-info {
    flex-direction: column;
    gap: 5px;
  }
  
  button {
    padding: 14px 20px;
    font-size: 16px;
  }
  
  .free-style-section button {
    flex: 1;
  }
  
  .free-style-section button:last-child {
    flex: 0 0 80px;
    padding: 14px 10px;
  }
  
  .progress-label {
    font-size: 13px;
  }
  
  .analysis-header h3 {
    font-size: 1.4rem;
  }
  
  .fuel-cost-menu, .whatsapp-examples {
    padding: 12px;
  }
}

/* Medium screens (tablets) */
@media (max-width: 768px) and (min-width: 481px) {
  .container {
    padding: 15px;
  }
  
  .analysis-grid {
    grid-template-columns: 1fr 1fr;
    gap: 15px;
  }
  
  .earnings-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  
  input, select, textarea {
    font-size: 16px;
    padding: 10px;
  }
  
  #freeStyleInput {
    min-height: 110px;
  }
  
  button {
    padding: 12px 20px;
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  body {
    margin: 5px auto;
    padding: 0 5px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .container {
    padding: 8px;
    margin: 0 auto;
  }
  
  h2 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 15px;
  }
  
  h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
  }
  
  #map {
    height: 450px;
    margin-bottom: 15px;
  }
  
  .input-section, .free-style-section, .analysis-box {
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 6px;
  }
  
  .metric-group {
    padding: 12px;
  }
  
  .earnings-summary {
    padding: 15px 10px;
  }
  
  .earnings-card {
    padding: 12px;
  }
  
    width: 90%;
  input, select, textarea {
    padding: 8px 10px;
    font-size: 16px; /* Prevents zoom on iOS */
    border-radius: 8px;
    min-height: 40px; /* Touch target size */
  }
  
  #freeStyleInput {
    min-height: 100px;
    font-size: 15px;
    line-height: 1.3;
  }
  
  button {
    padding: 14px 18px;
    font-size: 16px;
    min-height: 48px; /* Touch target size */
    border-radius: 8px;
    margin: 4px 0;
  }
  
  .theme-toggle {
    top: 8px;
    right: 8px;
    padding: 8px 12px;
    font-size: 14px;
    min-height: 44px;
  }
  
  .free-style-section button {
    flex: 1;
    margin: 0 2px;
  }
  
  .free-style-section button:last-child {
    flex: 0 0 80px;
    padding: 14px 10px;
    font-size: 14px;
  }
  
  .input-group {
    margin-bottom: 15px;
  }
  
  .input-group label {
    font-size: 15px;
    margin-bottom: 6px;
    display: block;
  }
  
  .input-group small {
    font-size: 13px;
    line-height: 1.3;
  }
  
  .analysis-grid, .earnings-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .earnings-value {
    font-size: 1.3rem;
  }
  
  .route-segment {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }
  
  .segment-info {
    flex-direction: column;
    gap: 6px;
  }

}\n\n/* Fix for iOS Safari input styling */
input[type="text"], input[type="number"], textarea {
  -webkit-appearance: none;
  appearance: none;
  border-radius: 6px;
}