/**
 * Gaspard — Carnet de tournée — Styles
 * Mobile-first, minimal, fonctionnel
 */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* === Screens === */
.screen { min-height: 100vh; }

/* === Auth === */
.auth-card {
  max-width: 360px;
  margin: 20vh auto;
  padding: 2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  text-align: center;
}
.auth-card h1 { font-size: 1.5rem; margin-bottom: 0.5rem; color: #1a73e8; }
.auth-card h2 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.auth-card p { color: #666; margin-bottom: 1.5rem; }
.error { color: #d32f2f; font-size: 0.85rem; }

/* === Buttons === */
.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}
.btn-primary { background: #1a73e8; color: white; }
.btn-primary:hover { background: #1557b0; }
.btn-secondary { background: #e0e0e0; color: #333; margin: 0.3rem; }
.btn-waze { background: #33ccff; color: white; font-size: 0.8rem; padding: 0.4rem 0.8rem; }
.btn-visited { background: #4caf50; color: white; font-size: 0.8rem; padding: 0.4rem 0.8rem; }
.btn-skipped { background: #ff9800; color: white; font-size: 0.8rem; padding: 0.4rem 0.8rem; }
.btn-icon {
  background: none; border: none; font-size: 1.2rem; cursor: pointer;
  color: white; padding: 0.3rem;
}

/* === Loading === */
#loading-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.spinner {
  width: 40px; height: 40px; border: 4px solid #e0e0e0;
  border-top-color: #1a73e8; border-radius: 50%;
  animation: spin 0.8s linear infinite; margin-bottom: 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Header === */
header {
  background: #1a73e8; color: white; padding: 0.8rem 1rem;
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 10;
}
.header-left h1 { font-size: 1.1rem; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 0.5rem; }
.user-email { font-size: 0.75rem; opacity: 0.8; }

/* === Badge === */
.badge {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px;
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
}
.badge-solving { background: #fff3e0; color: #e65100; }
.badge-solved { background: #e8f5e9; color: #2e7d32; }
.badge-error { background: #ffebee; color: #c62828; }

/* === Summary === */
.summary {
  display: flex; justify-content: space-around; padding: 0.8rem;
  background: white; margin: 0.5rem; border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.summary-item { text-align: center; }
.summary-value { font-size: 1.4rem; font-weight: 700; color: #1a73e8; display: block; }
.summary-label { font-size: 0.75rem; color: #888; }

/* === Tabs === */
.tabs {
  display: flex; overflow-x: auto; gap: 0.3rem;
  padding: 0.5rem 0.5rem 0; background: white;
  border-bottom: 1px solid #e0e0e0;
}
.tab {
  padding: 0.5rem 1rem; border: none; background: #f5f5f5;
  border-radius: 8px 8px 0 0; cursor: pointer; white-space: nowrap;
  font-size: 0.85rem; color: #666;
}
.tab.active { background: #1a73e8; color: white; }

/* === Route header === */
.route-header {
  display: flex; justify-content: space-around; padding: 0.6rem;
  background: white; margin: 0.5rem 0.5rem 0; border-radius: 8px 8px 0 0;
}
.route-stat { font-size: 0.85rem; font-weight: 600; color: #555; }

/* === Range bar === */
.range-bar {
  position: relative; height: 24px; background: #e0e0e0;
  margin: 0 0.5rem 0.5rem; border-radius: 0 0 8px 8px; overflow: hidden;
}
.range-fill {
  height: 100%; background: linear-gradient(90deg, #f44336, #ff9800, #4caf50);
  transition: width 0.5s;
}
.range-label {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 0.75rem; font-weight: 600; color: #333;
}

/* === Stop card === */
.stop-card {
  background: white; margin: 0.4rem 0.5rem; padding: 0.8rem;
  border-radius: 8px; border-left: 4px solid #1a73e8;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stop-charging { border-left-color: #ff9800; }
.stop-visited { opacity: 0.6; border-left-color: #4caf50; }
.stop-skipped { opacity: 0.5; border-left-color: #9e9e9e; text-decoration: line-through; }

.stop-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.stop-icon { font-size: 1.2rem; }
.stop-label { flex: 1; font-weight: 600; font-size: 0.9rem; }
.stop-time { font-size: 0.8rem; color: #888; white-space: nowrap; }

.stop-details {
  display: flex; gap: 1rem; font-size: 0.8rem; color: #666;
  margin-bottom: 0.5rem;
}

.stop-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.empty { text-align: center; padding: 2rem; color: #888; }

/* === PWA safe area === */
@supports (padding-top: env(safe-area-inset-top)) {
  header { padding-top: calc(0.8rem + env(safe-area-inset-top)); }
}

.leg {
  display: flex;
  align-items: center;
  padding: 4px 0 4px 24px;
  color: #888;
  font-size: 0.85em;
}
.leg-line {
  width: 2px;
  height: 20px;
  background: #ccc;
  margin-right: 12px;
  flex-shrink: 0;
}
.leg-info { white-space: nowrap; }
.departure-info {
  padding: 8px 12px;
  margin-bottom: 8px;
  background: #f0f7ff;
  border-radius: 6px;
  font-size: 0.9em;
  color: #555;
}