/* ==========================================================================
   Voice input and location surfaces
   ========================================================================== */

/* --------------------------------------------------------------------------
   Microphone button
   -------------------------------------------------------------------------- */
.ai-mic {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-rim, var(--border));
  background: var(--glass-bg-faint, var(--surface));
  -webkit-backdrop-filter: var(--glass-blur-sm);
  backdrop-filter: var(--glass-blur-sm);
  box-shadow: var(--glass-edge-soft, none);
  cursor: pointer;
  font-size: 1.05rem;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}
.ai-mic:hover { transform: scale(1.06); background: var(--glass-bg, var(--surface-alt)); }
.ai-mic:active { transform: scale(0.96); }
.ai-mic:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--primary-ring); }

.mic-glyph { position: relative; z-index: 1; line-height: 1; }

/* The ring only exists while listening, so an idle button is completely still
   rather than quietly animating in the corner of the professor's eye. */
.mic-pulse { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }

.ai-mic.is-listening {
  background: var(--danger-soft);
  border-color: var(--danger);
}
.ai-mic.is-listening .mic-pulse {
  box-shadow: 0 0 0 0 var(--danger);
  animation: micPulse 1.5s var(--ease-out) infinite;
}
@keyframes micPulse {
  0%   { box-shadow: 0 0 0 0 rgba(208, 98, 92, 0.55); }
  70%  { box-shadow: 0 0 0 14px rgba(208, 98, 92, 0); }
  100% { box-shadow: 0 0 0 0 rgba(208, 98, 92, 0); }
}

/* --------------------------------------------------------------------------
   Listening panel
   -------------------------------------------------------------------------- */
.voice-panel {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--glass-bg-strong, var(--surface));
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-rim, var(--border));
  box-shadow: var(--glass-shadow, var(--shadow));
  animation: scaleIn var(--t) var(--ease-out) both;
}
.vp-row { display: flex; align-items: center; gap: 10px; font-size: 0.87rem; }
.vp-row .btn { margin-left: auto; }

.vp-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--danger);
  animation: vpBlink 1.1s var(--ease) infinite;
  flex: 0 0 auto;
}
@keyframes vpBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* Reserves its line even when empty, so the panel does not jump taller the
   moment the first word is recognised. */
.vp-heard {
  margin-top: 8px;
  min-height: 1.3em;
  font-size: 0.95rem;
  color: var(--text);
  font-style: italic;
}
.vp-error { color: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  .ai-mic.is-listening .mic-pulse, .vp-dot { animation: none; }
  .voice-panel { animation: none; }
}

/* --------------------------------------------------------------------------
   Location
   -------------------------------------------------------------------------- */
.loc-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-rim, var(--border));
  background: var(--glass-bg-faint, var(--surface-alt));
  color: var(--text-soft);
  font: inherit; font-size: 0.76rem; font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.loc-btn:hover { background: var(--primary-softer); color: var(--primary); }
.loc-btn[disabled] { opacity: 0.5; cursor: default; }

.loc-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 0.76rem; color: var(--text-muted);
}

/* Location sheet */
.loc-sheet-title { display: flex; align-items: center; gap: 9px; margin: 0 0 4px; }
.loc-line { display: flex; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.loc-line:last-of-type { border-bottom: none; }
.loc-line .loc-key { color: var(--text-muted); min-width: 78px; font-size: 0.78rem; }
.loc-line .loc-val { color: var(--text); font-weight: 600; font-size: 0.88rem; }
.loc-none { color: var(--text-muted); font-size: 0.85rem; padding: 10px 0; }

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .ai-input-row { flex-wrap: wrap; }
  /* The mic is the primary action on a phone -- typing a sentence one-handed
     is the slow path -- so it keeps its full size while the Ask button wraps. */
  .ai-mic { width: 46px; height: 46px; font-size: 1.15rem; }
  .voice-panel { position: sticky; bottom: 8px; z-index: 5; }
}

/* ==========================================================================
   Text size slider
   ========================================================================== */
.font-size-row {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding: 11px 12px 9px;
}
.font-size-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.76rem; color: var(--text-soft); margin-bottom: 8px;
}
.font-size-head strong { color: var(--text); font-weight: 700; }

.font-size-slider { display: flex; align-items: center; gap: 10px; }
/* The two A's are the control's label: small on the left, large on the right,
   so the direction of the slider needs no explaining. */
