/* ==========================================================================
   ATLAS DESIGN SYSTEM — "Liebe für die Zusteller-App"
   Stilwelt: Organisch / Soft (High-End Agency)
   Dials: Variance 4, Motion 3, Density 7
   ========================================================================== */

/* --- CSS Custom Properties --- */
:root {
  /* Brand — Amber/Orange (Logistik = Bewegung = Wärme) */
  --brand:       #E67E22;
  --brand-light: #F39C12;
  --brand-dark:  #D35400;
  --brand-ghost: #FEF5E7;
  --brand-hover: #C44A00;

  /* Neutrals — Warm Slate (kein Blaustich!) */
  --n50:  #FAFAF9;
  --n100: #F5F5F4;
  --n200: #E7E5E4;
  --n300: #D6D3D1;
  --n400: #A8A29E;
  --n500: #78716C;
  --n600: #57534E;
  --n700: #44403C;
  --n800: #292524;
  --n900: #1C1917;
  --n950: #0C0A09;

  /* Status-Farben */
  --success: #22C55E;
  --success-soft: #DCFCE7;
  --warning: #F59E0B;
  --warning-soft: #FEF3C7;
  --danger:  #EF4444;
  --danger-soft: #FEE2E2;
  --info:    #3B82F6;
  --info-soft: #DBEAFE;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Radii */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows — warm, entsättigt */
  --shadow-xs: 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-sm: 0 2px 4px rgba(28, 25, 23, 0.06), 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-md: 0 4px 8px rgba(28, 25, 23, 0.08), 0 2px 4px rgba(28, 25, 23, 0.04);
  --shadow-lg: 0 8px 16px rgba(28, 25, 23, 0.10), 0 4px 8px rgba(28, 25, 23, 0.06);
  --shadow-xl: 0 16px 32px rgba(28, 25, 23, 0.12), 0 8px 16px rgba(28, 25, 23, 0.08);

  /* Inset Highlight */
  --shadow-raised: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 16px rgba(28, 25, 23, 0.08);

  /* Easings */
  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* Transitions */
  --t-fast: 140ms var(--ease-out);
  --t-base: 200ms var(--ease-out);
  --t-slow: 320ms var(--ease-out);
}

/* --- Font Imports --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

/* --- Base Styles --- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  letter-spacing: -0.01em;
}
.tabular { font-variant-numeric: tabular-nums; }

/* --- Scrollbar --- */
* { scrollbar-width: thin; scrollbar-color: var(--n300) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--n300); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--n400); }

/* --- Focus Ring --- */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* --- Selection --- */
::selection { background: rgba(230, 126, 34, 0.25); color: inherit; }

/* --- Component: Card --- */
.atlas-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--n200);
  transition: box-shadow var(--t-base), transform var(--t-fast);
}
.atlas-card:active { transform: scale(0.98); }
.atlas-card-dark {
  background: var(--n800);
  border: 1px solid var(--n700);
  box-shadow: var(--shadow-md);
}

