@import url('./base.css');


/* ── Page Layout ── */
body {
  height: 100vh;
  height: 100dvh;
  display: flex;
  overflow: hidden;
}

.call-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-deep);
  min-width: 0;
}

.transcript-panel {
  width: 420px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-muted);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  z-index: 20;
}


/* ── Call Header ── */
.call-header {
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.2rem;
  border-bottom: 1px solid var(--border-muted);
  background: var(--bg-header);
  backdrop-filter: blur(10px);
  flex-wrap: wrap;
}

.call-header .call-title {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 20px;
}

.call-header .call-provider-language {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.call-header .call-title h1 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.4em;
  font-weight: 800;
  color: var(--text-bright);
}

.call-header .call-provider-language .provider-select {
  background: var(--bg-elevated);
  color: var(--text-dim);
  border: 1px solid var(--border-muted);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  cursor: pointer;
  transition: var(--transition-fast);
  outline: none;
}

.call-header .call-provider-language .provider-select:first-of-type {
  margin-left: auto;
}

.call-header .call-provider-language .provider-select:hover {
  border-color: var(--accent-warm);
  color: var(--text-bright);
}


/* ── Central Call Interface ── */
.call-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  padding: 2rem;
}


/* ── Audio Visualizer (5 Vertical Bars) ── */
.visualizer-bars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 160px;
}

.visualizer-bar {
  width: 30px;
  height: 20px;
  min-height: 20px;
  max-height: 140px;
  background: #ffffff;
  border-radius: 9999px;
  transition: height 0.08s ease-out;
  will-change: height;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}

/* Idle — center bar tallest, tapers outward */
.visualizer-bars.idle .visualizer-bar {
  animation: idlePulseOuter 2.4s ease-in-out infinite;
}

.visualizer-bars.idle .visualizer-bar:nth-child(3) {
  animation-name: idlePulseCenter;
  animation-delay: 0s;
}

.visualizer-bars.idle .visualizer-bar:nth-child(2) {
  animation-delay: 0.15s;
  animation-name: idlePulseMid;
}

.visualizer-bars.idle .visualizer-bar:nth-child(4) {
  animation-delay: 0.15s;
  animation-name: idlePulseMid;
}

.visualizer-bars.idle .visualizer-bar:nth-child(1) {
  animation-delay: 0.3s;
}

.visualizer-bars.idle .visualizer-bar:nth-child(5) {
  animation-delay: 0.3s;
}

@keyframes idlePulseCenter {
  0%, 100% { height: 28px; opacity: 0.5; }
  50%      { height: 55px; opacity: 0.85; }
}

@keyframes idlePulseMid {
  0%, 100% { height: 22px; opacity: 0.45; }
  50%      { height: 42px; opacity: 0.75; }
}

@keyframes idlePulseOuter {
  0%, 100% { height: 18px; opacity: 0.35; }
  50%      { height: 30px; opacity: 0.6; }
}

.visualizer-bars.active .visualizer-bar {
  animation: none;
  opacity: 1;
}

#visualizer {
  display: none;
}


/* ── Call Button ── */
.call-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid var(--border-muted);
  background: #161a23;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
  position: relative;
}

.call-btn::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
}

.call-btn svg {
  width: 32px;
  height: 32px;
}

.call-btn:hover {
  border-color: var(--accent-warm);
}

.call-btn.active {
  background: var(--color-danger);
  border-color: transparent;
}


/* ── Transcript Sidebar ── */
.transcript-header {
  padding: 1.25rem 2rem;
  background: rgba(10, 12, 18, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  height: 73px;
  border-bottom: 1px solid var(--border-muted);
  gap: 1rem;
}



.transcript-header h2 {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.transcript-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem 1.5rem 6rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  scroll-behavior: smooth;
}

.transcript-entry {
  display: flex;
  flex-direction: column;
  width: 100%;
  animation: slideIn 0.3s ease;
}

.transcript-entry .transcript-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.transcript-entry.agent .transcript-text {
  border-radius: 0 12px 12px 12px;
  border: 1px solid rgba(139, 149, 165, 0.1);
}

.transcript-role.agent {
  color: var(--color-agent);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.transcript-entry.you {
  align-self: flex-end;
}

.transcript-entry.you  .transcript-meta{
  flex-direction: row-reverse;
}

.transcript-entry.you .transcript-text {
  background: rgba(58, 63, 79, 0.25);
  border-radius: 12px 0 12px 12px;
  border: 1px solid rgba(58, 63, 79, 0.3);
  color: #fff;
}

.transcript-role.you {
  color: var(--color-user);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  margin-bottom: 4px;
  text-align: right;
  text-transform: uppercase;
}

/* System — centered */
.transcript-entry.system {
  align-self: center;
  max-width: 100%;
  width: 100%;
}

.transcript-entry.system .transcript-text {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  text-align: center;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.transcript-role.system {
  color: white;
  text-align: center;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: 4px;
}

.transcript-text {
  padding: 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.transcript-time {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-dark);
  margin-top: 6px;
}

.transcript-entry.you .transcript-time {
  text-align: right;
  margin-right: 4px;
}

.transcript-entry.agent .transcript-time {
  text-align: left;
  margin-left: 4px;
}

.transcript-entry.system .transcript-time {
  text-align: center;
}


/* ── Transcript Action Buttons (2×2 grid) ── */
.transcript-actions,
.camera-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
}

.transcript-actions button,
.transcript-text button,
.camera-actions button {
  background: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  color: var(--text-bright);
  padding: 10px 8px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.25s var(--ease-default);
  position: relative;
  overflow: hidden;
}

.transcript-actions button::before,
.transcript-text button::before,
.camera-actions button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(var(--accent-warm-rgb), 0.05), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.transcript-actions button:hover,
.transcript-text button:hover,
.camera-actions button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-warm);
  color: var(--accent-warm);
  box-shadow: 0 4px 15px rgba(var(--accent-warm-rgb), 0.08);
  transform: translateY(-1px);
}

