/* Dual FAB Menu - Left (Categories) + Right (Time/Actions) */

/* Backdrop */
.fab-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 810; /* Above map-overlay-top (800) */
  animation: fab-fade-in 0.2s ease;
}

@keyframes fab-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* FAB Containers */
.fab-left,
.fab-right {
  position: fixed;
  top: 260px;
  z-index: 820; /* Above map-overlay-top (800) */
}

.fab-left {
  left: 24px;
}

.fab-right {
  right: 12px;
}

/* Main FAB Button */
.fab-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--fab-color, #6366f1) 0%, color-mix(in srgb, var(--fab-color, #6366f1) 80%, #000) 100%);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 821; /* Above map-overlay-top (800) */
}

.fab-btn-right {
  --fab-color: #6366f1;
}

.fab-btn-split {
  border: 2px solid rgba(255,255,255,0.3);
}

.fab-count {
  font-size: 16px;
  font-weight: 800;
}

.fab-btn:hover {
  transform: scale(1.06);
}

.fab-btn:active {
  transform: scale(0.94);
}

/* FAB Label */
.fab-label {
  position: absolute;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  white-space: nowrap;
  pointer-events: none;
  background: transparent;
  padding: 2px 6px;
  border-radius: 4px;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fab-label-time {
  background: transparent;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.fab-label-cat {
  background: transparent;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Item labels (category/subcategory names) */
.fab-item-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  white-space: nowrap;
  pointer-events: none;
  background: transparent;
  padding: 1px 5px;
  border-radius: 3px;
}

.fab-sub-label {
  font-size: 8px;
  margin-top: 3px;
}

/* Ring containers */
.fab-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 48px;
  height: 48px;
  pointer-events: none;
}

/* Individual items */
.fab-item {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  background: rgba(15, 23, 42, 0.92);
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translate(0, 0) scale(0.3);
  pointer-events: none;
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.2s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.fab-item.is-visible {
  opacity: 1;
  transform: translate(var(--x), var(--y)) scale(1);
  pointer-events: auto;
  transition-delay: var(--delay);
  z-index: 822; /* Above map-overlay-top (800) */
}

.fab-item:hover {
  background: var(--color, #3b82f6);
  border-color: var(--color, #3b82f6);
  color: #fff;
}

.fab-item:active {
  transform: translate(var(--x), var(--y)) scale(0.9) !important;
}

.fab-item.is-active {
  background: var(--color, #3b82f6);
  border-color: var(--color, #3b82f6);
  color: #fff;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--color, #3b82f6) 50%, transparent);
}

/* Time chips - smaller text */
.fab-time {
  font-size: 11px;
  font-weight: 700;
  --color: #f59e0b;
}

/* Subcategory items */
.fab-sub {
  width: 36px;
  height: 36px;
  font-size: 13px;
  opacity: 1;
  transform: translate(var(--x), var(--y)) scale(1);
  pointer-events: auto;
  animation: fab-pop-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
  animation-delay: var(--delay);
  --color: #64748b;
  z-index: 823; /* Above category items */
}

.fab-sub.is-active {
  --color: #3b82f6;
}

.fab-sub.is-excluded {
  opacity: 0.35;
  filter: grayscale(0.8);
  transform: translate(var(--x), var(--y)) scale(0.85);
}

@keyframes fab-pop-in {
  from {
    opacity: 0;
    transform: translate(calc(var(--x) * 0.3), calc(var(--y) * 0.3)) scale(0.5);
  }
  to {
    opacity: 1;
    transform: translate(var(--x), var(--y)) scale(1);
  }
}

/* Action items */
.fab-action {
  width: 42px;
  height: 42px;
  font-size: 16px;
}

/* ========== LIGHT THEME ========== */
body[data-theme="light"] .fab-backdrop {
  background: rgba(255, 255, 255, 0.2);
}

body[data-theme="light"] .fab-btn {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body[data-theme="light"] .fab-label {
  color: #0f172a;
  text-shadow: 0 1px 3px rgba(255,255,255,0.6);
}

body[data-theme="light"] .fab-label-time,
body[data-theme="light"] .fab-label-cat {
  color: #0f172a;
  text-shadow: 0 1px 3px rgba(255,255,255,0.6);
}

body[data-theme="light"] .fab-item-label {
  color: #0f172a;
  text-shadow: 0 1px 3px rgba(255,255,255,0.6);
}

body[data-theme="light"] .fab-item {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(148, 163, 184, 0.4);
  color: #475569;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
}

body[data-theme="light"] .fab-item:hover,
body[data-theme="light"] .fab-item.is-active {
  color: #fff;
}

/* ========== MOBILE ========== */
@media (max-width: 480px) {
  .fab-left,
  .fab-right {
    top: 240px;
  }

  .fab-left {
    left: 18px;
  }

  .fab-right {
    right: 8px;
  }

  .fab-btn {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }

  .fab-item {
    width: 36px;
    height: 36px;
    font-size: 12px;
  }

  .fab-sub {
    width: 32px;
    height: 32px;
    font-size: 11px;
  }

  .fab-action {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }

  .fab-time {
    font-size: 10px;
  }

  .fab-label {
    font-size: 9px;
    top: 50px;
  }
}

/* Safe area */
@supports (padding-top: env(safe-area-inset-top)) {
  .fab-left,
  .fab-right {
    top: calc(180px + env(safe-area-inset-top));
  }

  .fab-left {
    left: calc(24px + env(safe-area-inset-left));
  }

  .fab-right {
    right: calc(12px + env(safe-area-inset-right));
  }
}