/* --- Component: Button --- */
.atlas-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--t-fast);
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.atlas-btn:active { transform: scale(0.97); }
.atlas-btn-primary {
  background: var(--brand);
  color: white;
  box-shadow: var(--shadow-sm);
}
.atlas-btn-primary:hover { background: var(--brand-dark); box-shadow: var(--shadow-md); }
.atlas-btn-secondary {
  background: var(--n100);
  color: var(--n700);
  border: 1px solid var(--n200);
}
.atlas-btn-secondary:hover { background: var(--n200); }
.atlas-btn-success {
  background: var(--success);
  color: white;
  box-shadow: var(--shadow-sm);
}
.atlas-btn-success:hover { background: #16A34A; box-shadow: var(--shadow-md); }
.atlas-btn-danger {
  background: var(--danger);
  color: white;
}
.atlas-btn-danger:hover { background: #DC2626; }
.atlas-btn-ghost {
  background: transparent;
  color: var(--n600);
}
.atlas-btn-ghost:hover { background: var(--n100); }

/* --- Component: Badge --- */
.atlas-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.atlas-badge-success { background: var(--success-soft); color: #15803D; }
.atlas-badge-warning { background: var(--warning-soft); color: #B45309; }
.atlas-badge-danger  { background: var(--danger-soft); color: #B91C1C; }
.atlas-badge-info    { background: var(--info-soft); color: #1D4ED8; }
.atlas-badge-brand   { background: var(--brand-ghost); color: #9A4A00; }
.atlas-badge-neutral { background: var(--n100); color: var(--n600); }

/* --- Component: Status Dot --- */
.atlas-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.atlas-dot-success { background: var(--success); }
.atlas-dot-warning { background: var(--warning); }
.atlas-dot-danger  { background: var(--danger); }
.atlas-dot-info    { background: var(--info); }
.atlas-dot-neutral { background: var(--n400); }
.atlas-dot-pulse {
  animation: atlas-pulse 2s infinite;
}
@@keyframes atlas-pulse {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* --- Component: Progress Ring --- */
.atlas-progress-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.atlas-progress-ring svg { transform: rotate(-90deg); }
.atlas-progress-ring .ring-bg { stroke: var(--n200); }
.atlas-progress-ring .ring-fg {
  stroke: var(--brand);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s var(--ease-out);
}

/* --- Component: Skeleton Loader --- */
.atlas-skeleton {
  background: linear-gradient(90deg, var(--n100) 25%, var(--n200) 50%, var(--n100) 75%);
  background-size: 200% 100%;
  animation: atlas-shimmer 1.4s linear infinite;
  border-radius: var(--radius);
}
@@keyframes atlas-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* --- Component: Empty State --- */
.atlas-empty {
  text-align: center;
  padding: var(--space-8) var(--space-5);
}
.atlas-empty-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--brand-ghost);
  color: var(--brand);
  font-size: 2rem;
}
.atlas-empty-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--n700);
  margin-bottom: var(--space-2);
}
.atlas-empty-text {
  font-size: 0.9rem;
  color: var(--n500);
  max-width: 320px;
  margin: 0 auto var(--space-5);
}

/* --- Component: Offline Banner --- */
.atlas-offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--danger);
  color: white;
  text-align: center;
  padding: var(--space-2) var(--space-4);
  font-size: 0.85rem;
  font-weight: 500;
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}
.atlas-offline-banner.visible { display: flex; }

/* --- Component: Toast (enhanced Toastr) --- */
.toast {
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
}

/* --- Component: Stepper (custom, not bs-stepper) --- */
.atlas-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  padding: var(--space-4) 0;
}
.atlas-stepper-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.atlas-stepper-circle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: all var(--t-base);
}
.atlas-stepper-circle-pending {
  background: var(--n100);
  color: var(--n400);
  border: 2px solid var(--n200);
}
.atlas-stepper-circle-active {
  background: var(--brand);
  color: white;
  border: 2px solid var(--brand);
  box-shadow: 0 0 0 4px var(--brand-ghost);
}
.atlas-stepper-circle-done {
  background: var(--success);
  color: white;
  border: 2px solid var(--success);
}
.atlas-stepper-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--n600);
  white-space: nowrap;
}
.atlas-stepper-label-active { color: var(--brand-dark); font-weight: 600; }
.atlas-stepper-line {
  flex: 1;
  height: 2px;
  background: var(--n200);
  margin: 0 var(--space-2);
  min-width: 24px;
}
.atlas-stepper-line-done { background: var(--success); }

/* --- Component: Shipment Card --- */
.atlas-shipment {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--n200);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  transition: all var(--t-fast);
  position: relative;
  overflow: hidden;
}
.atlas-shipment:active {
  transform: scale(0.98);
}
.atlas-shipment::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}
.atlas-shipment-pending::before { background: var(--warning); }
.atlas-shipment-completed::before { background: var(--success); }
.atlas-shipment-active::before { background: var(--brand); }
.atlas-shipment-pickup::before { background: var(--info); }

/* --- Component: Dark Mode --- */
.dark .atlas-card { background: var(--n800); border-color: var(--n700); }
.dark .atlas-card-dark { background: var(--n900); border-color: var(--n800); }
.dark .atlas-btn-secondary { background: var(--n700); color: var(--n200); border-color: var(--n600); }
.dark .atlas-btn-secondary:hover { background: var(--n600); }
.dark .atlas-btn-ghost { color: var(--n400); }
.dark .atlas-btn-ghost:hover { background: var(--n700); }
.dark .atlas-shipment { background: var(--n800); border-color: var(--n700); }
.dark .atlas-skeleton { background: linear-gradient(90deg, var(--n800) 25%, var(--n700) 50%, var(--n800) 75%); background-size: 200% 100%; }
.dark .atlas-empty-icon { background: rgba(230, 126, 34, 0.15); }
.dark .atlas-empty-title { color: var(--n200); }
.dark .atlas-empty-text { color: var(--n400); }
.dark .atlas-stepper-circle-pending { background: var(--n700); color: var(--n500); border-color: var(--n600); }
.dark .atlas-stepper-label { color: var(--n400); }
.dark .atlas-stepper-line { background: var(--n700); }

/* --- Component: Language Picker (Bottom Sheet) --- */
.atlas-lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--n100);
  border: none;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--n600);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.atlas-lang-trigger:hover {
  background: var(--n200);
  color: var(--n900);
}
.atlas-lang-trigger:active {
  transform: scale(0.96);
}
.atlas-lang-trigger .fa-globe {
  font-size: 0.875rem;
  color: var(--brand);
}
.dark .atlas-lang-trigger {
  background: var(--n800);
  color: var(--n300);
}
.dark .atlas-lang-trigger:hover {
  background: var(--n700);
  color: var(--n50);
}

