@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/*   LIGHT MODE (default) */
:root,
[data-theme="light"] {
    --bg-deep: #f0f4ff;
    --bg-gradient: linear-gradient(135deg, #f0f9ff 0%, #e0fdfe 20%, #fdf4ff 100%);
    --text-primary: #343455;
    --text-muted: #343455;
    --glass-header: rgba(10, 10, 15, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --toggle-active-bg: #249bce;
    --toggle-inactive-bg: rgba(255, 255, 255, 0.07);
    --toggle-container-bg: rgba(15, 15, 20, 0.9);

    /* Start Screen Buttons */
    --lang-btn-bg: #ffffff;
    --lang-btn-border: rgba(36, 155, 206, 0.25);
    --lang-btn-text: #343455;

    /* Start Screen Card */
    --start-card-bg: rgba(255, 255, 255, 0.65);
    --start-card-border: rgba(36, 155, 206, 0.2);
    --start-title: #1e2a3a;
    --start-subtitle: rgba(30, 42, 58, 0.65);
    --start-note: rgba(30, 42, 58, 0.45);

    /* Theme switch */
    --ts-track-bg: rgba(15, 15, 20, 0.88);
    --ts-track-border: rgba(255, 255, 255, 0.12);
    --ts-thumb-bg: #249bce;
    --ts-thumb-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    --ts-label-active: rgba(255, 255, 255, 0.95);
    --ts-label-inactive: rgba(255, 255, 255, 0.35);
    --ts-track-glow: rgba(67, 81, 211, 0.3);

    /* Bubbles */
    --user-bubble-bg: #10455B;
    --bubble-user-text: #ffffff;

    --agent-bubble-bg: #ffffff;
    --bubble-agent-text: #1e293b;

    /* Orb */
    --orb-bg: rgba(15, 15, 20, 0.9);
    --orb-border: rgba(255, 255, 255, 0.15);

    /* Orb Waveform*/
    --orb-wave-color-r: 36;
    --orb-wave-color-g: 155;
    --orb-wave-color-b: 206;

    /* Waveform */
    --wave-bar-color: rgba(58, 90, 138, 0.95);
    --wave-bar-active-color: rgba(17, 7, 150, 0.95);

    /*Text Mode */
    --input-border-color: rgba(36, 155, 206, 0.35);
    --input-focus-border-color: #249bce;
    --input-focus-bg: rgba(36, 155, 206, 0.07);
    --input-text-color: #1e293b;
    --input-placeholder-color: rgba(52, 52, 85, 0.45);

    /*Language Selector */
    --lang-text-color: rgba(255, 255, 255, 0.55);
    --lang-text-hover: rgba(255, 255, 255, 0.85);
    --lang-icon-color: rgba(255, 255, 255, 0.55);
    --lang-icon-hover: rgba(255, 255, 255, 0.85);

    --lang-wrapper-bg: rgba(15, 15, 20, 0.9);
    --lang-wrapper-hover-bg: rgba(15, 15, 20, 0.8);

    /*Scrollbar */
    --scrollbar-thumb: rgba(52, 52, 85, 0.3);
}

/* DARK MODE */
[data-theme="dark"] {
    --bg-deep: #050d1a;
    --bg-gradient: linear-gradient(135deg, #0f172a, #1e293b);
    /* check γτ δεν ειναι οπως πριν */
    --text-primary: #c8deff;
    --text-muted: rgba(150, 190, 255, 0.4);
    --glass-header: rgba(5, 15, 35, 0.75);
    --glass-border: rgba(80, 140, 255, 0.12);
    --toggle-active-bg: #2a5cbf;
    --toggle-inactive-bg: rgba(80, 140, 255, 0.08);
    --toggle-container-bg: rgba(5, 18, 40, 0.95);

    /* Start Screen Buttons */
    --lang-btn-bg: rgba(255, 255, 255, 0.07);
    --lang-btn-border: rgba(255, 255, 255, 0.14);
    --lang-btn-text: rgba(255, 255, 255, 0.88);

    /* Start Screen Card */
    --start-card-bg: rgba(5, 15, 35, 0.75);
    --start-card-border: rgba(80, 140, 255, 0.12);
    --start-title: #c8deff;
    --start-subtitle: rgba(150, 190, 255, 0.65);
    --start-note: rgba(150, 190, 255, 0.35);

    /* Theme switch */
    --ts-track-bg: rgba(5, 18, 40, 0.95);
    --ts-track-border: rgba(80, 140, 255, 0.2);
    --ts-thumb-bg: #3a78f5;
    --ts-thumb-shadow: 0 2px 10px rgba(58, 120, 245, 0.5);
    --ts-label-active: rgba(200, 222, 255, 0.95);
    --ts-label-inactive: rgba(80, 140, 255, 0.35);
    --ts-track-glow: rgba(58, 120, 245, 0.25);

    /* Bubbles */
    --user-bubble-bg: #ffffff;
    --bubble-user-text: #1e293b;

    --agent-bubble-bg: #1e293b;
    --bubble-agent-text: #ffffff;

    /* Orb */
    --orb-bg: rgba(5, 18, 40, 0.95);
    --orb-border: rgba(80, 140, 255, 0.25);

    /* Orb Waveform*/
    --orb-wave-color-r: 80;
    --orb-wave-color-g: 140;
    --orb-wave-color-b: 255;

    /* Waveform */
    --wave-bar-color: rgba(255, 255, 255, 0.3);
    --wave-bar-active-color: rgba(255, 255, 255, 0.9);

    /*Text Mode */
    --input-border-color: rgba(255, 255, 255, 0.25);
    --input-focus-border-color: #1558cc;
    --input-focus-bg: rgba(21, 88, 204, 0.08);
    --input-text-color: #ffffff;
    --input-placeholder-color: rgba(255, 255, 255, 0.4);

    /*Language Selector */
    --lang-text-color: rgba(255, 255, 255, 0.75);
    --lang-text-hover: rgba(255, 255, 255, 0.85);
    --lang-icon-color: rgba(255, 255, 255, 0.5);
    --lang-icon-hover: rgba(255, 255, 255, 0.75);

    --lang-wrapper-bg: rgba(5, 18, 40, 0.95);
    --lang-wrapper-hover-bg: rgba(255, 255, 255, 0.1);

    /*Scrollbar */
    --scrollbar-thumb: rgba(255, 255, 255, 0.2);
}

/* BASE RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-deep);
    background-image: var(--bg-gradient);
    color: var(--text-primary);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    transition: background 0.4s ease, color 0.4s ease;
}

/* Agent Icon */
/* wrapper for icon and status*/
.agent-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    overflow: hidden;      
    min-height: 0;       
}

/* Keeps icon and status centered and grouped */
.agent-center-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    width: 100%;
}

.agent-icon {
    border-radius: 50%;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    overflow: hidden; 
}

/* THEME SWITCH*/
.theme-switch-wrapper {
    position: relative;
    margin-left: auto;
}

.theme-switch {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    outline: none;
}

.theme-switch-track {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 120px;
    height: 36px;
    background: var(--ts-track-bg);
    border: 1px solid var(--ts-track-border);
    border-radius: 100px;
    backdrop-filter: blur(16px);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.35),
        0 0 0 0 var(--ts-track-glow);
    transition:
        background 0.35s ease,
        border-color 0.35s ease,
        box-shadow 0.35s ease;
    overflow: hidden;
    padding: 0 4px;
    gap: 0;
}

