/* static/styles.css */

/* ──────────────────────────────────────────────────────────────────────────── */
/* Theme Variables */
/* ──────────────────────────────────────────────────────────────────────────── */
:root {
    /* Colors */
    --color-primary: #0047ab;
    --color-on-primary: #ffffff;
    --color-text: #333333;
    --color-muted: #888888;
    --gradient-bg: linear-gradient(to bottom right, #c2e9fb, #ffdde1);
    --gradient-accent: linear-gradient(to right, #00aaff, #4facfe);
  
    /* Typography */
    --font-family-heading: 'Fredoka One', cursive;
    --font-family-body: 'Merriweather', serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.75rem;
    --line-height-base: 1.5;
  
    /* Elevation Shadows */
    --shadow-low:    0 1px 4px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.10);
    --shadow-high:   0 8px 24px rgba(0, 0, 0, 0.15);
  
    /* New waveform colors */
    --wave-start: #3E0A6F;   /* deep indigo */
    --wave-end:   #008F6B;   /* rich teal */
  }
  
  /* Utility Classes */
  .hidden { display: none !important; }
  
  /* ──────────────────────────────────────────────────────────────────────────── */
  /* Reset & Base */
  /* ──────────────────────────────────────────────────────────────────────────── */
  html {
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    font-family: var(--font-family-body);
    color: var(--color-text);
  }
  
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #f5f7fa;
  }
  
  /* ──────────────────────────────────────────────────────────────────────────── */
  /* Elevation Utility Classes */
  /* ──────────────────────────────────────────────────────────────────────────── */
  .elevation-1 { box-shadow: var(--shadow-low); }
  .elevation-2 { box-shadow: var(--shadow-medium); }
  .elevation-3 { box-shadow: var(--shadow-high); }
  
  /* ──────────────────────────────────────────────────────────────────────────── */
  /* Card container */
  /* ──────────────────────────────────────────────────────────────────────────── */
  #main-bg {
    position: absolute;
    top: 40px; right: 40px; bottom: 40px; left: 40px;
    background: var(--gradient-bg);
    border-radius: 16px;
    transition: right .3s, left .3s;
    z-index: 0;
  }
  
  body.detail-open #main-bg {
    right: calc(40% + 40px);
  }
  
  /* ──────────────────────────────────────────────────────────────────────────── */
  /* Intro */
  /* ──────────────────────────────────────────────────────────────────────────── */
  #intro {
    position: absolute;
    top: 200px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 400px);
    max-width: 600px;
    text-align: center;
    transition: left .3s;
    z-index: 2;
  }
  
  body.detail-open #intro {
    left: calc((100% - 40%) / 2 - 20px);
  }
  
  #intro .avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: url('https://static.vecteezy.com/system/resources/previews/011/588/809/non_2x/woman-with-headphones-and-microphone-customer-support-call-center-illustration-vector.jpg') center/cover no-repeat;
    box-shadow: var(--shadow-medium);
  }
  
  #intro .greeting {
    font-family: var(--font-family-heading);
    font-size: var(--font-size-xl);
    color: var(--color-primary);
    margin-bottom: 8px;
  }
  
  #intro .subtitle {
    font-family: var(--font-family-body);
    font-size: var(--font-size-base);
    color: var(--color-text);
    opacity: .85;
    max-width: 60vw;
    margin: 0 auto;
    line-height: var(--line-height-base);
  }
  
  /* ──────────────────────────────────────────────────────────────────────────── */
  /* Overlay Tint */
  /* ──────────────────────────────────────────────────────────────────────────── */
  #bg-overlay {
    display: none;
    position: absolute;
    top: 40px; right: 40px; bottom: 40px; left: 40px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    z-index: 1;
  }
  
  #bg-overlay.active {
    display: block;
  }
  
  body.detail-open #bg-overlay {
    right: calc(40% + 40px);
  }
  
  /* ──────────────────────────────────────────────────────────────────────────── */
  /* Chat Container */
  /* ──────────────────────────────────────────────────────────────────────────── */
  #chat-container {
    position: absolute;
    top: 40px; bottom: 140px;
    left: 50%; transform: translateX(-50%);
    width: calc(100% - 400px); max-width: 700px;
    display: flex; flex-direction: column-reverse; gap: 8px;
    padding: 0 16px; overflow-y: auto;
    z-index: 3; transition: left .3s, width .3s;
  }
  
  body.detail-open #chat-container {
    left: calc((100% - 40%) / 2 - 20px);
    width: calc(60% - 40px);
  }
  
  .message {
    /* higher opacity, no blur for better perf */
    background-color: rgba(255, 255, 255, 0.85);
    /* cheaper box-shadow only */
    box-shadow: var(--shadow-medium);
  
    padding: 10px 14px;
    border-radius: 16px;
    max-width: 75%;
    word-wrap: break-word;
    /* box-shadow: var(--shadow-low); */
  }
  
  .user-message {
    /* subtle blue tint */
    border: 1px solid rgba(0, 71, 171, 0.6);
    /* background: #CDE4F7; */
    align-self: flex-end;
    /* subtle colored glow */
    filter: drop-shadow(0 2px 6px rgba(0, 71, 171, 0.3));
  }
  
  .bot-message {
    /* subtle peach tint */
    border: 1px solid rgba(247, 225, 195, 0.6);
    /* background: #F7E1C3; */
    align-self: flex-start;
  
    filter: drop-shadow(0 2px 6px rgba(247, 225, 195, 0.3));
  }
  
  .interim {
    opacity: .6;
  }
  
  /* ──────────────────────────────────────────────────────────────────────────── */
  /* Input Bar */
  /* ──────────────────────────────────────────────────────────────────────────── */
  #input-bar {
    position: absolute;
    bottom: 60px;
    left: 50%; transform: translateX(-50%);
    width: calc(100% - 400px); max-width: 700px;
    background: #ffffff;
    padding: 12px 20px;
    border-radius: 30px;
    box-shadow: var(--shadow-medium);
    display: flex; align-items: center; gap: 12px;
    overflow: hidden;
    z-index: 4; transition: left .3s, width .3s;
  }
  
  body.detail-open #input-bar {
    left: calc((100% - 40%) / 2 - 20px);
    width: calc(60% - 40px);
  }
  
  #input-placeholder {
    flex: 1;
    color: var(--color-muted);
    font-size: var(--font-size-sm);
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  #text-fallback {
    flex: 1;
    border: none;
    outline: none;
    font-size: var(--font-size-base);
    font-family: var(--font-family-body);
  }
  
  .thinking {
    color: var(--color-primary);
    font-style: italic;
  }
  
  #input-bar button {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--color-text);
    cursor: pointer;
  }
  
  #input-bar .accent {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 4px;
    background: var(--gradient-accent);
  }
  
  /* ──────────────────────────────────────────────────────────────────────────── */
  /* Details Panel */
  /* ──────────────────────────────────────────────────────────────────────────── */
  #details-panel {
    position: absolute;
    top: 40px; bottom: 40px; right: 40px;
    width: calc(40% - 40px);
    background: #ffffff;
    padding: 16px;
    border-radius: 16px;
    box-shadow: var(--shadow-high);
    overflow-y: auto;
    display: none;
    z-index: 6;
    transition: opacity .3s;
    font-family: var(--font-family-body);
    line-height: var(--line-height-base);
  }
  
  #details-panel.active {
    display: block;
    opacity: 1;
  }
  
  #details-panel header {
    font-weight: bold;
    font-size: var(--font-size-lg);
    margin-bottom: 8px;
  }
  
  #details-panel h2 {
    font-size: 1.4rem;
    margin: 1rem 0 .5rem;
    color: var(--color-primary);
  }
  
  #details-panel h3 {
    font-size: 1.2rem;
    margin: .75rem 0 .25rem;
    color: var(--color-text);
  }
  
  .detail-label {
    font-weight: bold;
    margin-top: 12px;
    margin-bottom: 4px;
  }
  
  .detail-entry {
    margin-bottom: 8px;
  }
  
  .detail-separator {
    border: none;
    border-top: 1px solid #cccccc;
    margin: 8px 0;
  }
  
  /* ──────────────────────────────────────────────────────────────────────────── */
  /* Responsive & Mobile-First Enhancements */
  /* ──────────────────────────────────────────────────────────────────────────── */
  @media (max-width: 768px) {
    #main-bg { top: 2rem; right: 2rem; bottom: 2rem; left: 2rem; }
    body.detail-open #main-bg { right: calc(40% + 2rem); }
  
    #intro { top: 10vw; left: 50%; transform: translateX(-50%); width: 90vw; }
  
    #chat-container { left: 2rem; width: calc(100% - 4rem); }
    #input-bar { left: 2rem; width: calc(100% - 4rem); }
  
    #details-panel { display: none; }
  }
  
  /* ──────────────────────────────────────────────────────────────────────────── */
  /* Touch-Friendly Controls */
  /* ──────────────────────────────────────────────────────────────────────────── */
  #input-bar button {
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease, background-color 0.2s ease;
  }
  
  #input-bar button:active {
    transform: scale(0.9);
    background-color: rgba(0, 0, 0, 0.1);
  }

  /* ──────────────────────────────────────────────────────────────────────────── */
  /* Start Button */
  /* ──────────────────────────────────────────────────────────────────────────── */
  #start-btn {
    margin-top: 48px;
    padding: 0.5rem 1rem;
    font-size: var(--font-size-base);
    border: none;
    border-radius: 8px;
    background: var(--gradient-accent);
    color: var(--color-on-primary);
    cursor: pointer;
  }
  #start-btn:hover {
    opacity: 0.9;
  }

  /* ──────────────────────────────────────────────────────────────────────────── */
  /* Stop Button (power icon) */
  /* ──────────────────────────────────────────────────────────────────────────── */
  #stop-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--color-text);
    cursor: pointer;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease, background-color 0.2s ease;
  }
  #stop-btn:active {
    transform: scale(0.9);
    background-color: rgba(0, 0, 0, 0.1);
  }  