/* Bottom Sheet Overlay */
.atlas-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease-out);
}
.atlas-sheet-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Bottom Sheet */
.atlas-lang-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 70;
  background: white;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-xl);
  transform: translateY(100%);
  transition: transform 320ms var(--ease-drawer);
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.atlas-lang-sheet.active {
  transform: translateY(0);
}
.atlas-lang-sheet::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--n300);
  margin: 8px auto 0;
  flex-shrink: 0;
}
.dark .atlas-lang-sheet {
  background: var(--n800);
}
.dark .atlas-lang-sheet::before {
  background: var(--n600);
}

/* Bottom Sheet Header */
.atlas-lang-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--n200);
  flex-shrink: 0;
}
.atlas-lang-sheet-header h3 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--n900);
  margin: 0;
}
.dark .atlas-lang-sheet-header {
  border-color: var(--n700);
}
.dark .atlas-lang-sheet-header h3 {
  color: var(--n50);
}

/* Close Button */
.atlas-lang-sheet-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--n500);
  cursor: pointer;
  transition: all var(--t-fast);
}
.atlas-lang-sheet-close:hover {
  background: var(--n100);
  color: var(--n900);
}
.dark .atlas-lang-sheet-close:hover {
  background: var(--n700);
  color: var(--n50);
}

/* Language Grid */
.atlas-lang-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
  padding: var(--space-4);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 480px) {
  .atlas-lang-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 768px) {
  .atlas-lang-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Language Option */
.atlas-lang-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  border: 1px solid var(--n200);
  background: var(--n50);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--n600);
  cursor: pointer;
  transition: all var(--t-fast);
  text-align: left;
  font-family: var(--font-body);
}
.atlas-lang-option:hover {
  border-color: var(--brand-light);
  background: var(--brand-ghost);
}
.atlas-lang-option:active {
  transform: scale(0.97);
}
.atlas-lang-option.active {
  border-color: var(--brand);
  background: var(--brand-ghost);
  color: var(--brand-dark);
  font-weight: 600;
}
.atlas-lang-option .lang-flag {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}
.atlas-lang-option .lang-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.atlas-lang-option .lang-check {
  color: var(--brand);
  font-size: 0.75rem;
  opacity: 0;
  flex-shrink: 0;
}
.atlas-lang-option.active .lang-check {
  opacity: 1;
}
.dark .atlas-lang-option {
  border-color: var(--n700);
  background: var(--n800);
  color: var(--n300);
}
.dark .atlas-lang-option:hover {
  border-color: var(--brand-light);
  background: var(--n900);
}
.dark .atlas-lang-option.active {
  border-color: var(--brand);
  background: var(--n900);
  color: var(--brand-light);
}

/* --- Component: Tour Progress Bar --- */
.atlas-tour-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-2) 0;
}
.atlas-tour-progress-stop {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--n200);
  transition: background var(--t-base);
}
.atlas-tour-progress-stop.done { background: var(--success); }
.atlas-tour-progress-stop.active { background: var(--brand); }
.atlas-tour-progress-stop.current {
  background: var(--warning);
  animation: atlas-pulse 2s infinite;
}

/* --- Animations --- */
@keyframes atlas-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.atlas-slide-up { animation: atlas-slide-up 0.3s var(--ease-out) both; }

@keyframes atlas-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.atlas-fade-in { animation: atlas-fade-in 0.2s var(--ease-out) both; }

@keyframes atlas-scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.atlas-scale-in { animation: atlas-scale-in 0.2s var(--ease-out) both; }

/* --- Intro.js Mobile Overrides (Task 4) --- */
.introjs-button { min-height: 48px; min-width: 80px; font-size: 1rem; padding: 12px 16px; border-radius: var(--radius-md); }
.introjs-skipbutton { min-height: 48px; min-width: 48px; font-size: 1.5rem; }
.introjs-tooltip { max-width: 90vw; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.introjs-tooltiptext { font-size: 0.95rem; line-height: 1.5; color: var(--n700); }
.introjs-tooltip-title { font-size: 1.1rem; font-weight: 600; }
.introjs-progressbar { background: var(--brand); }
.introjs-bullets a { width: 12px; height: 12px; }
.introjs-overlay { opacity: 0.6 !important; }

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-iteration-count: 1 !important;
    animation-duration: 0.1s !important;
    transition-duration: 0.1s !important;
  }
  .atlas-skeleton {
    animation: none !important;
    background: var(--n200) !important;
  }
  .atlas-dot-pulse {
    animation: none !important;
  }
}

/* --- Touch Target Enhancement --- */
@media (hover: none) and (pointer: coarse) {
  .atlas-btn { min-height: 52px; }
  .atlas-shipment { padding: var(--space-4) var(--space-5); }
}

/* --- Print --- */
@media print {
  .atlas-offline-banner, .atlas-lang-trigger, .bottom-nav { display: none !important; }
  .atlas-card { box-shadow: none; border: 1px solid var(--n300); }
}