/* Sliding thumb */
.theme-switch-thumb {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 54px;
    height: 28px;
    background: var(--ts-thumb-bg);
    border-radius: 100px;
    box-shadow: var(--ts-thumb-shadow);
    transition:
        left 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
        background 0.35s ease,
        box-shadow 0.35s ease;
    z-index: 1;
}

/* Labels */
.theme-label {
    position: relative;
    z-index: 2;
    font-family: 'Outfit', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    width: 54px;
    text-align: center;
    pointer-events: none;
    transition: color 0.3s ease;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.theme-label-light {
    color: #ffffff;
    ;
    /* active in light mode */
}

.theme-label-dark {
    color: rgba(255, 255, 255, 0.35);
}

/* Dark mode state: slides right */
[data-theme="dark"] .theme-switch-thumb {
    left: calc(100% - 58px);
}

[data-theme="dark"] .theme-label-light {
    color: rgba(255, 255, 255, 0.35);
}

[data-theme="dark"] .theme-label-dark {
    color: #ffffff;
}

/* Hover glow */
.theme-switch:hover .theme-switch-track {
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.4),
        0 0 0 3px var(--ts-track-glow);
}

.theme-switch:focus-visible .theme-switch-track {
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.4),
        0 0 0 3px var(--ts-track-glow);
}

