/* =========================================================
   0) RESET
========================================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; width: 100%; }

/* =========================================================
   1) PAGE BACKGROUND + CENTERING (DESKTOP)
========================================================= */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;

  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
}

/* =========================================================
   2) APP FRAME (DEFAULT = DESKTOP PHONE-LIKE)
========================================================= */
.container {
  width: min(360px, 100vw);
  height: min(800px, 100dvh);

  background-image: url("images/brenda-background.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);

  display: flex;
  flex-direction: column;
  min-height: 0;

  padding: 14px 14px 10px;
}

/* =========================================================
   3) TOP / MIDDLE / BOTTOM LAYOUT
========================================================= */
.header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 40px;  /* intentional */
}

.header-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}

.header-title-block{
  display:flex;
  flex-direction:column;
  gap:6px;
  flex: 1;
  min-width: 0;
}

.header-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.header-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e5e7eb;
}

.header h1 {
  color: #333;
  font-size: 1.6em;
  margin: 0;
}

.subjects-btn{
  align-self:flex-start;
  padding:6px 12px;
  border-radius:8px;
  border:1px solid rgba(0,0,0,0.12);
  background:#bfe1f8;
  color:#0f172a;
  font-weight:700;
  font-size:16px;
  cursor:pointer;
}

.subjects-btn:hover{
  background:#7eff7e;
  border-color:rgba(27, 148, 78, 0.32);
}

.start-btn{
  align-self:flex-start;
  padding:6px 12px;
  border-radius:8px;
  border:1px solid rgba(37,99,235,0.22);
  background:#ffff00;
  color:#0f172a;
  font-weight:700;
  font-size:16px;
  cursor:pointer;
  
}

.start-btn:hover{
  background:#7eff7e;
  border-color:rgba(27, 148, 78, 0.32);
}

.start-btn:active{
  transform:translateY(1px);
}

.start-btn:disabled{
  opacity:0.6;
  cursor:not-allowed;
  transform:none;
}

