:root {
  --bg: #050810;
  --surface: #0f172a;
  --surface-light: #1e293b;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.4);
  --secondary: #6366f1;
  --accent: #8b5cf6;
  --danger: #ef4444;
  --success: #10b981;
  --radius-xl: 32px;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-display: 'Outfit', sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-main);
  color: var(--text);
  background: var(--bg);
  background-image: 
    radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 40%);
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1rem;
  line-height: 1.6;
}

.page {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 3rem 2rem;
  border-radius: var(--radius-xl);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    inset 0 1px 1px rgba(255, 255, 255, 0.05);
  width: 100%;
  max-width: 900px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Branding */
.brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3.5rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08);
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--primary);
}

.login-link {
  font-family: var(--font-display);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 16px;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s;
}

.login-link:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.brand-header.compact {
  margin-bottom: 1.5rem;
  flex-direction: row;
  justify-content: center;
  gap: 0.75rem;
}

.brand-header.compact .logo-icon {
  font-size: 1.8rem;
  margin: 0;
}

.brand-header.compact .brand-name {
  font-size: 1.8rem;
}

.logo-icon {
  font-size: 3.5rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 15px var(--primary-glow));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.brand-name {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.04em;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Components */
button {
  font-family: var(--font-main);
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  padding: 1rem 2rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-glow);
  filter: brightness(1.1);
}

button:active {
  transform: scale(0.98);
}

button.secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  box-shadow: none;
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Form Styles */
.route-form {
  display: grid;
  gap: 2rem;
}

.address-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.user-entry {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative;
  transition: all 0.3s ease;
}

.user-entry:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(59, 130, 246, 0.2);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
}

.field span {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

input[type="text"],
input[type="number"],
input[type="time"] {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text);
  padding: 1rem 1.25rem;
  font-size: 1rem;
  width: 100%;
  transition: all 0.3s ease;
  font-family: inherit;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.user-options {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
}

.flex-row-field {
  flex-direction: row !important;
  align-items: center;
  gap: 1rem;
}

.short-input {
  width: 80px !important;
  text-align: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s;
}

.checkbox-label:hover {
  color: var(--text);
}

input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  transition: all 0.3s;
}

input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
}

/* Specific styling for Time Picker */
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
  opacity: 0.6;
}

input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.big-input {
  background: rgba(255, 255, 255, 0.07) !important;
  color: var(--text) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.big-input:focus {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: var(--primary) !important;
}

.delete-user-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 36px;
  height: 36px;
  padding: 0;
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-radius: 50%;
  box-shadow: none;
}

.delete-user-btn:hover {
  background: var(--danger);
  color: white;
}

/* Autocomplete suggestions */
.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  margin-top: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  z-index: 2000;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

.suggestions.open {
  display: block;
}