.transcript-actions button:hover::before,
.transcript-text button:hover::before,
.camera-actions button:hover::before {
  opacity: 1;
}

.transcript-actions button:active,
.transcript-text button:active,
.camera-actions button:active {
  transform: translateY(0);
}

.transcript-actions button:only-child,
.camera-actions button:only-child {
  grid-column: 1 / -1;
}


/* ── Camera Modal ── */
.camera-modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border-muted);
  border-radius: 20px;
  width: 92%;
  max-width: 480px;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 40px 80px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  animation: modalSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Top bar */
.camera-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
}

.camera-topbar-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 20px;
  border: 1px solid var(--border-muted);
}

.camera-rec-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-danger);
  box-shadow: 0 0 8px var(--color-danger);
  animation: pulse 1.5s infinite;
}

.camera-topbar-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.camera-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-muted);
  color: var(--text-dim);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  line-height: 1;
}

.camera-close-btn:hover {
  background: var(--color-danger);
  color: white;
  border-color: transparent;
}

/* Viewfinder */
.camera-viewfinder {
  position: relative;
  margin: 0 20px;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 4/3;
  background: #000;
}

#camera-stream {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Corner brackets */
.vf-corner {
  position: absolute;
  width: 36px;
  height: 36px;
  z-index: 10;
  pointer-events: none;
}

.vf-corner::before,
.vf-corner::after {
  content: '';
  position: absolute;
  background: var(--accent-warm);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(var(--accent-warm-rgb), 0.5);
}

/* Horizontal stroke */
.vf-corner::before {
  width: 100%;
  height: 3px;
}

/* Vertical stroke */
.vf-corner::after {
  width: 3px;
  height: 100%;
}

.vf-tl { top: 14px; left: 14px; }
.vf-tl::before { top: 0; left: 0; }
.vf-tl::after  { top: 0; left: 0; }

.vf-tr { top: 14px; right: 14px; }
.vf-tr::before { top: 0; right: 0; }
.vf-tr::after  { top: 0; right: 0; }

.vf-bl { bottom: 14px; left: 14px; }
.vf-bl::before { bottom: 0; left: 0; }
.vf-bl::after  { bottom: 0; left: 0; }

.vf-br { bottom: 14px; right: 14px; }
.vf-br::before { bottom: 0; right: 0; }
.vf-br::after  { bottom: 0; right: 0; }


/* Bottom controls */
.camera-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px 24px;
}

.camera-flip-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-muted);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.camera-flip-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-bright);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Capture button — camera shutter style */
.camera-capture-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

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

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

.capture-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.7);
  transition: border-color 0.2s ease;
}

.camera-capture-btn:hover .capture-ring {
  border-color: white;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.15);
}

.capture-inner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: white;
  display: block;
  transition: background 0.2s ease, transform 0.15s ease;
}

.camera-capture-btn:hover .capture-inner {
  background: #f0f0f0;
}

.camera-capture-btn:active .capture-inner {
  transform: scale(0.88);
  background: #ddd;
}

/* Spacer to balance the flex layout */
.camera-spacer {
  width: 44px;
  height: 44px;
}


/* ── Action Buttons (modal footer) ── */
.action-btn {
  flex: 1;
  padding: 1rem;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: var(--transition-normal);
  text-transform: uppercase;
  border: 1px solid var(--border-muted);
}

.primary-btn {
  background: var(--accent-warm);
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(var(--accent-warm-rgb), 0.3);
}