/*  Container */
.container {
    width: 100%;
    height: 100%;
    height: 100dvh;
    /* use dynamic viewport on mobile (handles browser chrome) */
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 25px;
}

/* Bottom Footer Controls */
.footer-controls {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
}

.glass-header {
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
}

.status-pill {
    background: var(--glass-header);
    padding: 10px 24px;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.02em;
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    min-width: 160px;
    text-align: center;
    white-space: nowrap;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.35s ease, border-color 0.35s ease;
}



/* Mode Toggle */
.mode-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Language Selector */
.lang-selector-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    align-self: stretch;
    gap: 7px;
    background: var(--lang-wrapper-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0 14px;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
    white-space: nowrap;
}

.lang-selector-wrapper:hover {
    border-color: rgba(255, 255, 255, 0.22);
    background: var(--lang-wrapper-hover-bg);
}

.lang-selector-wrapper:focus-within {
    border-color: rgba(29, 110, 245, 0.6);
    box-shadow: 0 0 0 3px rgba(29, 110, 245, 0.15), 0 4px 24px rgba(0, 0, 0, 0.4);
}

.lang-globe-icon {
    width: 16px;
    height: 16px;
    color: var(--lang-icon-color);
    flex-shrink: 0;
    pointer-events: none;
    transition: color 0.2s ease;
}

.lang-selector-wrapper:hover .lang-globe-icon {
    color: var(--lang-icon-hover);
}

.lang-display-text {
    color: var(--lang-text-color);
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    pointer-events: none;
    min-width: 48px;
    transition: color 0.2s ease;
}

.lang-selector-wrapper:hover .lang-display-text {
    color: var(--lang-text-hover);
}

.lang-chevron {
    width: 8px;
    height: 5px;
    color: rgba(255, 255, 255, 0.35);
    flex-shrink: 0;
    pointer-events: none;
    transition: transform 0.2s ease, color 0.2s ease;
}

.lang-selector-wrapper:hover .lang-chevron {
    color: rgba(255, 255, 255, 0.6);
    transform: translateY(1px);
}

.lang-select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
}

.lang-select option {
    background: #1a1a2e;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    padding: 6px;
}

.mode-toggle {
    display: inline-flex;
    background: var(--toggle-container-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    transition: background 0.35s ease, border-color 0.35s ease;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border: none;
    border-radius: 9px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.55);
    background: transparent;
    transition: background 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.mode-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: opacity 0.22s ease;
}

.mode-btn.active {
    background: var(--toggle-active-bg);
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(29, 110, 245, 0.45);
}

.mode-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
}

/* Main Layout */
.main-content.siri-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0px 28px 20px;
    justify-content: flex-start;
    overflow: hidden;
    min-height: 0;
    /* critical: allows flex children to shrink below content size */
}

/* Transcript / Chat History */
.transcript-section {
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
    flex: 1;
    min-height: 0;
    /* critical: allows it to shrink and scroll in a flex column */
    display: flex;
    flex-direction: column;
    padding-top: 16px;
    padding-right: 18px;
    padding-bottom: 24px;
    padding-left: 18px;
    overflow-y: auto;
    margin-bottom: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

.transcript-section::-webkit-scrollbar {
    width: 6px;
}

.transcript-section::-webkit-scrollbar-track {
    background: transparent;
}

.transcript-section::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    border-radius: 10px;
}

.chat-history-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.active-chunk-text {
    font-size: 1.2rem;
    font-weight: 300;
    line-height: 1.5;
    text-align: center;
    color: var(--text-primary);
    max-width: 90%;
    margin: auto;
    align-self: center;
}

.muted-text {
    color: var(--text-muted);
}

/* Voice Section */
.voice-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
    /* never compress the orb area */
    padding-bottom: 70px;
    /* space above the fixed status pill */
}

