/**
 * Mobile UX Improvements for O-Analyse
 * Addresses: touch targets, bottom nav, skeleton loading, pull-to-refresh
 */

:root {
  --state-subtle-text-light: #5b6472;
  --state-subtle-text-dark: #9ca3af;
  --state-accent-text-light: var(--color-primary-accessible, #b45309);
  --state-accent-text-dark: var(--color-primary, #f27f0d);
  --state-success-text-light: #047857;
  --state-success-text-dark: #86efac;
}

/* ============================================
   0. FLATPICKR CUSTOMIZATION
   ============================================ */

/* Make Flatpickr more touch-friendly */
.flatpickr-calendar {
  font-family: inherit;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  padding: 8px;
}

.flatpickr-day {
  min-width: 44px;
  min-height: 44px;
  line-height: 44px;
  border-radius: 8px;
  font-size: 0.9375rem;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
  background: var(--color-primary, #f2b705);
  border-color: var(--color-primary, #f2b705);
}

.flatpickr-day:hover {
  background: rgba(242, 183, 5, 0.2);
}

.flatpickr-months {
  padding: 8px 0;
}

.flatpickr-current-month {
  font-size: 1.125rem;
  font-weight: 600;
}

.flatpickr-prev-month,
.flatpickr-next-month {
  padding: 8px;
}

.flatpickr-prev-month svg,
.flatpickr-next-month svg {
  width: 14px;
  height: 14px;
}

/* Dark mode for Flatpickr */
.dark .flatpickr-calendar {
  background: #1C160E;
  border-color: #3a2d21;
}

.dark .flatpickr-day {
  color: #f8f7f5;
}

.dark .flatpickr-day:hover {
  background: rgba(242, 183, 5, 0.3);
}

.dark .flatpickr-day.prevMonthDay,
.dark .flatpickr-day.nextMonthDay {
  color: var(--state-subtle-text-dark, #9ca3af);
}

.dark .flatpickr-months .flatpickr-month,
.dark .flatpickr-current-month .flatpickr-monthDropdown-months,
.dark .flatpickr-current-month input.cur-year {
  color: #f8f7f5;
  fill: #f8f7f5;
}

.dark .flatpickr-weekday {
  color: #9ca3af;
}

/* Mobile optimizations */
@media (max-width: 640px) {
  .flatpickr-calendar {
    width: calc(100vw - 32px) !important;
    max-width: 340px;
  }
  
  .flatpickr-day {
    max-width: 44px;
  }
}

/* ============================================
   1. TOUCH TARGETS - Minimum 44x44px (Apple HIG)
   ============================================ */

/* Ensure all interactive elements have minimum touch size */
.touch-target {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Action buttons in cards and lists */
.action-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.action-btn:active {
  background-color: rgba(0, 0, 0, 0.1);
}

.dark .action-btn:active {
  background-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   2. BOTTOM NAVIGATION
   ============================================ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.dark .bottom-nav {
  background: #221910;
  border-top-color: #3a3a3a;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 48px;
  padding: 4px 12px;
  color: var(--state-subtle-text-light, #5b6472);
  text-decoration: none;
  transition: color 0.2s ease;
  border-radius: 8px;
}

.bottom-nav-item:active {
  background-color: rgba(var(--primary-rgb, 242, 127, 13), 0.1);
}

/* This file is loaded after build.css, so `.bottom-nav-item { display: flex }`
   wins over Tailwind's `.hidden` at equal specificity and a nav entry meant to
   be hidden stays visible. Feature-flagged entries rely on `hidden`, so the
   utility has to be given back its precedence. */
.bottom-nav-item.hidden {
  display: none;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
  color: var(--state-accent-text-light, var(--color-primary-accessible, #b45309));
  font-weight: 600;
}

.dark .bottom-nav-item {
  color: var(--state-subtle-text-dark, #9ca3af);
}

.dark .bottom-nav-item.active,
.dark .bottom-nav-item:hover {
  color: var(--state-accent-text-dark, var(--color-primary, #f27f0d));
}

.bottom-nav-item .material-symbols-outlined {
  font-size: 24px;
  margin-bottom: 2px;
}

.bottom-nav-item span:last-child {
  font-size: 10px;
  font-weight: 500;
}

/* Adjust main content when bottom nav is present */
body.has-bottom-nav {
  padding-bottom: calc(60px + env(safe-area-inset-bottom));
}

/* The nav carries Tailwind's `md:hidden`, but this unlayered file beats the
   layered utility (`.bottom-nav { display: flex }` above), so the desktop
   breakpoint is restated here, padding included. */
@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }

  body.has-bottom-nav {
    padding-bottom: 0;
  }
}

/* ============================================
   3. FLOATING ACTION BUTTON (FAB)
   ============================================ */

.fab {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary-accessible, #b45309);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(var(--primary-accessible-rgb, 180, 83, 9), 0.4);
  z-index: 999;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  border: none;
}

.fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(var(--primary-accessible-rgb, 180, 83, 9), 0.5);
}

.fab:active {
  transform: scale(0.95);
}

.fab .material-symbols-outlined {
  font-size: 24px;
}

/* Hide FAB when bottom nav not visible (desktop) */
@media (min-width: 768px) {
  .fab.mobile-only {
    display: none;
  }
}

/* ============================================
   4. SKELETON LOADING
   ============================================ */

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.dark .skeleton {
  background: linear-gradient(90deg, #3a3a3a 25%, #4a4a4a 50%, #3a3a3a 75%);
  background-size: 200% 100%;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-text.sm {
  width: 60%;
}

.skeleton-text.md {
  width: 80%;
}

.skeleton-text.lg {
  width: 100%;
}

.skeleton-card {
  padding: 16px;
  border-radius: 8px;
  background: white;
  border: 1px solid #e5e7eb;
}

.dark .skeleton-card {
  background: #1C160E;
  border-color: #3a3a3a;
}

/* ============================================
   5. STEPPER COMPONENT (Import Flow)
   ============================================ */

.stepper-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.stepper-step:hover:not(.disabled) {
  opacity: 0.8;
}

.stepper-step.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Step circle */
.stepper-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  border: 2px solid #d1d5db;
  background: white;
  color: #6b7280;
}

.dark .stepper-circle {
  border-color: #4b5563;
  background: #1f2937;
  color: #9ca3af;
}

/* Active step */
.stepper-step.active .stepper-circle {
  border-color: var(--color-primary-accessible, #b45309);
  background: var(--color-primary-accessible, #b45309);
  color: white;
  box-shadow: 0 0 0 4px rgba(var(--primary-accessible-rgb, 180, 83, 9), 0.2);
}

.dark .stepper-step.active .stepper-circle {
  box-shadow: 0 0 0 4px rgba(var(--primary-accessible-rgb, 180, 83, 9), 0.3);
}

/* Completed step */
.stepper-step.completed .stepper-circle {
  border-color: #15803d;
  background: #15803d;
  color: white;
}

/* Step label */
.stepper-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--state-subtle-text-light, #5b6472);
  transition: color 0.2s ease;
  text-align: center;
  max-width: 80px;
}

.dark .stepper-label {
  color: var(--state-subtle-text-dark, #9ca3af);
}

.stepper-step.active .stepper-label {
  color: var(--state-accent-text-light, var(--color-primary-accessible, #b45309));
  font-weight: 600;
}

.stepper-step.completed .stepper-label {
  color: var(--state-success-text-light, #15803d);
}

.dark .stepper-step.active .stepper-label {
  color: var(--state-accent-text-dark, var(--color-primary, #f27f0d));
}

.dark .stepper-step.completed .stepper-label {
  color: var(--state-success-text-dark, #86efac);
}

/* Progress line */
.stepper-progress-line {
  position: absolute;
  top: 18px;
  left: 15%;
  right: 15%;
  height: 3px;
  background: #e5e7eb;
  border-radius: 2px;
  z-index: 0;
}

.dark .stepper-progress-line {
  background: #374151;
}

.stepper-progress-fill {
  position: absolute;
  top: 18px;
  left: 15%;
  height: 3px;
  background: #16a34a;
  border-radius: 2px;
  z-index: 0;
  transition: width 0.3s ease;
}

/* Mobile optimizations */
@media (max-width: 400px) {
  .stepper-circle {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  
  .stepper-label {
    font-size: 10px;
    max-width: 60px;
  }
  
  .stepper-progress-line,
  .stepper-progress-fill {
    top: 16px;
  }
}

/* ============================================
   6. PULL TO REFRESH
   ============================================ */

.pull-to-refresh-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  background: white;
  padding: 12px 20px;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1001;
  transition: transform 0.3s ease;
}

.dark .pull-to-refresh-indicator {
  background: #221910;
}

.pull-to-refresh-indicator.visible {
  transform: translateX(-50%) translateY(16px);
}

.pull-to-refresh-indicator .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #f27f0d;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   6. SWIPE ACTIONS (Cards)
   ============================================ */

.swipeable-card {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}

.swipeable-card-content {
  position: relative;
  background: white;
  z-index: 1;
  transition: transform 0.2s ease;
}

.dark .swipeable-card-content {
  background: #1C160E;
}

.swipeable-card-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  background: #ef4444;
  padding: 0 20px;
}

.swipeable-card-actions button {
  color: white;
  padding: 12px;
}

/* ============================================
   7. MOBILE MENU (Slide Drawer)
   ============================================ */

.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: white;
  z-index: 1001;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
}

.dark .mobile-drawer {
  background: #221910;
}

.mobile-drawer.open {
  transform: translateX(0);
}

.mobile-drawer-header {
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dark .mobile-drawer-header {
  border-bottom-color: #3a3a3a;
}

.mobile-drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  color: #374151;
  text-decoration: none;
  transition: background-color 0.2s ease;
  min-height: 52px;
}

.dark .mobile-drawer-item {
  color: #d1d5db;
}

.mobile-drawer-item:active,
.mobile-drawer-item:hover {
  background-color: rgba(242, 127, 13, 0.1);
}

.mobile-drawer-item.active {
  color: var(--state-accent-text-light, var(--color-primary-accessible, #b45309));
  background-color: rgba(242, 127, 13, 0.1);
  font-weight: 600;
}

.dark .mobile-drawer-item.active {
  color: var(--state-accent-text-dark, var(--color-primary, #f27f0d));
}

/* ============================================
   8. TOAST NOTIFICATIONS (Mobile Optimized)
   ============================================ */

#toast-container {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  left: 16px;
  right: 16px;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

@media (min-width: 768px) {
  #toast-container {
    bottom: 24px;
    left: auto;
    right: 24px;
    max-width: 380px;
  }
}

.toast {
  background: white;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toast-slide-up 0.3s ease-out;
  pointer-events: auto;
}

.dark .toast {
  background: #2d2d2d;
}

.toast.success {
  border-left: 4px solid #22c55e;
}

.toast.error {
  border-left: 4px solid #ef4444;
}

.toast.warning {
  border-left: 4px solid #f59e0b;
}

@keyframes toast-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   9. FORM INPUTS (Mobile Optimized)
   ============================================ */

/* Larger touch targets for form inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="date"],
input[type="number"],
textarea,
select {
  min-height: 48px;
  font-size: 16px; /* Prevents iOS zoom on focus */
}

/* Better focus states for mobile */
input:focus,
textarea:focus,
select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(242, 127, 13, 0.3);
  border-color: #f27f0d;
}

/* ============================================
   10. MOBILE-SPECIFIC UTILITIES
   ============================================ */

/* Hide on mobile */
@media (max-width: 767px) {
  .hide-mobile {
    display: none !important;
  }
}

/* Show only on mobile */
@media (min-width: 768px) {
  .show-mobile-only {
    display: none !important;
  }
}

/* Safe area spacing */
.pb-safe {
  padding-bottom: env(safe-area-inset-bottom);
}

.pt-safe {
  padding-top: env(safe-area-inset-top);
}

/* Haptic feedback hint (visual) */
.haptic-feedback:active {
  transform: scale(0.97);
  transition: transform 0.1s ease;
}

/* Prevent text selection on interactive elements */
.no-select {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Smooth momentum scrolling on iOS */
.scroll-smooth {
  -webkit-overflow-scrolling: touch;
  overflow-y: auto;
}

/* ============================================
   11. ANALYSIS PAGE MOBILE LAYOUT
   ============================================ */

@media (max-width: 1023px) {
  /* Stack map and content vertically on mobile */
  .analysis-layout-mobile {
    display: flex;
    flex-direction: column-reverse;
  }
  
  /* Map takes full width and fixed height on mobile */
  .analysis-map-mobile {
    width: 100%;
    height: 250px;
    position: sticky;
    top: 64px;
    z-index: 10;
  }
  
  /* Expandable map on mobile */
  .analysis-map-mobile.expanded {
    height: 80vh;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
  }
  
  /* Content area scrolls below map */
  .analysis-content-mobile {
    width: 100%;
    min-height: calc(100vh - 250px - 64px);
  }
  
  /* Horizontal scrolling tabs on mobile */
  .tabs-scroll-mobile {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 4px;
    padding-bottom: 8px;
  }
  
  .tabs-scroll-mobile::-webkit-scrollbar {
    display: none;
  }
  
  .tabs-scroll-mobile .tab-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 10px 16px;
  }
}

/* ============================================
   12. CARD CONTEXT MENU
   ============================================ */

.card-menu-trigger {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #6b7280;
  transition: background-color 0.2s ease;
}

.card-menu-trigger:hover,
.card-menu-trigger:active {
  background: rgba(0, 0, 0, 0.05);
}

.dark .card-menu-trigger:hover,
.dark .card-menu-trigger:active {
  background: rgba(255, 255, 255, 0.1);
}

.card-context-menu {
  position: absolute;
  top: 44px;
  right: 8px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  min-width: 160px;
  z-index: 100;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.95) translateY(-8px);
  transform-origin: top right;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.dark .card-context-menu {
  background: #2d2d2d;
}

.card-context-menu.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
}

.card-context-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #374151;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 14px;
}

.dark .card-context-menu-item {
  color: #d1d5db;
}

.card-context-menu-item:hover {
  background: #f3f4f6;
}

.dark .card-context-menu-item:hover {
  background: #3a3a3a;
}

.card-context-menu-item.danger {
  color: #ef4444;
}

.card-context-menu-item.danger:hover {
  background: #fef2f2;
}

.dark .card-context-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.card-context-menu-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 4px 0;
}

.dark .card-context-menu-divider {
  background: #3a3a3a;
}

/* ============================================
   13. INLINE FORM VALIDATION
   ============================================ */

/* Input wrapper for validation states */
.input-wrapper {
  position: relative;
}

/* Validation icon inside input */
.input-wrapper .validation-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.input-wrapper.has-icon input {
  padding-right: 40px;
}

.input-wrapper.valid .validation-icon.valid-icon {
  opacity: 1;
  color: #16a34a;
}

.input-wrapper.invalid .validation-icon.invalid-icon {
  opacity: 1;
  color: #dc2626;
}

/* Input states */
.input-wrapper.valid input {
  border-color: #16a34a !important;
}

.input-wrapper.valid input:focus {
  border-color: #16a34a !important;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.input-wrapper.invalid input {
  border-color: #dc2626 !important;
}

.input-wrapper.invalid input:focus {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

/* Inline error message */
.field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 13px;
  color: #dc2626;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.2s ease, max-height 0.2s ease, margin 0.2s ease;
}

.field-error.visible {
  opacity: 1;
  max-height: 30px;
}

.dark .field-error {
  color: #f87171;
}

.field-error .material-symbols-outlined {
  font-size: 16px;
}

/* Field hint (help text) */
.field-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 12px;
  color: #6b7280;
  transition: opacity 0.2s ease;
}

.dark .field-hint {
  color: #9ca3af;
}

.input-wrapper.invalid .field-hint {
  opacity: 0.5;
}

/* Password strength indicator */
.password-strength {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.password-strength-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: #e5e7eb;
  transition: background-color 0.3s ease;
}

.dark .password-strength-bar {
  background: #374151;
}

.password-strength.weak .password-strength-bar:nth-child(1) {
  background: #dc2626;
}

.password-strength.medium .password-strength-bar:nth-child(1),
.password-strength.medium .password-strength-bar:nth-child(2) {
  background: #f59e0b;
}

.password-strength.strong .password-strength-bar:nth-child(1),
.password-strength.strong .password-strength-bar:nth-child(2),
.password-strength.strong .password-strength-bar:nth-child(3) {
  background: #16a34a;
}

.password-strength.very-strong .password-strength-bar {
  background: #16a34a;
}

.password-strength-text {
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
}

.password-strength.weak .password-strength-text { color: #dc2626; }
.password-strength.medium .password-strength-text { color: #f59e0b; }
.password-strength.strong .password-strength-text { color: #16a34a; }
.password-strength.very-strong .password-strength-text { color: #16a34a; }

/* Shake animation for invalid submit */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.shake {
  animation: shake 0.4s ease-in-out;
}

/* ============================================
   14. SWIPE GESTURES FOR COURSE CARDS
   ============================================ */

/* Swipeable card container */
.swipe-container {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  margin-bottom: 12px;
}

/* Background actions revealed on swipe */
.swipe-actions {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.swipe-actions.left {
  left: 0;
  background: linear-gradient(90deg, #16a34a 0%, #22c55e 100%);
  justify-content: flex-start;
}

.swipe-actions.right {
  right: 0;
  background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
  justify-content: flex-end;
}

.swipe-actions.visible {
  opacity: 1;
}

.swipe-action-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: white;
  min-width: 70px;
}

.swipe-action-content .material-symbols-outlined {
  font-size: 28px;
}

.swipe-action-content span:last-child {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* The actual swipeable card */
.swipe-card {
  position: relative;
  background: white;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  touch-action: pan-y pinch-zoom;
  will-change: transform;
  z-index: 2;
}

.dark .swipe-card {
  background: #1C160E;
}

/* When actively swiping, remove transition for immediate response */
.swipe-card.swiping {
  transition: none;
}

/* Snap back animation */
.swipe-card.snap-back {
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Action triggered state */
.swipe-card.action-triggered {
  transition: transform 0.25s ease-out;
}

/* Swipe hint animation (first time users) */
@keyframes swipe-hint {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-20px); }
  50% { transform: translateX(0); }
  75% { transform: translateX(20px); }
}

.swipe-card.show-hint {
  animation: swipe-hint 1.5s ease-in-out;
}

/* Visual feedback during swipe */
.swipe-container.swiping-left .swipe-actions.right {
  opacity: 1;
}

.swipe-container.swiping-right .swipe-actions.left {
  opacity: 1;
}

/* Haptic-like visual feedback when threshold reached */
.swipe-action-content.threshold-reached {
  transform: scale(1.1);
  transition: transform 0.15s ease;
}

/* Hide swipe on desktop */
@media (min-width: 768px) {
  .swipe-container {
    margin-bottom: 0;
  }
  
  .swipe-actions {
    display: none;
  }
  
  .swipe-card {
    transform: none !important;
  }
}

/* ============================================
   15. ANIMATED CONFIRMATION CHECKMARK
   ============================================ */

/* Success animation overlay */
.success-animation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.success-animation-overlay.visible {
  opacity: 1;
  visibility: visible;
}

/* Checkmark container */
.success-checkmark {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: #22c55e;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0);
  animation: checkmark-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes checkmark-pop {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* Animated checkmark SVG */
.success-checkmark svg {
  width: 50px;
  height: 50px;
  stroke: white;
  stroke-width: 3;
  fill: none;
}

.success-checkmark .checkmark-path {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: checkmark-draw 0.4s ease-out 0.3s forwards;
}

@keyframes checkmark-draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* Success message below checkmark */
.success-message {
  margin-top: 20px;
  color: white;
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  animation: success-text-appear 0.3s ease-out 0.6s forwards;
}

@keyframes success-text-appear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Confetti particles (optional decoration) */
.confetti-container {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--color, #f2b705);
  animation: confetti-fall 1s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(150px) rotate(720deg);
    opacity: 0;
  }
}

/* ============================================
   16. ENHANCED PROGRESS BAR WITH PERCENTAGE
   ============================================ */

.progress-container {
  width: 100%;
  margin: 1rem 0;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.progress-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.dark .progress-label {
  color: #d1d5db;
}

.progress-percentage {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-primary, #f2b705);
}

.progress-track {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.dark .progress-track {
  background: #374151;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f2b705 0%, #f59e0b 100%);
  border-radius: 9999px;
  transition: width 0.3s ease-out;
  position: relative;
}

/* Animated shimmer effect during loading */
.progress-fill.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Progress steps indicator */
.progress-steps {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.dark .progress-steps {
  color: #9ca3af;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.progress-step.completed {
  color: #22c55e;
}

.progress-step.active {
  color: var(--color-primary, #f2b705);
  font-weight: 600;
}

/* ============================================
   17. GPX PREVIEW MAP (MOBILE)
   ============================================ */

.gpx-preview-container {
  margin-top: 1rem;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #e5e7eb;
  background: #f9fafb;
}

.dark .gpx-preview-container {
  border-color: #374151;
  background: #1f2937;
}

.gpx-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
}

.dark .gpx-preview-header {
  background: #111827;
  border-bottom-color: #374151;
}

.gpx-preview-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dark .gpx-preview-title {
  color: #e5e7eb;
}

.gpx-preview-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.dark .gpx-preview-stats {
  color: #9ca3af;
}

.gpx-preview-stat {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.gpx-preview-map {
  height: 200px;
  width: 100%;
}

/* Expand button for fullscreen */
.gpx-preview-expand {
  padding: 0.5rem;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.gpx-preview-expand:hover {
  background: #e5e7eb;
  color: #374151;
}

.dark .gpx-preview-expand:hover {
  background: #374151;
  color: #e5e7eb;
}

/* Loading state for map */
.gpx-preview-loading {
  height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #6b7280;
}

.gpx-preview-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--color-primary, #f2b705);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive: larger map on tablets */
@media (min-width: 640px) {
  .gpx-preview-map {
    height: 250px;
  }
}