.primary-btn:hover:not(:disabled) {
  background: #c08a3e;
  box-shadow: 0 8px 25px rgba(var(--accent-warm-rgb), 0.5);
  transform: translateY(-1px);
}

.secondary-btn {
  background: var(--bg-elevated);
  color: var(--text-bright);
}

.secondary-btn:hover {
  background: #1f242f;
  border-color: var(--text-dim);
}


/* ── RESPONSIVE ── */

@media (max-width: 1100px) {
  .transcript-panel {
    width: 340px;
  }
}

@media (min-width: 901px) {
  /* Desktop: restore original aside panel behavior */
  .transcript-panel {
    position: static !important;
    width: 420px;
    height: auto;
    background: var(--bg-panel) !important;
    border-left: 1px solid var(--border-muted) !important;
    border-top: none !important;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5) !important;
    z-index: 20;
    pointer-events: auto !important;
    overflow: visible !important;
    transform: none !important;
  }

  /* Hide drag handle on desktop */
  .transcript-drag-handle {
    display: none;
  }

  .transcript-header {
    background: rgba(10, 12, 18, 0.6);
    border-top: none !important;
    border-bottom: 1px solid var(--border-muted);
    box-shadow: none !important;
    padding: 1.25rem 2rem;
    height: 73px;
  }

  .transcript-list {
    background: var(--bg-panel);
    box-shadow: none;
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scroll-behavior: smooth;
  }
}

@media (max-width: 900px) {
  /* ── Mobile Layout ── */
  body {
    flex-direction: column;
  }

  .call-panel {
    flex: 0 0 40dvh;
    min-height: 300px;
    display: flex;
    flex-direction: column;
  }

  .transcript-panel {
    width: 100%;
    flex: 1;
    min-height: 0;
    border-left: none;
    border-top: 1px solid var(--border-muted);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
  }

  /* ── Header Adjustments for Mobile ── */
  .transcript-header {
    padding: 0.75rem 1.5rem;
    height: 73px;
    flex-shrink: 0;
    gap: 0.75rem;
  }

  .transcript-header h2 {
    flex: 1;
    margin: 0;
  }

  /* ── Header Scaling (from 600px) ── */
  .call-header {
    padding: 0.8rem 1rem;
    gap: 0.3rem; 
  }

  .call-header h1 {
    font-size: 0.65rem;
    letter-spacing: 0.2em;
  }

  .provider-select {
    padding: 0.4rem 0.6rem;
    font-size: 0.6rem;
  }

  .call-body {
    gap: 1.5rem;
    padding: 1rem;
  }

  /* ── Visualizer & Buttons (from 600px) ── */
  .visualizer-bars {
    height: 70px; /* Merged: 70px height */
    gap: 8px;
  }

  .visualizer-bar {
    width: 14px; /* Merged: 14px width */
    max-height: 80px;
  }

  .call-btn {
    width: 40px; /* Merged: smaller 40px button */
    height: 40px;
  }

  .call-btn svg {
    width: 20px;
    height: 20px;
  }

  /* ── Status Pill (from 600px) ── */
  .status-pill {
    padding: 0.4rem 1.2rem;
  }

  .status-pill .status-label {
    font-size: 0.45rem;
  }

  /* ──Transcript Area ── */
  .transcript-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem 1.5rem 6rem 1.5rem;
    gap: 1.5rem;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  .transcript-entry {
    max-width: 92%;
  }

  .transcript-text {
    padding: 0.75rem;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
  }

  .transcript-actions button,
  .transcript-text button,
  .camera-actions button {
    padding: 8px 6px;
    font-size: 0.58rem;
    flex-shrink: 0;
  }

  /* ── Fullscreen Camera ── */
  #camera-modal {
    position: fixed !important;
    inset: 0 !important;
    background: #000 !important;
    backdrop-filter: none !important;
    z-index: 9999 !important;
  }

  .camera-modal-content {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    animation: none !important;
    overflow: hidden !important;
    position: relative !important;
  }

  .camera-topbar {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9998 !important;
    padding: 26px 40px !important;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7) 0%, transparent 100%) !important;
  }

  .camera-viewfinder {
    margin: 0 !important;
    border-radius: 0 !important;
    flex: 1 !important;
    aspect-ratio: auto !important;
    width: 100% !important;
    height: 100% !important;
  }

  .camera-controls {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9998 !important;
    padding: 24px 32px !important;
    padding-bottom: max(64px, env(safe-area-inset-bottom, 24px)) !important;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    pointer-events: auto !important;
  }
}

@media (max-width: 520px) {
  .call-header h1 {
    display: none;
  }
}

@media (max-width: 380px) {
  .provider-select:first-of-type {
    margin-left: 0;
  }

  .visualizer-bar {
    width: 20px;
    max-height: 60px;
  }

  .visualizer-bars {
    gap: 6px;
    height: 80px;
  }
}