.iridescent-container {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    overflow: visible;
    flex-shrink: 0;
}

.voice-agent-trigger {
    position: absolute;
    width: 110px;
    height: 110px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.orb-iridescent {
    position: absolute;
    width: 85px;
    height: 85px;
    border-radius: 50%;
    background: var(--orb-bg);
    box-shadow:
        0 0 0 2px var(--orb-border),
        0 8px 25px rgba(0, 0, 0, 0.45);
    z-index: 1;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.orb-rings {
    display: none;
}

.orbWaveCanvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 160px;
    height: 160px;
    pointer-events: none;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.orbWaveCanvas.active {
    opacity: 1;
}

.mic-overlay {
    position: relative;
    z-index: 5;
    color: white;
}

.mic-overlay svg {
    width: 44px;
    height: 44px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: all 0.3s ease;
}

.voice-agent-trigger.recording .mic-overlay svg {
    color: #ffffff;
    filter: drop-shadow(0 0 10px #ffffff);
    transform: scale(1.1);
}

.voice-agent-trigger:hover .orb-iridescent {
    transform: scale(1.08);
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.25),
        0 0 30px rgba(255, 255, 255, 0.08);
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.voice-agent-trigger:hover .mic-overlay svg {
    transform: scale(1.15);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
    transition: all 0.35s ease;
}

.voice-agent-trigger::before {
    content: '';
    position: absolute;
    width: 85px;
    height: 85px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    transform: scale(1);
    opacity: 0;
    transition: all 0.5s ease;
}

.voice-agent-trigger:hover::before {
    transform: scale(1.5);
    opacity: 1;
    animation: ripple-out 1.2s ease-out infinite;
}

@keyframes ripple-out {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

/* Wave Visualizer */
.voice-visualizer {
    display: none !important;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 40px;
    margin-top: 0;
    flex-shrink: 0;
}

.wave-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    height: 100%;
}

.wave-bar {
    width: 3px;
    height: 15px;
    background: var(--wave-bar-color);
    border-radius: 10px;
    transition: height 0.05s ease;
    flex-shrink: 0;
}

.voice-visualizer.active .wave-bar {
    background: var(--wave-bar-active-color);
}

/* Text Section */
.text-section {
    padding-bottom: 30px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

.text-input-area {
    width: 100%;
}

.siri-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1.5px solid var(--input-border-color);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 4px 4px 4px 16px;
    backdrop-filter: blur(10px);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.siri-input-container:focus-within {
    border-color: var(--input-focus-border-color);
    box-shadow: 0 0 0 3px rgba(21, 88, 204, 0.2);
}

#textInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--input-text-color);
    padding: 10px 0;
    font-size: 1rem;
    font-weight: 400;
    font-family: 'Outfit', sans-serif;
    outline: none;
}

#textInput::placeholder {
    color: var(--input-placeholder-color);
    font-weight: 400;
}

.send-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--toggle-active-bg);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
    color: white;
    display: block;
}

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

.send-btn:hover {
    background: #1d84b0;
    transform: scale(1.05);
}

[data-theme="dark"] .send-btn:hover {
    background: #1558cc;
}

.send-btn:active {
    transform: scale(0.97);
}

.send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.chat-controls {
    display: none;
}

/* Chat Bubbles */
.final-transcript {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    animation: fadeIn 0.3s ease-out;
}

.final-transcript .muted-text {
    display: none;
}

.chat-message-bubble {
    max-width: 78%;
    padding: 12px 16px;
    border-radius: 18px;
    color: white;
    font-size: 0.97rem;
    line-height: 1.55;
    position: relative;
    word-wrap: break-word;
    animation: fadeIn 0.25s ease-out;
    transition: background 0.35s ease;
}

.user-bubble,
.final-user {
    align-self: flex-end;
    background: var(--user-bubble-bg);
    border-bottom-right-radius: 0px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: var(--bubble-user-text);
    max-width: 68%;
}