.suggestion-item {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 1rem;
  text-align: left;
  font-size: 0.9rem;
  border-radius: 0;
  box-shadow: none;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.suggestion-item:hover {
  background: rgba(255, 255, 255, 0.05);
  filter: none;
  transform: none;
}

/* Actions */
.route-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

/* Map */
.map {
  margin-top: 3rem;
  height: 500px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

/* Progress bar */
.progress-container {
  margin-top: 1.5rem;
  height: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(to right, var(--primary), var(--accent));
  width: 0%;
  transition: width 0.3s ease;
}

/* Results Table */
.route-results {
  margin-top: 2.5rem;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.05);
  overflow: hidden;
}

.route-table {
  width: 100%;
  border-collapse: collapse;
}

.route-table th {
  background: rgba(255,255,255,0.02);
  padding: 1.25rem 1.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: left;
}

.route-table td {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.route-table tr.best {
  background: rgba(59, 130, 246, 0.05);
}

.best-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: 100px;
  margin-bottom: 0.5rem;
}

/* External Link Buttons */
.gmaps-btn, .osm-btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.gmaps-btn { background: rgba(59, 130, 246, 0.1); color: #60a5fa; }
.osm-btn { background: rgba(16, 185, 129, 0.1); color: #34d399; }

.gmaps-btn.btn-full {
  background: linear-gradient(135deg, #4285F4, #34A853) !important;
  color: white !important;
  border: none !important;
  box-shadow: 0 4px 15px rgba(66, 133, 244, 0.3) !important;
}

.waze-btn.btn-full {
  background: linear-gradient(135deg, #33ccff, #2ab1e3) !important;
  color: white !important;
  border: none !important;
  box-shadow: 0 4px 15px rgba(51, 204, 255, 0.3) !important;
}

/* New Navigation Buttons Group */
.nav-buttons-group {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.btn-nav {
  flex: 1;
  padding: 1rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.btn-nav.gmaps-btn {
  background: linear-gradient(135deg, #4285F4, #34A853);
  color: white;
}

.btn-nav.waze-btn {
  background: linear-gradient(135deg, #33ccff, #2ab1e3);
  color: white;
}

.user-greeting {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.pickup-info {
  font-size: 1.1rem;
  color: var(--text);
  line-height: 1.4;
}

.gmaps-btn:hover { background: var(--primary); color: white; }
.osm-btn:hover { background: var(--success); color: white; }

/* Mobile Flow Styles */
.step-container {
  display: none;
  animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-container.active {
  display: block;
}

@keyframes slideIn {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.mobile-card {
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  margin-top: 1rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.mobile-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

#status-msg {
  min-height: 1.5rem;
  transition: all 0.3s ease;
  padding: 0 1rem;
}

.big-input {
  font-family: var(--font-display) !important;
  font-size: 1.25rem !important;
  padding: 1.25rem 1.5rem !important;
  border-radius: var(--radius-md) !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.btn-full {
  width: 100%;
  margin-top: 1rem;
  font-size: 1.1rem;
  padding: 1.2rem;
}

.whatsapp-btn {
  background: linear-gradient(135deg, #25d366, #128c7e) !important;
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3) !important;
  border: none !important;
}

.summary-item {
  margin-bottom: 1.25rem;
  padding: 1.25rem;
  border-left: 4px solid var(--primary);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.summary-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.summary-val {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.participants-list {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.participant-tag {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 100px;
  font-size: 0.9rem;
}

.participant-tag.is-driver {
  border: 1px solid var(--primary-glow);
  background: rgba(59, 130, 246, 0.1);
}

/* Base Responsive Fixes */
@media (max-width: 768px) {
  .page { padding: 1.5rem 1rem; }
  .brand-name { font-size: clamp(2rem, 10vw, 2.5rem); }
  .user-options { gap: 1rem; }
  .route-actions { flex-direction: column; }
  .route-actions button { width: 100%; }
  .route-results { overflow-x: auto; }
}

.hidden { display: none !important; }

/* --- PROFIL & OVERLAY --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center; /* Centré par défaut */
    padding: 20px;
}

.profile-card {
    background: #1a1b1e;
    width: 100%;
    max-width: 500px;
    padding: 32px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1);
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
}

.history-list {
    margin: 16px 0;
}

.history-item {
  background: rgba(255,255,255,0.03);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 4px solid var(--primary);
}

.history-info strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.history-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-view-pool {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 100px;
    font-size: 0.8rem;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s;
}

.btn-view-pool:hover {
    background: var(--primary);
    color: white;
}

.btn-logout {
    display: block;
    text-align: center;
    padding: 1rem;
    color: #ff4d4d;
    text-decoration: none;
    font-weight: 700;
    margin-top: 1.5rem;
    background: rgba(255, 77, 77, 0.05);
    border-radius: var(--radius-md);
}

.auth-header {
  display: flex;
  justify-content: flex-end;
  padding: 0.5rem;
}

.auth-user {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    background: rgba(255,255,255,0.05);
    padding: 4px 12px 4px 4px;
    border-radius: 100px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.2s;
}

.auth-user:hover {
    background: rgba(255,255,255,0.1);
}

.auth-user img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.auth-user span {
    font-weight: 600;
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .overlay {
        align-items: flex-end;
        padding: 0;
    }
    .profile-card {
        border-radius: 24px 24px 0 0;
        max-height: 90vh;
        animation: slideUp 0.3s ease-out;
    }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Shortcuts */
.address-shortcuts {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.btn-shortcut {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  padding: 0.6rem 1rem;
  border-radius: 100px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

.btn-shortcut:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.btn-icon-shortcut {
    position: absolute;
    right: 0;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.btn-icon-shortcut:hover {
    background: rgba(255,255,255,0.1);
    transform: rotate(180deg);
}

.btn-full.success {
    background: var(--success);
    color: white;
    border: none;
}

.btn-full.success:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}