.font-size-slider .fs-a { font-size: 0.72rem; color: var(--text-muted); font-weight: 700; }
.font-size-slider .fs-b { font-size: 1.06rem; color: var(--text-muted); font-weight: 700; }

#font-size-range {
  flex: 1;
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: var(--radius-pill);
  background: var(--border-strong);
  cursor: pointer;
}
#font-size-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease);
}
#font-size-range::-webkit-slider-thumb:hover { transform: scale(1.14); }
#font-size-range::-moz-range-thumb {
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
  cursor: pointer;
}
#font-size-range:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--primary-ring); }

/* The menu is sized for three short rows; the slider needs a little more. */
.theme-menu { min-width: 216px; }

/* ==========================================================================
   Reminder chips in the Manage sheet
   ========================================================================== */
.reminder-chips {
  display: flex; flex-wrap: wrap; gap: 7px;
  margin-bottom: 9px; min-height: 26px;
  align-items: center;
}
.reminder-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 6px 4px 11px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-size: 0.75rem; font-weight: 700;
  white-space: nowrap;
}
.reminder-chip .chip-x {
  border: none; background: none; padding: 0 3px;
  color: inherit; opacity: 0.65; cursor: pointer;
  font-size: 0.78rem; line-height: 1;
  border-radius: 50%;
}
.reminder-chip .chip-x:hover { opacity: 1; background: var(--danger-soft); color: var(--danger); }

.reminder-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.reminder-add select { flex: 1 1 150px; min-width: 0; }
.reminder-add input[type="number"] { flex: 0 1 110px; min-width: 0; }
.reminder-add .btn { flex: 0 0 auto; white-space: nowrap; }

/* ==========================================================================
   Skeletons
   A skeleton is only worth showing if it occupies the same space the content
   will, otherwise it trades a blank panel for a visible jump. These mirror the
   real rows: same heights, same rhythm, same gaps.
   ========================================================================== */
.sk {
  border-radius: 8px;
  background: linear-gradient(
    100deg,
    var(--bg-tint) 30%,
    var(--surface-alt) 50%,
    var(--bg-tint) 70%
  );
  background-size: 220% 100%;
  /* Animating background-position only: no layout, no paint of anything
     underneath, so a list of these stays cheap. */
  animation: skShimmer 1.35s var(--ease) infinite;
}
@keyframes skShimmer {
  from { background-position: 180% 0; }
  to   { background-position: -80% 0; }
}

.sk-line { height: 11px; margin-bottom: 8px; }
.sk-line.short { width: 42%; }
.sk-line.medium { width: 68%; }
.sk-line.long { width: 88%; }
.sk-title { height: 15px; width: 55%; margin-bottom: 10px; }
.sk-badge { width: 54px; height: 56px; border-radius: 13px; flex: 0 0 auto; }
.sk-pill { height: 26px; width: 74px; border-radius: var(--radius-pill); }

/* Matches .ue-item: date badge, two-line body, action pill. */
.sk-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 10px 12px 0;
}
.sk-row { flex-wrap: wrap; row-gap: 8px; }
.sk-row .sk-body { flex: 1 1 150px; min-width: 0; }
.sk-row-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }

/* Matches .timeline-item. */
.sk-timeline-row {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 0;
}
.sk-timeline-row .sk-time { width: 58px; flex: 0 0 auto; }

/* Timetable grid cells. */
.sk-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
.sk-cell { height: 52px; border-radius: 11px; }

@media (prefers-reduced-motion: reduce) {
  /* Still shows the shape and the pending state, without the movement. */
  .sk { animation: none; background: var(--bg-tint); }
}

/* --------------------------------------------------------------------------
   A spoken change waiting to be confirmed
   The professor's hands are busy -- that is why they spoke. The pending
   button has to be findable at a glance, not the same weight as everything
   else on the card.
   -------------------------------------------------------------------------- */
#ai-confirm-btn.is-pending {
  animation: confirmPulse 1.6s var(--ease) infinite;
  box-shadow: 0 0 0 4px var(--primary-ring);
}
@keyframes confirmPulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--primary-ring); }
  50%      { box-shadow: 0 0 0 7px var(--primary-ring); }
}
@media (prefers-reduced-motion: reduce) {
  #ai-confirm-btn.is-pending {
    animation: none;
    box-shadow: 0 0 0 4px var(--primary-ring);
  }
}
