/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif;
  background: #fdf6ee;
  color: #3d3229;
  line-height: 1.6;
}
a { color: #e67e22; text-decoration: none; }
a:hover { text-decoration: underline; color: #d35400; }

/* ===== Navbar ===== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  background: linear-gradient(135deg, #e67e22 0%, #f39c12 50%, #e74c3c 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(230,126,34,0.3);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.nav-brand a { color: white; font-weight: 700; font-size: 1.15rem; text-decoration: none; letter-spacing: -0.01em; }
.nav-links { display: flex; align-items: center; gap: 1rem; }
.nav-links a { color: rgba(255,255,255,0.9); text-decoration: none; font-size: 0.9rem; }
.nav-links a:hover { color: white; text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: rgba(255,255,255,0.8); }
.inline-form { display: inline; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.5rem 1.1rem; border: none; border-radius: 8px;
  font-size: 0.9rem; font-weight: 500; cursor: pointer;
  text-decoration: none; transition: all 0.2s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, #e67e22, #f39c12); color: white; }
.btn-primary:hover { box-shadow: 0 4px 12px rgba(230,126,34,0.3); }
.btn-ghost { background: transparent; color: inherit; border: 1px solid #e0d5c8; }
.btn-ghost:hover { background: rgba(230,126,34,0.05); border-color: #e67e22; }
.btn-danger { background: #e74c3c; color: white; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
.btn-lg { padding: 0.7rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-active { background: #d35400 !important; color: white !important; }
.btn-icon {
  background: none; border: none; cursor: pointer; padding: 0.15rem 0.3rem;
  font-size: 0.85rem; border-radius: 6px;
}
.btn-icon:hover { background: rgba(230,126,34,0.08); }
.btn-icon.btn-danger:hover { background: #fde8e8; }

/* ===== OAuth Buttons ===== */
.btn-oauth { flex: 1; padding: 0.6rem; text-align: center; border: 1px solid #e0d5c8; border-radius: 8px; }
.btn-google { background: #fff; color: #333; }
.btn-google:hover { background: #fef9f4; }
.btn-github { background: #24292e; color: white; }
.btn-github:hover { background: #1a1e22; }
.oauth-buttons { display: flex; gap: 0.7rem; }

/* ===== Alerts ===== */
.alert {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 1.2rem; margin: 0.5rem 1.5rem;
  border-radius: 8px; font-size: 0.9rem;
  transition: opacity 0.3s;
}
.alert-success { background: #fef3e2; color: #8a6d3b; border: 1px solid #f5deb3; }
.alert-error { background: #fce4e4; color: #a94442; border: 1px solid #f5c6cb; }
.alert-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: inherit; }

/* ===== Toast ===== */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  padding: 0.7rem 1.2rem; border-radius: 10px; font-size: 0.85rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  transition: opacity 0.3s; max-width: 350px;
}
.toast-info { background: linear-gradient(135deg, #3498db, #2980b9); color: white; }
.toast-success { background: linear-gradient(135deg, #27ae60, #2ecc71); color: white; }
.toast-error { background: linear-gradient(135deg, #e74c3c, #c0392b); color: white; }

/* ===== Landing Page ===== */
.landing { min-height: calc(100vh - 56px); background: #fdf6ee; }
.hero {
  text-align: center; padding: 5rem 2rem 3rem;
  background: linear-gradient(135deg, #e67e22 0%, #f39c12 40%, #e74c3c 100%);
  color: white;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 70%, rgba(255,255,255,0.1) 0%, transparent 50%);
  animation: hero-shimmer 15s ease-in-out infinite;
}
@keyframes hero-shimmer { 0%, 100% { transform: translate(0,0); } 50% { transform: translate(3%, -3%); } }
.hero h1 { font-size: 2.5rem; margin-bottom: 0.7rem; position: relative; }
.hero-sub { font-size: 1.15rem; opacity: 0.92; margin-bottom: 2rem; position: relative; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; position: relative; }
.hero .btn-primary { background: rgba(255,255,255,0.2); backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,0.3); }
.hero .btn-primary:hover { background: rgba(255,255,255,0.3); }
.hero .btn-ghost { border-color: rgba(255,255,255,0.4); color: white; }
.features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem; padding: 3rem 2rem; max-width: 1000px; margin: 0 auto;
}
.feature-card {
  background: white; padding: 2rem 1.5rem; border-radius: 14px;
  box-shadow: 0 2px 12px rgba(210,160,90,0.1); text-align: center;
  border: 1px solid #f5e6d0;
  transition: transform 0.2s, box-shadow 0.2s;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(210,160,90,0.15); }
.feature-icon { font-size: 2.5rem; margin-bottom: 0.8rem; }
.feature-card h3 { margin-bottom: 0.5rem; color: #d35400; }
.feature-card p { font-size: 0.9rem; color: #8a7968; }

/* ===== Auth Pages ===== */
.auth-page {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 56px); padding: 2rem;
  background: linear-gradient(160deg, #fdf6ee 0%, #fef3e2 100%);
}
.auth-card {
  background: white; padding: 2.5rem; border-radius: 16px;
  box-shadow: 0 4px 24px rgba(210,160,90,0.12);
  width: 100%; max-width: 420px;
  border: 1px solid #f5e6d0;
}
.auth-card h2 { margin-bottom: 1.5rem; text-align: center; color: #d35400; }
.auth-divider {
  text-align: center; margin: 1.5rem 0; position: relative;
  color: #c4a97d; font-size: 0.85rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; position: absolute; top: 50%;
  width: 40%; height: 1px; background: #f0e0cc;
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.9rem; color: #8a7968; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.3rem; font-weight: 500; font-size: 0.85rem; color: #6b5a48; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 0.55rem 0.8rem; border: 1px solid #e0d5c8;
  border-radius: 8px; font-size: 0.9rem; font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fffcf8;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: #e67e22; box-shadow: 0 0 0 3px rgba(230,126,34,0.12);
  background: white;
}
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-actions { display: flex; gap: 0.7rem; justify-content: flex-end; margin-top: 1.5rem; }
.flex-grow { flex-grow: 1; }
.select-sm { padding: 0.3rem 0.5rem; border: 1px solid #e0d5c8; border-radius: 6px; font-size: 0.8rem; background: #fffcf8; }

/* ===== Form Page ===== */
.form-page {
  display: flex; justify-content: center; padding: 2rem;
  background: linear-gradient(160deg, #fdf6ee 0%, #fef3e2 100%);
}
.form-card {
  background: white; padding: 2rem; border-radius: 14px;
  box-shadow: 0 4px 20px rgba(210,160,90,0.1);
  width: 100%; max-width: 500px;
  border: 1px solid #f5e6d0;
}
.form-card-wide { max-width: 700px; }
.form-card h2 { margin-bottom: 1.5rem; color: #d35400; }

/* ===== Dashboard ===== */
.dashboard { padding: 2rem; max-width: 1100px; margin: 0 auto; }
.dashboard-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.dashboard-header h1 { color: #d35400; }
.trip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.2rem; }
.trip-card {
  display: block; background: white; padding: 1.5rem; border-radius: 14px;
  box-shadow: 0 2px 12px rgba(210,160,90,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none; color: inherit;
  border: 1px solid #f5e6d0;
  position: relative;
  overflow: hidden;
}
.trip-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, #e67e22, #f39c12, #e74c3c);
  opacity: 0; transition: opacity 0.2s;
}
.trip-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(210,160,90,0.15); text-decoration: none; }
.trip-card:hover::before { opacity: 1; }
.trip-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.5rem; }
.trip-card h3 { font-size: 1.1rem; color: #3d3229; }
.trip-destination { font-size: 0.85rem; color: #8a7968; margin-bottom: 0.3rem; }
.trip-dates { font-size: 0.85rem; color: #b89a6a; margin-bottom: 0.3rem; }
.trip-card-stats {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem;
}
.trip-stat {
  display: inline-flex; align-items: center; gap: 0.2rem;
  font-size: 0.75rem; color: #6b5a48; background: #fef3e2;
  padding: 0.15rem 0.5rem; border-radius: 10px;
}
.trip-card-footer { margin-top: 0.8rem; font-size: 0.8rem; color: #b89a6a; }

.trip-role-badge {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 10px;
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
}
.role-owner { background: #ffeaa7; color: #d68910; }
.role-editor { background: #d5f5e3; color: #1e8449; }
.role-viewer { background: #f0e8de; color: #8a7968; }

/* ===== Empty State ===== */
.empty-state {
  text-align: center; padding: 4rem 2rem;
  background: white; border-radius: 16px;
  box-shadow: 0 2px 12px rgba(210,160,90,0.08);
  border: 1px solid #f5e6d0;
}
.empty-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state h3 { margin-bottom: 0.5rem; color: #d35400; }
.empty-state p { color: #8a7968; margin-bottom: 1.5rem; }
.empty-hint { padding: 0.8rem; font-size: 0.85rem; color: #b89a6a; text-align: center; }

/* ===== Trip View (main page) ===== */
.trip-view { display: flex; flex-direction: column; height: calc(100vh - 56px); }
.trip-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 1rem; background: white; border-bottom: 1px solid #f0e0cc;
  min-height: 48px;
}
.trip-header-left { display: flex; align-items: center; gap: 0.7rem; }
.trip-header-left h2 { font-size: 1.1rem; color: #d35400; }
.trip-dest-badge {
  font-size: 0.8rem; color: #8a7968; background: #fef3e2;
  padding: 0.15rem 0.5rem; border-radius: 10px;
}
.trip-header-right { display: flex; align-items: center; gap: 0.7rem; }

.trip-content { display: flex; flex: 1; overflow: hidden; }

/* Sidebar */
.trip-sidebar {
  width: 380px; min-width: 320px;
  overflow-y: auto; background: #fffcf8;
  border-right: 1px solid #f0e0cc;
  padding: 0.8rem;
}
.sidebar-section { margin-bottom: 1rem; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.5rem;
}
.section-header h3 { font-size: 0.95rem; color: #d35400; }

/* Search */
.search-box { position: relative; }
.search-box input {
  width: 100%; padding: 0.5rem 0.8rem; border: 1px solid #e0d5c8;
  border-radius: 8px; font-size: 0.85rem; background: white;
}
.search-box input:focus { border-color: #e67e22; box-shadow: 0 0 0 3px rgba(230,126,34,0.1); outline: none; }
.search-results {
  position: absolute; top: 100%; left: 0; right: 0;
  background: white; border: 1px solid #e0d5c8; border-radius: 0 0 8px 8px;
  max-height: 250px; overflow-y: auto; z-index: 100;
  box-shadow: 0 4px 16px rgba(210,160,90,0.15); display: none;
}
.search-result-item { padding: 0.6rem 0.8rem; cursor: pointer; border-bottom: 1px solid #f5efe6; }
.search-result-item:hover { background: #fef8f0; }
.search-result-name { font-size: 0.85rem; color: #3d3229; }
.search-result-type { font-size: 0.7rem; color: #b89a6a; }
.search-no-results { padding: 0.8rem; text-align: center; color: #b89a6a; font-size: 0.85rem; }

/* Day Cards */
.day-card {
  background: white; border: 1px solid #f0e0cc; border-radius: 10px;
  margin-bottom: 0.6rem; overflow: hidden;
}
.day-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 0.8rem; cursor: pointer;
  background: linear-gradient(135deg, #fef8f0 0%, #fef3e2 100%);
}
.day-card-header:hover { background: linear-gradient(135deg, #fef3e2 0%, #fde8c8 100%); }
.day-title { display: flex; align-items: center; gap: 0.5rem; }
.day-title strong { font-size: 0.85rem; color: #d35400; }
.day-date { font-size: 0.75rem; color: #b89a6a; }
.day-header-actions { display: flex; align-items: center; gap: 0.3rem; }
.day-delete-btn { opacity: 0; transition: opacity 0.15s; font-size: 0.75rem; }
.day-card-header:hover .day-delete-btn { opacity: 0.6; }
.day-delete-btn:hover { opacity: 1 !important; }
.day-toggle { font-size: 0.7rem; color: #c4a97d; }
.day-subtitle { padding: 0 0.8rem 0.3rem; font-size: 0.8rem; color: #8a7968; font-style: italic; }
.day-body { padding: 0.5rem 0.8rem; }
.day-notes { font-size: 0.8rem; color: #8a7968; margin-bottom: 0.5rem; }

/* Activities */
.activity-list { display: flex; flex-direction: column; gap: 0.3rem; }
.activity-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.5rem; border-radius: 8px;
  border: 1px solid #f0e0cc; background: #fffcf8;
  font-size: 0.8rem;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.activity-item:hover { background: #fef8f0; border-color: #e8d5be; }
.activity-item.activity-highlight {
  background: #fff3e0; border-color: #e67e22;
  box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.25);
}
.activity-num {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; min-width: 22px;
  border-radius: 50%;
  background: #e74c3c; color: white;
  font-size: 0.65rem; font-weight: 700;
  line-height: 1;
}
.activity-time { font-size: 0.7rem; color: #b89a6a; min-width: 70px; }
.activity-info { flex: 1; display: flex; flex-direction: column; }
.activity-cat { font-size: 0.75rem; }
.activity-title { font-weight: 500; color: #3d3229; }
.activity-location { font-size: 0.7rem; color: #b89a6a; }

/* Accommodation waypoints in itinerary */
.acc-waypoint {
  background: linear-gradient(135deg, #eef6ff, #e3f0fd) !important;
  border-color: #b8d4f0 !important;
  border-style: dashed !important;
}
.acc-waypoint:hover { background: linear-gradient(135deg, #e3f0fd, #d0e4f7) !important; border-color: #3498db !important; }
.acc-num {
  background: #3498db !important;
}
.acc-label {
  color: #3498db !important; font-weight: 500; font-size: 0.68rem !important;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.activity-actions {
  display: flex; gap: 0.15rem; flex-shrink: 0;
  opacity: 0; transition: opacity 0.15s;
}
.activity-item:hover .activity-actions { opacity: 1; }
.activity-actions .btn-icon {
  font-size: 0.9rem; padding: 0.2rem 0.35rem; border-radius: 6px;
}
.activity-actions .btn-icon.btn-danger {
  background: none; color: #e74c3c;
}
.activity-actions .btn-icon.btn-danger:hover {
  background: #fde8e8;
}
.btn-navigate { color: #2980b9; text-decoration: none; }
.btn-navigate:hover { background: #eaf4fd !important; color: #1a6dad; text-decoration: none; }
.route-leg-nav {
  text-decoration: none; font-size: 0.85rem; margin-left: auto;
  padding: 0.1rem 0.3rem; border-radius: 4px;
  transition: background 0.15s;
}
.route-leg-nav:hover { background: #eaf4fd; text-decoration: none; }
.add-activity-btn { margin-top: 0.4rem; }

/* Drag handle for activity reordering */
.drag-handle {
  cursor: grab; color: #d4c4b0; font-size: 0.85rem;
  padding: 0 0.3rem; flex-shrink: 0; user-select: none; line-height: 1;
}
.drag-handle:hover { color: #e67e22; }
.drag-handle:active { cursor: grabbing; color: #d35400; }
.activity-item.sortable-ghost {
  opacity: 0.4; background: #fef3e2; border: 1px dashed #e67e22;
}
.activity-item.sortable-drag {
  box-shadow: 0 4px 16px rgba(230,126,34,0.2); background: #fff;
  border-color: #e67e22; opacity: 1;
}
.activity-list { min-height: 0.5rem; transition: min-height 0.15s; }

/* Route Legs */
.route-legs-list { display: flex; flex-direction: column; gap: 0.4rem; }
.route-leg {
  padding: 0.5rem 0.7rem; border: 1px solid #f0e0cc; border-radius: 10px;
  background: white; cursor: pointer; transition: all 0.15s;
}
.route-leg:hover { background: #fef8f0; border-color: #e8d5be; }
.route-leg-stops { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.25rem; }
.route-leg-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(135deg, #e67e22, #e74c3c); color: white;
  font-size: 0.65rem; font-weight: 700; flex-shrink: 0;
}
.route-leg-names { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; font-size: 0.8rem; }
.route-leg-from, .route-leg-to { font-weight: 500; color: #3d3229; }
.route-leg-arrow { color: #d4c4b0; font-size: 0.7rem; }
.route-leg-stats {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; color: #8a7968; padding-left: 1.6rem;
}
.route-leg-sep { color: #e0d5c8; font-size: 0.5rem; }
.route-legs-total {
  margin-top: 0.5rem; padding: 0.4rem 0.7rem;
  font-size: 0.8rem; color: #6b5a48; border-top: 1px solid #f0e0cc;
}

/* Accommodations */
.accommodation-item {
  padding: 0.6rem 0.8rem; border: 1px solid #f0e0cc; border-radius: 10px;
  margin-bottom: 0.5rem; background: white;
  transition: background 0.15s;
}
.accommodation-item:hover { background: #fef8f0; }
.acc-name { font-weight: 600; font-size: 0.85rem; margin-bottom: 0.2rem; color: #3d3229; }
.acc-dates { font-size: 0.75rem; color: #b89a6a; }
.acc-address { font-size: 0.75rem; color: #b89a6a; margin-top: 0.2rem; }
.acc-actions { display: flex; gap: 0.3rem; margin-top: 0.3rem; }

/* Map */
.map-area { flex: 1; position: relative; display: flex; flex-direction: column; }
.map-container { flex: 1; z-index: 1; }
.map-controls {
  position: absolute; top: 10px; right: 10px; z-index: 500;
  display: flex; gap: 0.4rem; background: white; padding: 0.4rem;
  border-radius: 10px; box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  border: 1px solid #f0e0cc;
}

/* POI Explorer */
.poi-filters {
  position: absolute; top: 50px; right: 10px; z-index: 500;
  display: flex; flex-wrap: wrap; gap: 0.3rem; max-width: 420px;
  background: white; padding: 0.5rem; border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  border: 1px solid #f0e0cc;
}
.poi-filter-btn {
  display: inline-flex; align-items: center; gap: 0.2rem;
  padding: 0.2rem 0.5rem; border: 1px solid #e0d5c8; border-radius: 12px;
  background: #fffcf8; font-size: 0.7rem; cursor: pointer;
  transition: all 0.15s; color: #6b5a48;
}
.poi-filter-btn:hover { background: #fef3e2; border-color: #e67e22; }
.poi-filter-active { background: linear-gradient(135deg, #e67e22, #f39c12); color: white; border-color: #d35400; }
.poi-filter-active:hover { background: linear-gradient(135deg, #d35400, #e67e22); }

.poi-marker { background: transparent !important; border: none !important; }
.poi-marker-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transition: transform 0.15s;
}
.poi-marker-dot:hover { transform: scale(1.2); }

/* Hover highlight marker */
.highlight-marker { background: transparent !important; border: none !important; }
.highlight-marker-dot {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 32px; height: 32px; border-radius: 50%;
  background: #e67e22; color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  border: 3px solid white;
  box-shadow: 0 3px 12px rgba(230,126,34,0.5);
  z-index: 2;
}
.highlight-marker-pulse {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(230, 126, 34, 0.3);
  animation: highlight-pulse 1s ease-out infinite;
  z-index: 1;
}
@keyframes highlight-pulse {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  100% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
}

/* Trip Info Panel */
.trip-info-panel {
  position: absolute; bottom: 50px; left: 50%; transform: translateX(-50%);
  z-index: 500; display: inline-flex; align-items: center; gap: 0.5rem;
  background: white; border-radius: 20px; padding: 0.4rem 1rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  border: 1px solid #f0e0cc;
  font-size: 0.85rem; font-weight: 500; color: #3d3229;
  white-space: nowrap;
}
.trip-info-panel--loading { opacity: 0.5; animation: trip-info-pulse 1.2s ease-in-out infinite; }
.trip-info-panel--no-route { opacity: 0.6; }
.trip-info-sep { color: #d4c4b0; font-size: 0.6rem; }
.trip-info-icon { font-size: 1.1rem; line-height: 1; }
.trip-info-stat { font-variant-numeric: tabular-nums; }
.trip-info-label { color: #8a7968; font-weight: 400; }
@keyframes trip-info-pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 0.25; } }

/* Custom map markers */
.custom-marker { background: transparent !important; border: none !important; }

/* Members */
.member-avatars { display: flex; gap: -0.3rem; }
.avatar-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #e67e22, #f39c12); color: white;
  font-size: 0.65rem; font-weight: 600;
  overflow: hidden; border: 2px solid white;
}
.avatar-sm { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.online-viewers { display: flex; gap: 0.3rem; }
.viewer-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #27ae60; border: 2px solid white;
}

/* ===== Modals ===== */
.modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2000; display: flex; align-items: center; justify-content: center;
}
.modal-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(61,50,41,0.4); backdrop-filter: blur(2px);
}
.modal-content {
  position: relative; background: white; border-radius: 16px;
  padding: 1.5rem; width: 95%; max-width: 500px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 8px 40px rgba(210,160,90,0.2);
  border: 1px solid #f0e0cc;
}
.modal-sm { max-width: 380px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-header h3 { color: #d35400; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #b89a6a; }
.modal-close:hover { color: #d35400; }

/* ===== Settings ===== */
.settings-section { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid #f0e0cc; }
.settings-section h3 { margin-bottom: 1rem; color: #d35400; }
.members-list { display: flex; flex-direction: column; gap: 0.5rem; }
.member-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem; background: #fef8f0; border-radius: 8px;
  border: 1px solid #f0e0cc;
}
.member-info { display: flex; align-items: center; gap: 0.5rem; }
.invite-form .form-row { align-items: flex-end; }
.invitation-row {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0; font-size: 0.85rem;
}
.danger-zone { border-color: #fde8e8; }
.danger-zone h3 { color: #e74c3c; }
.danger-zone p { color: #8a7968; margin-bottom: 1rem; font-size: 0.9rem; }

/* ===== Location Search in Forms ===== */
.location-search-box { position: relative; }
.location-search-box .search-results {
  position: relative; top: auto; left: auto; right: auto;
  background: #fffcf8; border: 1px solid #e0d5c8; border-radius: 0 0 8px 8px;
  max-height: 280px; overflow-y: auto; z-index: 200;
  box-shadow: 0 4px 16px rgba(210,160,90,0.15); display: none;
  margin-top: -1px;
}
.location-search-actions { margin-top: 0.3rem; }
.location-preview {
  display: flex; align-items: center; gap: 0.3rem;
  font-size: 0.8rem; color: #27ae60; margin-top: 0.3rem;
}
.location-preview-pin { font-size: 0.9rem; }

/* Plus Code badge */
.plus-code-badge {
  display: inline-block;
  font-family: monospace;
  font-size: 0.7rem;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  margin-left: 0.3rem;
  vertical-align: middle;
}
.plus-code-badge:hover {
  background: linear-gradient(135deg, #2980b9, #1a5276);
  transform: scale(1.05);
}

/* Plus Code search result */
.search-result-pluscode {
  background: #f0f7ff;
  border-left: 3px solid #3498db;
}
.search-result-pluscode:hover {
  background: #e3f0fd;
}

/* Search result group labels (Places / Points of Interest) */
.search-result-group-label {
  padding: 0.35rem 0.8rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #b89a6a;
  background: #fef8f0;
  border-bottom: 1px solid #f0e0cc;
}

/* POI search result items */
.search-result-poi {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.search-result-poi-icon {
  font-size: 0.9rem;
  line-height: 1;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #fff;
  margin-top: 0.1rem;
}
.search-result-poi-info {
  flex: 1;
  min-width: 0;
}
.poi-result-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.25rem;
}
.poi-result-link {
  font-size: 0.7rem;
  color: #e67e22;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}
.poi-result-link:hover {
  color: #d35400;
  text-decoration: underline;
}

/* ===== Invitation ===== */
.invitation-details { text-align: center; margin: 1.5rem 0; }
.invitation-details h3 { font-size: 1.3rem; margin: 0.5rem 0; color: #d35400; }

/* ===== Error Pages ===== */
.error-page { text-align: center; padding: 5rem 2rem; }
.error-page h1 { font-size: 4rem; color: #f0e0cc; }
.error-page p { color: #8a7968; margin: 1rem 0 2rem; }
.error-stack { text-align: left; background: #fef8f0; padding: 1rem; border-radius: 8px; font-size: 0.8rem; overflow-x: auto; max-width: 700px; margin: 1rem auto; border: 1px solid #f0e0cc; }

/* ===== Misc ===== */
.text-muted { color: #b89a6a; }

/* ===== Mobile Tab Bar (hidden on desktop) ===== */
.mobile-tab-bar { display: none; }
.nav-hamburger { display: none; }

/* ===== Responsive — Mobile ===== */
@media (max-width: 768px) {

  /* --- Navbar --- */
  .navbar { padding: 0 0.8rem; }
  .nav-hamburger {
    display: block; background: none; border: none; color: white;
    font-size: 1.4rem; cursor: pointer; padding: 0.3rem;
  }
  .nav-links {
    display: none; position: absolute; top: 56px; left: 0; right: 0;
    flex-direction: column;
    background: linear-gradient(135deg, #e67e22 0%, #f39c12 100%);
    padding: 0.8rem 1rem;
    gap: 0.6rem; z-index: 999; box-shadow: 0 4px 16px rgba(230,126,34,0.3);
  }
  .nav-links--open { display: flex; }
  .nav-links a, .nav-links .btn { width: 100%; text-align: center; }
  .nav-user { justify-content: center; }

  /* --- Landing page --- */
  .hero h1 { font-size: 1.8rem; }
  .hero { padding: 3rem 1.2rem 2rem; }
  .hero-sub { font-size: 1rem; }
  .hero-actions { flex-direction: column; gap: 0.7rem; }
  .features { padding: 1.5rem 1rem; gap: 1rem; }

  /* --- Auth pages --- */
  .auth-page { padding: 1rem; }
  .auth-card { padding: 1.5rem; }

  /* --- Forms --- */
  .form-row { flex-direction: column; gap: 0; }
  .form-page { padding: 1rem; }
  .form-card { padding: 1.5rem; }
  .form-group input, .form-group select, .form-group textarea { font-size: 16px; }

  /* --- Dashboard --- */
  .dashboard { padding: 1rem; }
  .dashboard-header { flex-direction: column; gap: 0.7rem; align-items: stretch; }
  .dashboard-header .btn { text-align: center; }
  .trip-grid { grid-template-columns: 1fr; gap: 0.8rem; }
  .trip-card { padding: 1.2rem; }

  /* --- Trip Header --- */
  .trip-header {
    flex-direction: column; gap: 0.4rem; align-items: stretch;
    padding: 0.5rem 0.8rem;
  }
  .trip-header-left { flex-wrap: wrap; gap: 0.4rem; }
  .trip-header-left h2 { font-size: 1rem; }
  .trip-header-right { justify-content: flex-start; flex-wrap: wrap; gap: 0.4rem; }

  /* --- Mobile Tab Bar (Plan / Map switch) --- */
  .mobile-tab-bar {
    display: flex; background: white; border-bottom: 2px solid #f0e0cc;
    position: sticky; top: 56px; z-index: 600;
  }
  .mobile-tab {
    flex: 1; padding: 0.6rem; border: none; background: white;
    font-size: 0.9rem; font-weight: 500; cursor: pointer;
    color: #b89a6a; border-bottom: 3px solid transparent;
    transition: all 0.15s;
  }
  .mobile-tab--active {
    color: #e67e22; border-bottom-color: #e67e22;
  }

  /* --- Sidebar / Map Layout --- */
  .trip-content { flex-direction: column; }
  .trip-sidebar {
    width: 100%; min-width: 0; border-right: none;
    max-height: none; overflow-y: auto;
    flex: 1;
  }
  .map-area {
    flex: 1; min-height: 400px;
  }
  .map-area { display: none; }
  .map-area.mobile-visible { display: flex; min-height: calc(100vh - 56px - 48px - 48px); }
  .trip-sidebar.mobile-hidden { display: none; }
  .map-area.mobile-hidden { display: none; }

  /* --- Day Cards --- */
  .day-card-header { padding: 0.7rem 0.8rem; }
  .day-title strong { font-size: 0.9rem; }
  .day-delete-btn { opacity: 0.5 !important; }

  /* --- Activity Items — touch-friendly --- */
  .activity-item {
    padding: 0.6rem 0.5rem; gap: 0.4rem;
    min-height: 44px;
  }
  .activity-actions { opacity: 1 !important; }
  .activity-actions .btn-icon {
    font-size: 1.05rem; padding: 0.35rem 0.45rem;
    min-width: 36px; min-height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .drag-handle {
    font-size: 1.1rem; padding: 0.2rem 0.4rem;
    min-width: 32px; min-height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .activity-time { min-width: 55px; font-size: 0.68rem; }

  /* --- Accommodation items --- */
  .accommodation-item { padding: 0.7rem 0.8rem; }
  .acc-actions .btn-icon {
    font-size: 1rem; padding: 0.3rem 0.4rem;
    min-width: 36px; min-height: 36px;
  }

  /* --- Map Controls --- */
  .map-controls {
    top: 8px; right: 8px; left: 8px;
    flex-wrap: wrap; gap: 0.3rem;
    justify-content: center;
  }
  .map-controls .btn, .map-controls .select-sm {
    font-size: 0.75rem; padding: 0.35rem 0.6rem;
  }

  /* --- POI Filters --- */
  .poi-filters {
    top: auto; bottom: 60px; right: 8px; left: 8px;
    max-width: none; justify-content: center;
  }
  .poi-filter-btn { font-size: 0.68rem; padding: 0.25rem 0.5rem; }

  /* --- Trip Info Panel --- */
  .trip-info-panel {
    bottom: 12px; left: 8px; right: 8px;
    transform: none; justify-content: center;
    font-size: 0.78rem; padding: 0.35rem 0.7rem;
    border-radius: 12px;
  }

  /* --- Modals --- */
  .modal-content {
    width: 100%; max-width: none; margin: 0.5rem;
    border-radius: 12px; padding: 1.2rem;
    max-height: calc(100vh - 1rem);
  }
  .modal { align-items: flex-end; }
  .modal-content {
    border-radius: 16px 16px 0 0; margin: 0;
    max-height: 92vh;
  }
  .modal-close { font-size: 1.8rem; padding: 0.3rem; min-width: 44px; min-height: 44px; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; justify-content: center; padding: 0.7rem; }

  /* --- Route Legs --- */
  .route-leg { padding: 0.6rem; }
  .route-leg-names { font-size: 0.75rem; }

  /* --- Search Results (dropdowns) --- */
  .search-results { max-height: 200px; }
  .location-search-box .search-results { max-height: 240px; }
  .search-result-item { padding: 0.7rem 0.8rem; min-height: 44px; }

  /* --- Toast --- */
  .toast-container { left: 0.5rem; right: 0.5rem; bottom: 1rem; }
  .toast { max-width: none; }

  /* --- Settings page --- */
  .member-row { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .invite-form .form-row { flex-direction: column; }

  /* --- Error pages --- */
  .error-page { padding: 3rem 1rem; }
  .error-page h1 { font-size: 2.5rem; }
}

/* ===== Extra small screens (< 400px) ===== */
@media (max-width: 400px) {
  .navbar { height: 48px; }
  .nav-brand a { font-size: 1rem; }
  .trip-header-left h2 { font-size: 0.9rem; }
  .trip-dest-badge { font-size: 0.7rem; }
  .day-title strong { font-size: 0.82rem; }
  .activity-item { font-size: 0.75rem; }
  .btn { font-size: 0.82rem; padding: 0.45rem 0.9rem; }
  .btn-sm { font-size: 0.75rem; }
}
