/* UK Postcode Route Planner Styles */

/* ===== MAIN LAYOUT ===== */
#map { 
  height: 400px; 
  margin-top: 5px; 
}

textarea { 
  width: 300px; 
  height: 100px; 
}

.input-section { 
  display: flex; 
  gap: 15px; 
  align-items: flex-start; 
  margin-bottom: 5px; 
}

.input-column { 
  flex: 0 0 300px; 
}

#startPoint, #endPoint { 
  border: 1px solid #ccc; 
  border-radius: 4px; 
  font-family: inherit; 
  font-size: 14px; 
}

#startPoint:focus, #endPoint:focus {
  outline: none;
  border-color: #2196F3;
  box-shadow: 0 0 5px rgba(33, 150, 243, 0.3);
}

.controls { 
  margin: 10px 0; 
}

.controls input[type="checkbox"] { 
  margin-right: 5px; 
}

/* ===== ROUTE INFO SECTIONS ===== */
.route-info { 
  background: #f0f0f0; 
  padding: 10px; 
  margin: 10px 0; 
  border-radius: 5px; 
  display: none;
}

.route-info.show { 
  display: block; 
}

.distance-comparison { 
  margin-top: 5px; 
}

.savings { 
  color: green; 
  font-weight: bold; 
}

.optimized-order {
  background: white;
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 4px;
  display: none;
  width: 300px;
  height: 229px;
  min-height: 229px;
  max-height: 400px;
  resize: vertical;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
}

.optimized-order.show { 
  display: block; 
}

.optimized-order h4 {
  margin: 0 0 8px 0;
  color: #1976D2;
  font-size: 14px;
  padding: 4px 8px;
  background: #f0f8ff;
  border-radius: 3px;
}

.postcode-list {
  background: transparent;
  padding: 0;
  border: none;
  height: 170px;
  overflow-y: auto;
  font-family: inherit;
  font-size: 12px;
  margin-bottom: 5px;
}

.copy-button {
  position: absolute;
  bottom: 5px;
  left: 5px;
  right: 5px;
  padding: 4px 12px;
  background: #2196F3;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  width: calc(100% - 10px);
}

.copy-button:hover {
  background: #1976D2;
}

/* ===== DELIVERY SETTINGS ===== */
.delivery-settings {
  transition: all 0.3s ease;
}

.delivery-settings.hidden {
  display: none;
}

/* ===== PRINTED DIRECTIONS ===== */
.printed-directions {
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-top: 10px;
}