/* Main needs positioning context for overlay/tile */
.main {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Unified transcript layout blocks */
.mode-visual { flex: 0 0 auto; }

.panel-transcript {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.mode-input { flex: 0 0 auto; }

/* Text input wrapper toggled by mode */
.text-input-wrap.hidden { display: none !important; }

.panel {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.panel-talk { flex: 1; min-height: 0; }
.hidden { display: none !important; }

/* Bottom controls stick to bottom */
.activate-buttons-frame {
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

.row { display: flex; gap: 14px; }
.row:first-child { margin-bottom: 2px; }

.column {
  flex: 1;
  padding: 2px;
  background-color: #ffffff;
  border: 0px solid #ddd;
  border-radius: 8px;
  text-align: center;
}
.column p { margin: 0; color: #555; font-size: 0.92em; }

/* =========================================================
   4) TALK MODE (WAVEFORM)
========================================================= */
.voice-visualizer {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  padding: 10px;
  background: #fafafa;
  border-radius: 12px;
  border: 1px solid #eee;
  margin-bottom: 12px;
}

#waveform {
  display: block;
  width: 100%;
  height: 60px;
}

/* =========================================================
   5) SHARED TRANSCRIPT
========================================================= */
.transcript {
  flex: 1;
  min-height: 0;
  overflow-y: auto;

  background: #f9f9f9;
  border-radius: 10px;
  padding: 12px;
  color: #333;

  font-size: 1em;
  line-height: 1.3;

  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.transcript-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: flex-end;
  min-height: 100%;
}

.transcript-inner:empty::before {
  content: attr(data-placeholder);
  color: #999;
}

/* =========================================================
   6) TEXT INPUT
========================================================= */
.chat-inputbar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-top: 8px;
}

.chat-input {
  flex: 1;
  resize: none;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #ddd;
  font-size: 1em;
  line-height: 1.3;
  min-height: 44px;
  max-height: 120px;
  outline: none;
}

.chat-send {
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 0;
  font-weight: 800;
  cursor: pointer;
  background: #16a34a;
  color: #fff;
}
.chat-send:disabled { opacity: 0.6; cursor: not-allowed; }

/* =========================================================
   7) BUBBLES
========================================================= */
.bubble {
  max-width: 85%;
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 0.98em;
  white-space: pre-wrap;
  word-break: break-word;

  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bubble-header {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.75;
  line-height: 1.05;
  margin: 0;
  padding: 0;
}

.bubble-body {
  margin: 0;
  padding: 0;
  line-height: 1.3;
}

.bubble.user {
  margin-left: auto;
  background: #dcf8c6;
  color: #111;
  border-top-right-radius: 6px;
  text-align: left;
}

.bubble.ai {
  margin-right: auto;
  background: #fff;
  color: #111;
  border-top-left-radius: 6px;
  text-align: left;
}

/* =========================================================
   8) BUTTONS (BOTTOM BAR)
========================================================= */
.btn-toggle-talk,
.btn-toggle-text {
  height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  border: 0;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  flex: 1;
}

.btn-toggle-talk:disabled,
.btn-toggle-text:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-connect-talk { background: #16a34a; color: #fff; }
.btn-disconnect-talk { background: #dc2626; color: #fff; }
.btn-connect-text { background: #5b5db1; color: #fff; }
.btn-disconnect-text { background: #dc2626; color: #fff; }

/* =========================================================
   8.5) CALL OVERLAY + MINIMISED TILE
========================================================= */
.call-connecting {
  position: absolute;
  left: 0;
  right: 0;
  top: 92px;
  bottom: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.connecting-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 0, 0.88);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  color: #0b0b0b;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.connecting-label { font-size: 16px; line-height: 1.1; }

.connecting-dots {
  display: inline-flex;
  align-items: flex-end;
  gap: 6px;
}

.connecting-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0b0b0b;
  opacity: 0.4;
  animation: dotJump 1s infinite ease-in-out;
}

.connecting-dot:nth-child(2) { animation-delay: 0.12s; }
.connecting-dot:nth-child(3) { animation-delay: 0.24s; }

@keyframes dotJump {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.call-overlay {
  position: absolute;
  left: 0;
  right: 0;
  /* overlay covers the transcript area visually */
  top: 92px;      /* below waveform block (fits your current layout) */
  bottom: 0;      /* stays within .main */
  z-index: 50;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

.call-card {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  border: 2px solid rgba(0,0,0,0.08);
  background: rgba(50, 220, 200, 0.95);
  position: relative;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.call-min-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: none;
  background: rgba(255,255,255,0.18);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.call-card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  text-align: center;
}

.call-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,0.8);
}

.call-title {
  font-size: 44px;
  font-weight: 500;
  line-height: 1.0;
  color: #0b0b0b;
}

.call-hang-btn {
  margin-top: 30px;
  width: 110px;
  height: 110px;
  border-radius: 24px;
  border: none;
  background: transparent;
  color: #0b0b0b;
  cursor: pointer;
  display: grid;
  place-items: center;
  position: relative;
  padding: 0;
  isolation: isolate;
  --countdown-ratio: 0;
}

.call-hang-progress {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  background: url("images/WhiteRing-115x115.png") center / contain no-repeat;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 150ms ease;
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.35));
  -webkit-mask-image: conic-gradient(#000 0deg calc(var(--countdown-ratio, 0) * 360deg), transparent calc(var(--countdown-ratio, 0) * 360deg) 360deg);
  mask-image: conic-gradient(#000 0deg calc(var(--countdown-ratio, 0) * 360deg), transparent calc(var(--countdown-ratio, 0) * 360deg) 360deg);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: cover;
  mask-size: cover;
}

.call-hang-btn.countdown-active .call-hang-progress {
  opacity: 1;
}

@supports not (mask-image: conic-gradient(#000 0deg 360deg)) {
  .call-hang-progress {
    -webkit-mask-image: none;
    mask-image: none;
  }
}

.call-hang-icon {
  width: 100px;
  height: 100px;
  object-fit: contain;
  position: relative;
  z-index: 2;
  display: block;
}

/* Minimized tile */
.call-tile {
  position: absolute;
  z-index: 60;
  right: 12px;
  top: 22px; /* near the waveform area */
  width: 58px;
  height: 58px;
  border-radius: 12px;
  background: rgba(50, 220, 200, 0.95);
  border: 2px solid rgba(0,0,0,0.08);
  display: grid;
  place-items: center;
}

.call-expand-btn {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}

/* =========================================================
   9) MOBILE/TABLET: FULL-SCREEN + NO PAGE DRAG
========================================================= */
@media (max-width: 768px) {
  body {
    padding: 0 !important;
    margin: 0 !important;
    align-items: stretch !important;

    overflow: hidden !important;
    overscroll-behavior: none !important;
  }

  .container {
    position: fixed !important;
    inset: 0 !important;

    width: 100vw !important;
    height: 100dvh !important;

    background-image: url("images/brenda-background.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    border-radius: 16px;
    box-shadow: none !important;
    overflow: hidden !important;

    display: flex;
    flex-direction: column;
    min-height: 0;

    padding: 12px 12px 10px !important;
  }

  .call-tile { right: 12px; top: 22px; }
}

/* =========================================================
   10) ACCOUNT BUTTON (TOP RIGHT)
========================================================= */
.header-right { display:flex; align-items:center; }

.account-btn{
  flex-shrink:0;
  height:32px;
  padding:6px 12px;
  border-radius:8px;
  border:1px solid rgba(0,0,0,0.10);
  background:rgba(255, 255, 255, 0.85);
  color:#0f172a;
  font-weight:700;
  font-size:16px;
  cursor:pointer;
}

.account-btn:hover{
  background:#7eff7e;
  border-color:rgba(27, 148, 78, 0.32);
}

/* =========================================================
   11) AUTH OVERLAY
========================================================= */

/* Backdrop */
.auth-overlay{
  position:absolute;
  inset:0;
  z-index:80;
  display:grid;
  place-items:center;
  padding:14px;
  background:rgba(0,0,0,0.35);
}

/* The popup card (≈80% viewport, capped at 288x640) */
.auth-card{
  width:min(90vw, 320px);
  height:min(90vh, 680px);

  background:#ffffff;           /* 0% transparency */
  border:1px solid #444;        /* thin dark grey border */
  border-radius:18px;

  overflow:hidden;

  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;

  padding:22px 18px 18px;
  text-align:center;
}

/* Optional close button (if you show it) */
.auth-close{
  position:absolute;
  top:10px;
  right:10px;
  width:40px;
  height:40px;
  border-radius:10px;
  border:1px solid rgba(0,0,0,0.12);
  background:#fff;
  color:#111;
  font-size:22px;
  cursor:pointer;
}

/* Top content */
.auth-top{
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  padding-top:6px;
}

.auth-avatar{
  width:150px;        /* Was 92px */
  height:150px;        /* Was 92px */
  border-radius:50%;
  object-fit:cover;
  border:2px solid rgba(0,0,0,0.08);
}

/* Title / subtitle fonts */
.auth-greeting{
  font-family:"Montserrat", sans-serif;
  font-weight:700;              /* Bold 700 */
  font-size:22px;
  line-height:1.2;
  color:#111;
  margin:2px 0 6px;
}

.auth-explain{
  font-family:"Montserrat", sans-serif;
  font-weight:400;              /* Regular 400 */
  font-size:14px;
  line-height:1.35;
  color:#444;
  max-width:240px;
  margin:0 0 0px;
}

/* Form layout */
.auth-form{
  width:100%;
  margin-top:12px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;  /* Was 10px */
}

/* Labels (if present) */
.auth-label{
  width:100%;
  text-align:left;
  font-family:"Montserrat", sans-serif;
  font-weight:400;
  font-size:12px;
  color:#444;
  margin-top:2px;
}

/* Inputs (white + dark border) */
.auth-input{
  width:100%;
  height:52px;
  border-radius:10px;
  border:1px solid #555;
  background:#fff;
  padding:0 14px;

  outline:none;

  font-family:"Nunito Sans", sans-serif; /* placeholders + input */
  font-weight:400;
  font-size:16px;
  color:#111;
}

.auth-input::placeholder{
  font-family:"Nunito Sans", sans-serif;
  font-weight:400;
  color:#8a8a8a;
}

/* Help text under fields */
.auth-help{
  width:100%;
  text-align:center;
  font-family:"Montserrat", sans-serif;
  font-weight:400;
  font-size:12px;
  line-height:1.25;
  color:#666;
  margin-top:-6px; /* keeps it close to the input */
}

/* Continue button gradient */
.auth-continue{
  width:100%;
  height:52px;
  border-radius:10px;
  border:none;
  cursor:pointer;

  background:linear-gradient(90deg, #17BF5A 0%, #2F7CF1 100%);
  color:#fff;

  font-family:"Open Sans", sans-serif;   /* Semi-Bold 600 */
  font-weight:600;
  font-size:16px;

  margin-top:4px;  /* Was 6px */
  margin-bottom:0px;
}

.auth-continue:disabled{
  opacity:0.6;
  cursor:not-allowed;
}

/* Error line */
.auth-error{
  width:100%;
  min-height:18px;
  margin-top:8px;
  font-family:"Montserrat", sans-serif;
  font-weight:400;
  font-size:12px;
  color:#b00020;
}

/* Links */
.auth-anon-link{
  margin-top:0px;  /* Was 12px */
  line-height:1.2; /* Reduces vertical height */
  border:none;
  background:transparent;
  cursor:pointer;

  font-family:"Roboto", sans-serif;   /* footer links */
  font-weight:400;
  font-size:13px;
  color:#2F7CF1;
  text-decoration:underline;
  padding:0;
}

.auth-privacy{
  margin-top:12px;  /* Was 10px*/
  line-height:1.2;  /* New */
  font-family:"Roboto", sans-serif;   /* footer links */
  font-weight:400;
  font-size:13px;
  color:#2F7CF1;
  text-decoration:underline;
}

/* Keep it centered on small screens too */
/* Was (max-width: 768px) */
@media (max-width:720px){
  .auth-card{
    padding:18px 16px 0px; /* was 22px 18px 18px */
  }
  .auth-overlay{ padding:12px; }
}

/* ===== Auth overlay spacing FIX ===== */

/* Reduce bottom padding of the card */
.auth-card{
  padding-bottom: 10px !important;
}

/* Pull links closer to Continue button */
.auth-anon-link{
  margin-top: 0px !important;
}

.auth-privacy{
  margin-top: 2px !important;
}

/* If still tight on short screens, pull links upward */
@media (max-height: 720px){
  .auth-anon-link{
    margin-top: 0 !important;
  }
  .auth-privacy{
    margin-top: 6px !important;
  }
}

/* =========================================================
   12) SUBJECTS OVERLAY
========================================================= */
.subjects-overlay{
  position:absolute;
  inset:0;
  z-index:70;
  display:grid;
  place-items:center;
  padding:14px;
  background:rgba(0,0,0,0.45);
}

.subjects-card{
  width:min(90vw, 320px);
  background:#ffffff;
  border:1px solid #d4d4d8;
  border-radius:16px;
  box-shadow:0 10px 28px rgba(0,0,0,0.18);
  padding:18px 18px 14px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.subjects-card-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}

.subjects-card-header h1{
  margin:0;
  font-size:20px;
  color:#111;
}

.subjects-close-btn{
  width:36px;
  height:36px;
  border-radius:10px;
  border:1px solid rgba(0,0,0,0.12);
  background:#fff;
  color:#111;
  font-size:18px;
  cursor:pointer;
}

.subjects-subtitle{
  margin:0 0 4px;
  font-size:14px;
  color:#444;
  font-weight:600;
  line-height:1.3;
}

.subjects-form{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.subject-field{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:13px;
  color:#333;
}

.subject-label{
  font-weight:700;
  color:#1f2937;
}

.subject-field input{
  height:42px;
  border-radius:10px;
  border:1px solid #cbd5e1;
  padding:0 12px;
  font-size:14px;
  color:#0f172a;
  background:#fff;
}

.subjects-actions{
  display:flex;
  gap:10px;
  margin-top:8px;
}

.subjects-btn-cancel,
.subjects-btn-save{
  flex:1;
  height:44px;
  border-radius:10px;
  border:1px solid transparent;
  cursor:pointer;
  font-weight:700;
  font-size:15px;
}

.subjects-btn-cancel{
  background:#f3f4f6;
  color:#111827;
  border-color:#e5e7eb;
}

.subjects-btn-save{
  background:linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
  color:#fff;
}

.subjects-status{
  min-height:18px;
  font-size:12px;
  color:#2563eb;
  margin-top:4px;
}
