/* BMI Kalkylator - Modern Glassmorphism Design */
/* Mobile-first fullscreen layout */

/* ==========================================================================
   Result Section (Top - Most Important)
   ========================================================================== */
.result {
  flex-shrink: 0;
  text-align: center;
  padding: 8px 0;
}

.result-display {
  padding: 24px 16px;
}

.result-bmi {
  font-size: 4.5rem;
  font-weight: 800;
  line-height: 1;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 30px rgba(6, 182, 212, 0.4));
  font-variant-numeric: tabular-nums;
}

.result-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-top: 4px;
}

.result-category {
  display: inline-block;
  padding: 10px 28px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Kategori-färger */
.result-category[data-category="undervikt"] {
  color: var(--bmi-undervikt);
  border-color: rgba(251, 191, 36, 0.3);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.2);
}

.result-category[data-category="normalt"] {
  color: var(--bmi-normalt);
  border-color: rgba(52, 211, 153, 0.3);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.2);
}

.result-category[data-category="overvikt"] {
  color: var(--bmi-overvikt);
  border-color: rgba(251, 146, 60, 0.3);
  box-shadow: 0 0 20px rgba(251, 146, 60, 0.2);
}

.result-category[data-category^="fetma"] {
  color: var(--bmi-fetma);
  border-color: rgba(248, 113, 113, 0.3);
  box-shadow: 0 0 20px rgba(248, 113, 113, 0.2);
}

.result-measurements {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 12px;
}

/* ==========================================================================
   Pickers Section
   ========================================================================== */
.pickers {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-shrink: 0;
}

.picker-wrapper {
  flex: 1;
  max-width: 160px;
}

.picker-label {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ==========================================================================
   Categories Section
   ========================================================================== */
.categories {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
}

.categories-list {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.875rem;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  color: rgba(255, 255, 255, 0.7);
}

.category-item.active {
  background: var(--bg-card);
  border-color: rgba(255, 255, 255, 0.1);
}

.category-item.active .category-name {
  color: white;
}

.category-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.category-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.category-dot.undervikt { background: var(--bmi-undervikt); box-shadow: 0 0 8px var(--bmi-undervikt); }
.category-dot.normalt { background: var(--bmi-normalt); box-shadow: 0 0 8px var(--bmi-normalt); }
.category-dot.overvikt { background: var(--bmi-overvikt); box-shadow: 0 0 8px var(--bmi-overvikt); }
.category-dot.fetma { background: var(--bmi-fetma); box-shadow: 0 0 8px var(--bmi-fetma); }

.category-range {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.category-item.active .category-range {
  color: var(--text-secondary);
}

/* ==========================================================================
   Footer Links
   ========================================================================== */
.footer {
  padding: 16px;
  padding-bottom: calc(var(--safe-bottom) + 16px);
  text-align: center;
  position: relative;
  z-index: 1;
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.75rem;
  margin: 0 12px;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--primary-light);
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes glow-pulse {
  0%, 100% {
    filter: drop-shadow(0 0 30px rgba(6, 182, 212, 0.4));
  }
  50% {
    filter: drop-shadow(0 0 50px rgba(168, 85, 247, 0.5));
  }
}

.result-bmi.animate {
  animation: glow-pulse 3s ease-in-out infinite;
}

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

.loaded .result {
  animation: fade-in-up 0.5s ease-out;
}

.loaded .pickers {
  animation: fade-in-up 0.5s ease-out 0.1s backwards;
}

.loaded .categories {
  animation: fade-in-up 0.5s ease-out 0.2s backwards;
}

/* ==========================================================================
   Bottom Sheet (mobil - dölj kategorier vid liten höjd)
   ========================================================================== */
@media (max-width: 767px) and (max-height: 930px) {
  .categories:not(.visible) {
    display: none;
  }

  .categories.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    padding: 24px 20px;
    padding-bottom: calc(var(--safe-bottom) + 24px);
    background: var(--bg-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .categories.bottom-sheet.visible {
    transform: translateY(0);
  }

  /* Drag handle indicator */
  .categories.bottom-sheet::before {
    content: '';
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin-bottom: 16px;
  }

  .bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .bottom-sheet-overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Bottom Sheet för breda + låga skärmar */
@media (min-width: 768px) and (max-height: 1000px) {
  .categories:not(.visible) {
    display: none;
  }

  .categories.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    padding: 24px 20px;
    padding-bottom: calc(var(--safe-bottom) + 24px);
    background: var(--bg-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .categories.bottom-sheet.visible {
    transform: translateY(0);
  }

  .categories.bottom-sheet::before {
    content: '';
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin-bottom: 16px;
  }

  .bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .bottom-sheet-overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ==========================================================================
   Desktop Layout
   ========================================================================== */
@media (min-width: 768px) {
  .main {
    padding: 32px;
  }

  .result-bmi {
    font-size: 6rem;
  }

  .pickers {
    gap: 32px;
  }

  .picker-wrapper {
    max-width: 180px;
  }
}

/* ==========================================================================
   Landscape orientation
   ========================================================================== */
@media (max-height: 600px) and (orientation: landscape) {
  .main {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 16px;
  }

  .result {
    flex: 1 1 100%;
  }

  .result-bmi {
    font-size: 3rem;
  }

  .pickers {
    flex: 0 0 auto;
  }

  .categories {
    flex: 1 1 auto;
  }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .result-bmi.animate {
    animation: none;
  }

  .loaded .result,
  .loaded .pickers,
  .loaded .categories {
    animation: none;
  }
}

@media (prefers-contrast: high) {
  .glass-card,
  .category-item.active {
    border-width: 2px;
    border-color: rgba(255, 255, 255, 0.3);
  }

  .result-category {
    border-width: 2px;
  }
}

/* ==========================================================================
   Print styles
   ========================================================================== */
@media print {
  body {
    background: white;
    color: black;
  }

  .result-bmi {
    -webkit-text-fill-color: black;
    background: none;
    filter: none;
  }

  .app::before,
  .footer {
    display: none;
  }
}
