/* ============================================================
   UI — app menu, compact header, toast, voice, calendar
   ============================================================ */

/* --- App menu --- */
.app-menu {
  position: absolute;
  top: 76px;
  right: 24px;
  z-index: 40;
  width: 180px;
  padding: 8px;
  border-radius: 16px;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  box-shadow: 0 18px 40px var(--shadow-color);
}

.app-menu.hidden { display: none; }

#compact-header .app-menu {
  position: absolute;
  top: 52px;
  right: 0;
  z-index: 10;
}

.app-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-color);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.app-menu button:hover { background-color: var(--accent-soft-color); }

/* --- Compact header --- */
#compact-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 12px;
  background: var(--bg-color);
  border-bottom: 1px solid var(--soft-border-color);
  box-shadow: 0 2px 12px var(--shadow-color);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-100%);
  transition: opacity 0.22s ease, transform 0.22s ease;
  will-change: transform;
}

#compact-header.ch-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#compact-logo-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

#compact-title {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 6px;
}

/* --- Toast --- */
.toast {
  animation: toastIn 0.3s ease-out, toastOut 0.3s ease-in 2.7s forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translate(-50%, 0); }
  to   { opacity: 0; transform: translate(-50%, 20px); }
}

/* --- Voice mic wave --- */
.mic-wave {
  display: inline-block;
  width: 3px;
  height: 12px;
  background: linear-gradient(to bottom, var(--primary-color), var(--wave-end-color));
  margin: 0 2px;
  border-radius: 2px;
  animation: wave 1s ease-in-out infinite;
}

.mic-wave:nth-child(2) { animation-delay: 0.1s; }
.mic-wave:nth-child(3) { animation-delay: 0.2s; }
.mic-wave:nth-child(4) { animation-delay: 0.3s; }

@keyframes wave {
  0%, 100% { height: 8px; }
  50%       { height: 20px; }
}

/* --- Calendar --- */
.calendar-day {
  text-align: center;
  padding: 8px 4px;
  border-radius: 8px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.calendar-day:hover { background-color: var(--accent-soft-color); }

.calendar-day.has-tasks {
  background: var(--calendar-highlight-bg);
  color: var(--secondary-color);
  font-weight: 600;
  box-shadow: 0 4px 12px var(--calendar-highlight-shadow);
}

.calendar-day.is-selected {
  background: var(--primary-color);
  color: var(--on-primary-color);
  box-shadow: 0 6px 16px var(--calendar-highlight-shadow);
}

/* App menu responsive */
@media (max-width: 420px) {
  .app-menu {
    right: 16px;
    width: min(180px, calc(100vw - 32px));
  }
}