.directions-header {
  background: #f5f5f5;
  padding: 10px 15px;
  border-bottom: 1px solid #ddd;
  cursor: pointer;
  user-select: none;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.directions-header:hover {
  background: #e9ecef;
}

.directions-content {
  display: none;
  padding: 15px;
  max-height: 400px;
  overflow-y: auto;
}

.directions-content.show {
  display: block;
}

.direction-step {
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.direction-step:last-child {
  border-bottom: none;
}

.step-number {
  background: #2196F3;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  margin-right: 12px;
  flex-shrink: 0;
}

.step-instruction {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
}

.step-distance {
  color: #666;
  font-size: 12px;
  margin-left: 10px;
  flex-shrink: 0;
}

.step-time {
  margin-left: 10px;
  text-align: right;
  min-width: 80px;
  flex-shrink: 0;
}

.segment-time {
  display: block;
  color: #666;
  font-size: 11px;
  font-weight: bold;
}

.arrival-time {
  display: block;
  color: #2196F3;
  font-size: 10px;
  margin-top: 2px;
}

.route-summary {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 15px;
}

.route-summary h4 {
  margin: 0 0 8px 0;
  color: #1976D2;
  font-size: 14px;
}

.summary-stats {
  display: flex;
  gap: 20px;
  font-size: 13px;
  font-weight: bold;
}

.total-distance {
  color: #4CAF50;
}

.total-time {
  color: #FF9800;
}

.directions-divider {
  border-bottom: 2px solid #ddd;
  margin-bottom: 10px;
}

/* ===== SHARE ROUTE SECTION ===== */
.share-route {
  background: #e3f2fd;
  border: 1px solid #90caf9;
  border-radius: 4px;
  padding: 10px;
  margin: 10px 0;
  display: none;
}

.share-route.show {
  display: block;
}

.share-link {
  background: white;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 8px;
  width: 100%;
  font-size: 12px;
  margin: 5px 0;
  word-break: break-all;
  box-sizing: border-box;
}

/* ===== SAVED ROUTES ===== */
.saved-routes-list {
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 10px;
  display: none;
}

.saved-route-item {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.saved-route-item:hover {
  background: #f5f5f5;
}

.saved-route-item:last-child {
  border-bottom: none;
}

.route-info-text {
  flex: 1;
}

.route-actions {
  display: flex;
  gap: 5px;
}

/* ===== LOADING ANIMATIONS ===== */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== ADVANCED OPTIONS MENU ===== */
.advanced-menu {
  margin: 10px 0;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
}

.advanced-menu-header {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 12px 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: background 0.3s ease;
}

.advanced-menu-header:hover {
  background: linear-gradient(135deg, #e8ecf0 0%, #b8c6db 100%);
}

.advanced-menu-title {
  font-weight: bold;
  color: #333;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.advanced-menu-arrow {
  font-size: 12px;
  color: #666;
  transition: transform 0.3s ease;
}

.advanced-menu.expanded .advanced-menu-arrow {
  transform: rotate(90deg);
}

.advanced-menu-content {
  display: none;
  padding: 15px;
  background: #fafbfc;
  border-top: 1px solid #e1e5e9;
}

.advanced-menu.expanded .advanced-menu-content {
  display: block;
}

/* ===== PRINT STYLES ===== */
@media print {
  .printed-directions {
    border: none;
    box-shadow: none;
  }
  
  .directions-header {
    background: none !important;
    border: none;
  }
  
  .directions-content {
    display: block !important;
    max-height: none;
    padding: 0;
  }
}

/* ===== MOBILE RESPONSIVE DESIGN ===== */

/* Mobile-first approach - Small screens (phones) */
@media screen and (max-width: 768px) {
  
  body {
    margin: 0;
    padding: 10px;
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  h2 {
    font-size: 1.4em;
    margin: 10px 0;
    text-align: center;
  }
  
  /* Stack layout vertically on mobile */
  .input-section {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  
  .input-column {
    flex: 1;
    min-width: 0;
    width: 100%;
  }
  
  /* Full-width inputs and textareas */
  textarea, 
  #startPoint, 
  #endPoint,
  .share-link {
    width: 100% !important;
    box-sizing: border-box;
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 12px;
    min-height: 44px; /* Touch target size */
  }
  
  textarea {
    height: 120px;
    resize: vertical;
  }
  
  /* Mobile-friendly buttons */
  button {
    min-height: 44px !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
    margin: 4px 2px !important;
    border-radius: 6px;
    border: none;
    background: #2196F3;
    color: white;
    cursor: pointer;
    touch-action: manipulation; /* Prevent double-tap zoom */
  }
  
  button:active {
    transform: scale(0.98);
    background: #1976D2;
  }
  
  /* Delivery settings on mobile */
  .delivery-settings {
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
  }
  
  .delivery-settings label {
    display: block;
    margin: 8px 0;
    font-size: 14px;
  }
  
  .delivery-settings select,
  .delivery-settings input {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border-radius: 4px;
    border: 1px solid #ccc;
    box-sizing: border-box;
  }
  
  /* Mobile map sizing */
  #map {
    height: 50vh !important;
    min-height: 300px;
    margin: 10px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }
  
  /* Route info sections */
  .route-info,
  .optimized-order,
  .share-route {
    width: 100% !important;
    box-sizing: border-box;
    margin: 10px 0;
    padding: 15px;
    border-radius: 8px;
  }
  
  .optimized-order {
    height: auto !important;
    max-height: 300px;
    min-height: 150px;
  }
  
  /* Mobile table styling */
  table {
    width: 100%;
    font-size: 12px;
    overflow-x: auto;
    display: block;
    white-space: nowrap;
  }
  
  table thead,
  table tbody,
  table tr {
    display: table;
    width: 100%;
    table-layout: fixed;
  }
  
  /* Printed directions for mobile */
  .printed-directions {
    font-size: 14px;
    line-height: 1.4;
  }
  
  .printed-directions ol {
    padding-left: 20px;
  }
  
  .printed-directions li {
    margin: 8px 0;
    word-wrap: break-word;
  }
  
  /* Status messages */
  .status-message {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    max-width: 90vw;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 14px;
    text-align: center;
  }
  
  /* Loading overlay for mobile */
  .loading-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
  }
  
  .loading-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 90vw;
  }
  
  /* Hide/adjust elements for mobile */
  .controls {
    margin: 15px 0;
  }
  
  .controls label {
    display: block;
    margin: 10px 0;
    font-size: 14px;
  }
  
  /* Advanced menu mobile styles */
  .advanced-menu-header {
    padding: 15px;
    font-size: 16px;
  }
  
  .advanced-menu-content {
    padding: 20px 15px;
  }
  
  .delivery-settings {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
  
  .delivery-settings div {
    width: 100%;
  }
  
  .delivery-settings select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
  }
}

/* Tablet styles */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  
  .input-section {
    flex-direction: column;
    gap: 15px;
  }
  
  .input-column {
    width: 100%;
  }
  
  textarea,
  #startPoint,
  #endPoint {
    width: 100%;
    box-sizing: border-box;
  }
  
  #map {
    height: 60vh;
    min-height: 400px;
  }
  
  .optimized-order {
    width: 100%;
  }
}

/* Large screens - keep existing layout */
@media screen and (min-width: 1025px) {
  /* Existing desktop styles remain unchanged */
}

