/* Looksee App — call interface styles.
   Elderly-friendly: large touch targets, high contrast, simple layout. */

.app-body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

/* Top bar */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.app-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.app-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9CA3AF;
  flex-shrink: 0;
}

.status-dot.listening {
  background: var(--accent);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.status-dot.thinking {
  background: #F59E0B;
  animation: pulse-dot 0.8s ease-in-out infinite;
}

.status-dot.speaking {
  background: #10B981;
  animation: pulse-dot 1s ease-in-out infinite;
}

.status-dot.ready {
  background: #10B981;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* Transcript */
.app-transcript {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.transcript-welcome {
  text-align: center;
  padding: 48px 24px;
  margin: auto 0;
}

.welcome-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.transcript-welcome h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.transcript-welcome p {
  font-size: 1.125rem;
  color: var(--fg-muted);
  line-height: 1.6;
  max-width: 400px;
  margin: 0 auto 8px;
}

.welcome-hint {
  font-size: 0.9375rem !important;
  color: var(--accent) !important;
  margin-top: 16px !important;
}

/* Message bubbles */
.msg {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 1.0625rem;
  line-height: 1.6;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-user {
  background: var(--accent);
  color: white;
  border-radius: 20px 20px 6px 20px;
  align-self: flex-end;
}

.msg-ai {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 20px 20px 20px 6px;
  align-self: flex-start;
}

.msg-ai .msg-speaking-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  margin-left: 8px;
  animation: pulse-dot 1s ease-in-out infinite;
}

.msg-thinking {
  background: var(--surface);
  color: var(--fg-muted);
  border: 1px dashed var(--border);
  border-radius: 20px 20px 20px 6px;
  align-self: flex-start;
  font-style: italic;
}

.msg-thinking::after {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--fg-muted);
  margin-left: 4px;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* System notification */
.msg-system {
  background: #EFF6FF;
  color: #1E40AF;
  border: 1px solid #BFDBFE;
  border-radius: 12px;
  align-self: center;
  font-size: 0.9375rem;
  padding: 10px 16px;
  text-align: center;
}

/* Live interim transcription */
.msg-interim {
  background: var(--surface);
  color: var(--fg-muted);
  border: 1px dashed var(--border);
  border-radius: 20px 20px 20px 6px;
  align-self: flex-start;
  font-style: italic;
  font-size: 0.9375rem;
  opacity: 0.7;
}

/* Clip notification */
.msg-clip {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
  border-radius: 12px;
  align-self: center;
  font-size: 0.9375rem;
  padding: 10px 16px;
  text-align: center;
}

/* Capture bar */
.capture-bar {
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.capture-bar canvas {
  width: 80px;
  height: 45px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: cover;
}

.capture-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.capture-label {
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.capture-dismiss {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 4px 8px;
  margin-left: auto;
}

/* Bottom controls */
.app-controls {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 20px 24px 32px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.btn-mic {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 20px rgba(200, 75, 49, 0.3);
  -webkit-tap-highlight-color: transparent;
}

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

.btn-mic.listening {
  background: #DC2626;
  box-shadow: 0 4px 24px rgba(220, 38, 38, 0.4);
  animation: pulse-mic 1.5s ease-in-out infinite;
}

@keyframes pulse-mic {
  0%, 100% { box-shadow: 0 4px 24px rgba(220, 38, 38, 0.4); }
  50% { box-shadow: 0 4px 40px rgba(220, 38, 38, 0.6); }
}

.mic-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mic-hint {
  font-size: 0.5625rem;
  color: rgba(255,255,255,0.8);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  max-width: 70px;
  text-align: center;
}

.mic-pulse {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.mic-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* VAD visual states */
.btn-mic.speaking-state {
  background: #16A34A;
  animation: speaking-glow 0.8s ease-in-out infinite;
}

.btn-mic.silence-state {
  background: var(--accent);
  animation: pulse-mic 2s ease-in-out infinite;
}

.btn-mic.idle-state {
  background: var(--accent);
  animation: none;
}

@keyframes speaking-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
  50% { box-shadow: 0 0 0 12px rgba(22, 163, 74, 0); }
}

.btn-capture, .btn-clip {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--fg);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-capture:active, .btn-clip:active {
  transform: scale(0.92);
}

.btn-capture:hover, .btn-clip:hover {
  background: var(--border);
}

.btn-capture.capturing {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-clip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Clips drawer */
.clips-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.1);
  max-height: 60vh;
  overflow-y: auto;
  z-index: 20;
  padding: 20px 24px;
}

.clips-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.clips-header h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--fg);
}

.clips-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 4px 8px;
}

.clips-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.clip-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.clip-item img {
  width: 80px;
  height: 45px;
  border-radius: 8px;
  object-fit: cover;
}

.clip-item-info {
  flex: 1;
}

.clip-item-context {
  font-size: 0.875rem;
  color: var(--fg);
  margin-bottom: 4px;
}

.clip-item-time {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

/* iOS safe areas — respects notch and home indicator */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .app-controls {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
  .app-header {
    padding-top: calc(16px + env(safe-area-inset-top));
  }
}

/* Desktop: phone-width container */
@media (min-width: 768px) {
  .app-body {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}