.agent-bubble,
.final-agent {
    align-self: flex-start;
    background: var(--agent-bubble-bg);
    border: none;
    border-bottom-left-radius: 0px;
    color: var(--bubble-agent-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Markdown in Bubbles — covers marked.js output */
.chat-message-bubble p {
    margin: 0 0 6px 0;
}

.chat-message-bubble p:last-child {
    margin-bottom: 0;
}

.chat-message-bubble strong,
.chat-message-bubble b {
    font-weight: 700;
}

.chat-message-bubble em,
.chat-message-bubble i {
    font-style: italic;
}

.chat-message-bubble ul,
.chat-message-bubble ol {
    margin: 6px 0 4px 0;
    padding-left: 20px;
}

.chat-message-bubble ul {
    list-style: disc;
}

.chat-message-bubble ol {
    list-style: decimal;
}

.chat-message-bubble li {
    margin-bottom: 4px;
    line-height: 1.5;
    display: list-item;
}

.chat-message-bubble li:last-child {
    margin-bottom: 0;
}

.chat-message-bubble li>p {
    margin: 0;
}

/* marked wraps li content in <p> */
.chat-message-bubble h1,
.chat-message-bubble h2,
.chat-message-bubble h3 {
    font-weight: 600;
    margin: 8px 0 4px;
    line-height: 1.3;
}

.chat-message-bubble h1 {
    font-size: 1.15em;
}

.chat-message-bubble h2 {
    font-size: 1.08em;
}

.chat-message-bubble h3 {
    font-size: 1.0em;
}

.chat-message-bubble code {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.88em;
}

.chat-message-bubble pre {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    padding: 10px 14px;
    overflow-x: auto;
    margin: 6px 0;
}

.chat-message-bubble pre code {
    background: transparent;
    padding: 0;
    font-size: 0.85em;
}

.chat-message-bubble blockquote {
    border-left: 3px solid rgba(255, 255, 255, 0.3);
    margin: 6px 0;
    padding-left: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.chat-message-bubble hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin: 8px 0;
}

.chat-message-bubble a {
    color: #6db3f2;
    text-decoration: underline;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

/* Close / Interrupt Button */
.floating-close-btn {
    width: 44px;
    height: 44px;
    background: var(--glass-header);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    backdrop-filter: blur(15px);
    transition: background 0.35s ease;
}

.floating-close-btn.visible {
    display: flex;
}

/* Orb States */
.voice-agent-trigger.recording .orb-iridescent {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    animation: orb-pulse 1.5s ease-in-out infinite;
}

@keyframes orb-pulse {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.15);
    }

    50% {
        box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    }
}

.voice-agent-trigger.speaking .orb-iridescent {
    animation: orb-pulse-vocal 0.5s ease-in-out infinite;
}

@keyframes orb-pulse-vocal {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* ──────────────────────────────────────────────────────
   Animations
────────────────────────────────────────────────────── */
@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 600px) {
    body {
        overflow: hidden;
    }

    .container {
        max-width: 100%;
        padding-bottom: 0;
        height: 100dvh;
    }

    .main-content.siri-layout {
        padding: 0 12px 16px;
    }

    /* Tighten the top toolbar */
    .mode-toggle-wrapper {
        margin-top: 12px;
        margin-bottom: 12px;
        gap: 8px;
    }

    /* Smaller mode buttons on mobile */
    .mode-btn {
        padding: 7px 12px;
        font-size: 0.82rem;
        gap: 5px;
    }

    /* Slightly smaller language selector */
    .lang-selector-wrapper {
        padding: 0 10px;
    }

    .lang-display-text {
        font-size: 0.82rem;
        min-width: 38px;
    }

    /* Smaller theme toggle */
    .theme-switch-track {
        width: 80px;
        height: 32px;
    }

    .theme-switch-thumb {
        width: 36px;
        height: 24px;
    }

    [data-theme="dark"] .theme-switch-thumb {
        left: calc(100% - 40px);
    }

    .theme-label {
        width: 36px;
    }

    /* Transcript fills remaining space, orb never gets squeezed */
    .transcript-section {
        border-radius: 12px;
        padding: 12px 12px 20px 12px;
        margin-bottom: 8px;
    }

    .active-chunk-text {
        font-size: 1rem;
    }

    /* Smaller orb on mobile */
    .iridescent-container {
        width: 110px;
        height: 110px;
    }

    .orb-iridescent {
        width: 72px;
        height: 72px;
    }

    .mic-overlay svg {
        width: 36px;
        height: 36px;
    }

    /* Voice section padding adjusted for smaller screen + fixed pill */
    .voice-section {
        padding-bottom: 76px;
    }

    /* Bubbles */
    .chat-message-bubble {
        max-width: 92%;
        font-size: 0.93rem;
    }

    .user-bubble,
    .final-user {
        max-width: 84%;
    }

    /* Status pill smaller */
    .status-pill {
        min-width: 140px;
        font-size: 0.78rem;
        padding: 8px 18px;
    }

    .footer-controls {
        bottom: 16px;
    }

    /* In text mode: push the input field above the fixed pill + close button.
       Pill height ~40px + bottom offset 16px + gap = ~90px clearance */
    .text-section {
        padding-bottom: 90px;
    }

    /* In voice mode: the orb already has padding-bottom, status pill
       sits at bottom: 16px — no extra clearance needed */
    .voice-section {
        padding-bottom: 80px;
    }

    /* Header: icon-only on mobile — hide text labels, keep icons */
    .mode-btn {
        padding: 8px 12px;
        gap: 0;
    }

    .mode-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Hide the text nodes inside mode buttons */
    .mode-btn {
        font-size: 0;
    }

    /* collapses text but keeps svg */
    .mode-btn svg {
        font-size: initial;
    }

    /* reset so svg isn't affected */

    /* Hide language display text, show globe + chevron only */
    .lang-display-text {
        display: none;
    }

    .lang-selector-wrapper {
        padding: 0 10px;
        gap: 4px;
    }

    /* Tighten mode toggle gap */
    .mode-toggle-wrapper {
        gap: 6px;
    }
}

.chat-section {
    display: none;
}

/* ══════════════════════════════════════════════
   Start Screen Overlay
══════════════════════════════════════════════ */
.start-screen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: var(--bg-deep);
    background-image: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    overflow-y: auto;
}

