/* ============================================
   Amity Glassmorphism — Dynamic Island v2
   Always visible, Traffic Lights, Home Button
   ============================================ */

/* --- Base Island (Always Visible) --- */
#dynamic-island {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  min-width: 240px;
  height: 40px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  gap: 4px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

/* --- Home Button (left) --- */
.di-home-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted, #a1a1aa);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.di-home-btn:hover {
  background: rgba(42, 157, 143, 0.25);
  color: #2a9d8f;
  transform: scale(1.1);
}

.di-home-btn:active {
  transform: scale(0.95);
}

/* --- Traffic Lights / Status (center) --- */
.di-traffic-lights {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
  cursor: pointer;
}

.di-light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.di-light-status {
  background: #52525b;
  box-shadow: 0 0 4px rgba(82, 82, 91, 0.3);
}

/* Status States */
.di-light-status.green {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
  animation: di-pulse-green 2s infinite;
}

.di-light-status.red {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.di-light-status.amber {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
  animation: di-pulse-amber 1.5s infinite;
}

.di-status-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #a1a1aa);
  white-space: nowrap;
  letter-spacing: 0.03em;
}

/* Pulse Animations */
@keyframes di-pulse-green {
  0%, 100% { box-shadow: 0 0 4px rgba(34, 197, 94, 0.4); }
  50% { box-shadow: 0 0 12px rgba(34, 197, 94, 0.7); }
}

@keyframes di-pulse-amber {
  0%, 100% { box-shadow: 0 0 4px rgba(245, 158, 11, 0.4); }
  50% { box-shadow: 0 0 12px rgba(245, 158, 11, 0.7); }
}

/* Strong Green Pulse — Audio erfolgreich */
.di-light-status.di-pulse-strong {
  animation: di-pulse-strong 1.2s infinite;
}

@keyframes di-pulse-strong {
  0%, 100% { box-shadow: 0 0 6px rgba(34, 197, 94, 0.5); transform: scale(1); }
  50% { box-shadow: 0 0 20px rgba(34, 197, 94, 0.9), 0 0 40px rgba(34, 197, 94, 0.3); transform: scale(1.3); }
}

/* --- Control Buttons (right) --- */
.di-controls {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.di-minimize-btn,
.di-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  flex-shrink: 0;
  line-height: 1;
}

.di-minimize-btn {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.di-minimize-btn:hover {
  background: rgba(245, 158, 11, 0.3);
  transform: scale(1.1);
}

.di-close-btn {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.di-close-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  transform: scale(1.1);
}

/* --- Expanded State --- */
#dynamic-island.expanded {
  width: min(92vw, 640px);
  min-width: min(92vw, 640px);
  height: auto;
  max-height: 360px;
  border-radius: 20px;
  padding: 6px 6px 12px;
  flex-wrap: wrap;
}

/* Expanded Content (hidden by default, shown when expanded) */
.di-expanded-content {
  display: none;
  width: 100%;
}

#dynamic-island.expanded .di-expanded-content {
  display: block;
  margin-top: 4px;
}

.di-expanded-header {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim, #52525b);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.di-teleprompter-content {
  max-height: 260px;
  overflow-y: auto;
  padding: 0 10px;
}

.di-teleprompter-content::-webkit-scrollbar {
  width: 3px;
}

.di-teleprompter-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

/* Teleprompter Items */
.di-teleprompter-item {
  padding: 8px 12px;
  margin-bottom: 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--accent, #2a9d8f);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text, #e4e4e7);
  animation: di-item-in 0.3s ease;
}

.di-teleprompter-item.di-critical {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.di-teleprompter-item.di-now {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.06);
}

@keyframes di-item-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Permission Status Icons --- */
.di-perm-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}

.di-perm-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.4);
  flex-shrink: 0;
  padding: 0;
}

.di-perm-icon:hover {
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  transform: scale(1.1);
}

/* Granted state */
.di-perm-icon.perm-granted {
  background: rgba(34,197,94,0.15);
  color: #22c55e;
}

/* Denied state — blink red */
.di-perm-icon.perm-denied {
  background: rgba(239,68,68,0.2);
  color: #ef4444;
  animation: perm-blink-red 1s infinite;
}

@keyframes perm-blink-red {
  0%, 100% { background: rgba(239,68,68,0.15); box-shadow: none; }
  50% { background: rgba(239,68,68,0.4); box-shadow: 0 0 12px rgba(239,68,68,0.6); }
}

/* Prompt state (waiting for user decision) */
.di-perm-icon.perm-prompt {
  background: rgba(245,158,11,0.15);
  color: #f59e0b;
  animation: perm-pulse-amber 1.5s infinite;
}

@keyframes perm-pulse-amber {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 10px rgba(245,158,11,0.5); }
}