.start-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Card — desktop */
.start-content {
    background: var(--start-card-bg);
    border: 1px solid var(--start-card-border);
    padding: 44px 40px 36px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(30px);
    width: min(620px, 90vw);
    color: var(--start-title);
    animation: fadeIn 0.45s ease-out;
}

.start-content h2 {
    font-size: 1.85rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--start-title);
    line-height: 1.25;
}

.start-subtitle {
    font-size: 1rem;
    color: var(--start-subtitle);
    margin-bottom: 28px;
}

/* Desktop: 3 columns */
.lang-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.lang-grid-btn {
    background: var(--lang-btn-bg);
    border: 1px solid var(--lang-btn-border);
    padding: 13px 10px;
    border-radius: 12px;
    color: var(--lang-btn-text);
    font-size: 0.92rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
    line-height: 1.3;
    word-break: break-word;
}

.lang-grid-btn:hover,
.lang-grid-btn:focus-visible {
    background: var(--toggle-active-bg);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(29, 110, 245, 0.45);
    outline: none;
}

.lang-grid-btn:active {
    transform: translateY(0);
}

.start-note {
    font-size: 0.82rem;
    color: var(--start-note);
}

/* ── Mobile: fullscreen card, 2-column grid ── */
@media (max-width: 600px) {
    .start-screen {
        align-items: flex-start;
        padding: 0;
    }

    .start-content {
        width: 100%;
        min-height: 100dvh;
        border-radius: 0;
        border: none;
        padding: 48px 20px 32px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        box-shadow: none;
        background: var(--bg-deep);
        background-image: var(--bg-gradient);
        backdrop-filter: none;
    }

    .start-content h2 {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }

    .start-subtitle {
        font-size: 0.9rem;
        margin-bottom: 22px;
    }

    /* Guaranteed 2 columns on any phone */
    .lang-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        width: 100%;
        max-width: 400px;
        margin-bottom: 20px;
    }

    .lang-grid-btn {
        padding: 14px 8px;
        font-size: 0.85rem;
        border-radius: 10px;
    }

    .start-note {
        font-size: 0.76rem;
    }
}

/* ══════════════════════════════════════════════
   Written Summary Panel  (Feature 1)
══════════════════════════════════════════════ */
.written-summary-panel {
    width: 100%;
    box-sizing: border-box;
    background: var(--agent-bubble-bg);
    border: 1px solid rgba(36, 155, 206, 0.20);
    border-left: 3px solid #249bce;
    border-radius: 14px;
    padding: 14px 18px 16px;
    margin-top: 6px;
    animation: slideUpFade 0.35s ease-out;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.07);
    transition: background 0.35s ease;
    /* Never let the card overflow its column */
    overflow: hidden;
}

[data-theme="dark"] .written-summary-panel {
    border-color: rgba(80, 140, 255, 0.22);
    border-left-color: #3a78f5;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.28);
}

.written-summary-header {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
    font-size: 0.70rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #249bce;
}

[data-theme="dark"] .written-summary-header {
    color: #5ba8ff;
}

.written-summary-header svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: 0.9;
}

.written-summary-body {
    font-size: 0.91rem;
    line-height: 1.65;
    color: var(--bubble-agent-text);
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Reset paragraph margins injected by marked.js */
.written-summary-body p {
    margin: 0 0 5px 0;
}
.written-summary-body p:last-child {
    margin-bottom: 0;
}

.written-summary-body ul,
.written-summary-body ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Each bullet uses position:relative + padding-left so the dot stays
   vertically aligned regardless of whether marked.js wraps content in <p>. */
.written-summary-body li {
    position: relative;
    padding-left: 16px;
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* The <p> that marked.js injects inside <li> must have zero margin */
.written-summary-body li > p {
    margin: 0;
    display: inline;   /* keeps the text flowing inline with bold spans */
}

/* Coloured bullet dot — absolutely placed so it never disrupts text flow */
.written-summary-body li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #249bce;
    flex-shrink: 0;
}

[data-theme="dark"] .written-summary-body li::before {
    background: #5ba8ff;
}

.written-summary-body strong,
.written-summary-body b {
    font-weight: 700;
}

/* Nuclear reset: if any GFM table leaks through, display it as stacked rows */
.written-summary-body table {
    width: 100%;
    border-collapse: collapse;
    border: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.written-summary-body thead { display: none; }
.written-summary-body tbody { display: flex; flex-direction: column; gap: 6px; }
.written-summary-body tr {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border: none;
    background: none;
}
.written-summary-body td,
.written-summary-body th {
    display: inline;
    border: none;
    padding: 0;
    background: none;
    word-break: break-word;
}

/* ══════════════════════════════════════════════
   Follow-Up Question Chips  (Features 3 & 4)
══════════════════════════════════════════════ */
.shared-followup-container {
    width: 100%;
    margin-top: auto;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
}

.followup-question {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    opacity: 0.85;
    text-align: left;
    line-height: 1.4;
    margin-bottom: 4px;
    width: 100%;
    max-width: 100%;
    word-break: break-word;
    animation: slideUpFade 0.4s ease-out;
}

.followup-area {
    width: 100%;
    margin-top: 8px;
    animation: slideUpFade 0.45s ease-out;
}

.followup-label {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
}

.followup-chip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1.5px solid transparent;
    font-family: 'Outfit', sans-serif;
    font-size: 0.90rem;
    font-weight: 500;
    cursor: pointer;
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease;
    line-height: 1.45;
    text-align: left;
    word-break: break-word;
    overflow-wrap: break-word;
    animation: slideUpFade 0.4s ease-out;
}

.followup-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
}

.followup-chip:active {
    transform: translateY(0);
    box-shadow: none;
}

/* SVG icon inside chip */
.followup-chip .chip-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-top: 1px;
}

.followup-chip .chip-icon svg {
    width: 18px;
    height: 18px;
}

.followup-chip .chip-text {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Arrow icon on the right */
.followup-chip .chip-arrow {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    opacity: 0.45;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.followup-chip .chip-arrow svg {
    width: 16px;
    height: 16px;
}

.followup-chip:hover .chip-arrow {
    opacity: 0.85;
    transform: translateX(2px);
}

/* Type A — Knowledge Expansion (blue) */
.followup-chip--A {
    background: rgba(36, 155, 206, 0.09);
    border-color: rgba(36, 155, 206, 0.30);
    color: #1482ae;
}
[data-theme="dark"] .followup-chip--A {
    background: rgba(58, 120, 245, 0.10);
    border-color: rgba(58, 120, 245, 0.30);
    color: #7bb8ff;
}
.followup-chip--A:hover {
    background: rgba(36, 155, 206, 0.16);
    border-color: rgba(36, 155, 206, 0.55);
}

/* Type B — Practical Application (emerald green) */
.followup-chip--B {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.28);
    color: #047857;
}
[data-theme="dark"] .followup-chip--B {
    background: rgba(16, 185, 129, 0.10);
    border-color: rgba(16, 185, 129, 0.30);
    color: #6ee7b7;
}
.followup-chip--B:hover {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.52);
}

/* Type C — Scenario-Based (amber/orange) */
.followup-chip--C {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.28);
    color: #b45309;
}
[data-theme="dark"] .followup-chip--C {
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.26);
    color: #fcd34d;
}
.followup-chip--C:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.52);
}

/* Type D — Knowledge Check (violet/purple) */
.followup-chip--D {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.26);
    color: #6d28d9;
}
[data-theme="dark"] .followup-chip--D {
    background: rgba(167, 139, 250, 0.10);
    border-color: rgba(167, 139, 250, 0.28);
    color: #c4b5fd;
}
.followup-chip--D:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.52);
}

/* ══════════════════════════════════════════════
   Coaching Badge  (Feature 5)
══════════════════════════════════════════════ */
.coaching-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.70rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 3px 10px 3px 7px;
    border-radius: 100px;
    opacity: 0.85;
    background: rgba(0, 0, 0, 0.055);
    color: var(--text-muted);
    border: 1px solid rgba(0, 0, 0, 0.07);
    transition: background 0.35s ease;
}

.coaching-badge svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    opacity: 0.75;
}

[data-theme="dark"] .coaching-badge {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.10);
}

/* ══════════════════════════════════════════════
   Shared Animation
══════════════════════════════════════════════ */
@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile adjustments for new panels */
@media (max-width: 600px) {
    .written-summary-panel {
        padding: 12px 13px;
        border-radius: 12px;
    }

    .followup-chip {
        font-size: 0.84rem;
        padding: 8px 14px;
    }
}

/* Active Chunk Display layout */
.active-chunk-text {
    font-size: 1.12rem;
    line-height: 1.55;
    color: var(--text-primary);
    max-width: 85%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.active-chunk-user {
    font-size: 0.88rem;
    color: var(--text-muted);
    opacity: 0.88;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 6px;
    width: fit-content;
    margin: 0 auto 4px auto;
    letter-spacing: 0.02em;
}

.active-chunk-user strong {
    color: var(--text-primary);
    font-weight: 500;
}

.active-chunk-agent-speaking {
    font-size: 1.22rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-primary);
    animation: slideUpFade 0.28s ease;
}

.active-chunk-status {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    opacity: 0.82;
}

.speaking-text {
    color: var(--text-primary);
}

.status-text {
    font-style: italic;
    color: var(--text-primary);
    animation: pulseGlow 2.5s infinite ease-in-out;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.75; }
    50% { opacity: 0.98; }
}

/* Toast Notification Styles */
.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translate(-50%, 20px);
    background: rgba(20, 20, 20, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    letter-spacing: 0.01em;
}

[data-theme="light"] .toast-notification {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1a1a1a;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.toast-notification.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

.toast-icon {
    flex-shrink: 0;
    color: #3b82f6;
}

/* Language Selector Pending State */
.lang-selector-wrapper.pending {
    border-color: rgba(245, 158, 11, 0.6) !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.25), 0 4px 24px rgba(0, 0, 0, 0.4) !important;
    background: rgba(245, 158, 11, 0.05) !important;
}

.lang-selector-wrapper.pending .lang-globe-icon {
    color: #f59e0b !important;
    animation: spinGlobe 3s linear infinite;
}

.lang-selector-wrapper.pending .lang-display-text {
    color: #f59e0b !important;
}

.lang-selector-wrapper.pending .lang-chevron {
    color: #f59e0b !important;
}

@keyframes spinGlobe {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

