/* ── Theme ─────────────────────────────────────────────── */

:root {
    --bs-primary-rgb: 79, 70, 229;          /* indigo-600 */
    --bs-primary: #4f46e5;
    --bs-primary-bg-subtle: #eef2ff;
    --bs-link-color: #4f46e5;
    --bs-link-hover-color: #3730a3;
    --bs-body-font-family: 'Outfit', 'Segoe UI', system-ui, sans-serif;
    --bs-body-font-weight: 300;
    --bs-body-color: #d1d5db;
    --bs-body-bg: #021b5b;
    --bs-border-radius: 0.5rem;
    --bs-border-radius-lg: 0.75rem;
    --app-navbar-bg: #010f33;
    --app-navbar-height: 3.5rem;
    --app-max-width: 1200px;
}

/* ── Base ──────────────────────────────────────────────── */

strong { font-weight: 600; }

body {
    background-color: var(--bs-body-bg);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

h1, h2, h3, h4, h5, h6 {
    color: #e2e8f0;
    font-weight: 600;
}

h1:focus {
    outline: none;
}

/* ── Validation ────────────────────────────────────────── */

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #22c55e;
}

.invalid {
    outline: 1px solid #ef4444;
}

.validation-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.darker-border-checkbox.form-check-input {
    border-color: #94a3b8;
}

/* ── Form floating label placeholders ─────────────────── */

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ── Buttons ───────────────────────────────────────────── */

button {
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

/* Bootstrap's .btn-close ships as a hardcoded black SVG background, which goes
   invisible on dark backgrounds (e.g. session-error-overlay) and is faint on
   pale ones (e.g. alert-warning). Rebuild the X via mask-image so its color
   tracks `currentColor` — every alert variant already sets its text color for
   readable contrast against its own background, so the X inherits the same
   contrast automatically. Works for any future alert/background combo.
 */
.btn-close {
    background: none !important;
    /* Bootstrap explicitly sets `color: #000` on .btn-close itself, which would make
       `currentColor` resolve to black regardless of the alert's color. Force inherit
       so currentColor below tracks the alert's text color. */
    color: inherit !important;
    -webkit-mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
    mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: 1em;
    mask-size: 1em;
    background-color: currentColor !important;
}

.btn-primary {
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-bg: #3730a3;
    --bs-btn-hover-border-color: #3730a3;
    --bs-btn-active-bg: #312e81;
    --bs-btn-focus-shadow-rgb: 79, 70, 229;
}

/* ── Cards ─────────────────────────────────────────────── */

.card {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    transform: translateY(-1px);
}

/* ── Navbar ─────────────────────────────────────────────── */

.app-navbar {
    --bs-navbar-bg: var(--app-navbar-bg);
    background-color: var(--app-navbar-bg) !important;
    height: var(--app-navbar-height);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    z-index: 200;
}

.app-navbar-inner {
    height: 100%;
    display: flex !important;
    align-items: center;
    flex-wrap: nowrap;
    padding-left: 1rem;
    padding-right: 1rem;
}

.app-navbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    min-width: 0;
}

.app-navbar-user {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

/* Browser-side brand cluster: Emblem (gradient mark) + LogoType (Third Wheel wordmark)
   sit side-by-side on the left of the top bar. Sized to match the B1 design comp's
   proportions against a 56px (3.5rem) bar height. */
.app-brand-emblem {
    display: block;
    height: 2rem;
    width: auto;
}

.app-brand-logotype {
    display: block;
    height: 0.75rem;
    width: auto;
}

/* SignInBrowser pill: the SVG carries its own border, avatar icon, and "Sign in" text.
   The anchor is just a transparent wrapper that fits the pill's natural width. */
.app-signin-pill {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: none;
    background: transparent;
    text-decoration: none;
    line-height: 0;
}

.app-signin-pill img {
    display: block;
    height: 2rem;
    width: auto;
}

.app-signin-pill:active { opacity: 0.7; }

/* Hamburger / settings button in the web top bar. The base button styling
   (transparent bg, no visible border, body-color text, btn-sm padding) comes
   entirely from Bootstrap's .btn + .btn-sm under our :root variable overrides
   — no base rule needed here. We only need to add a hover effect, since
   plain .btn (without a variant class like .btn-primary) defines no hover
   shift of its own. */
.app-hamburger-btn:hover {
    color: #f9fafb;
    background: rgba(255, 255, 255, 0.08);
}

/* Back button in the web top bar. Like .app-hamburger-btn it leans on Bootstrap's .btn/.btn-sm
   base under our :root overrides and only needs a hover shift. Sits to the left of the brand and
   self-hides (component-side) when there is nothing to go back to. */
.app-back-btn {
    display: inline-flex;
    align-items: center;
    margin-right: 0.25rem;
}

.app-back-btn:hover {
    color: #f9fafb;
    background: rgba(255, 255, 255, 0.08);
}

/* User dropdown in the web top bar: on hover/focus, brighten the text to white
   but leave the background as-is (transparent over the dropdown panel's own
   dark navy fill). Bootstrap's stock --bs-dropdown-link-hover-bg is a light
   tertiary tint that reads as a stark white block on a dark-themed dropdown. */
.app-navbar .dropdown-menu {
    --bs-dropdown-link-hover-color: #ffffff;
    --bs-dropdown-link-hover-bg: transparent;
}

.app-nav-user {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
}

.app-btn-ghost {
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    font-size: 0.875rem;
    padding: 0.3rem 0.875rem;
    border-radius: 0.375rem;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.app-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.35);
    color: white;
}

/* ── Account Section ────────────────────────────────────── */

.app-account-section {
    flex: 1;
    display: flex;
    align-items: start;
    justify-content: center;
    margin: 2rem;
}

.app-account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-around;
    width: 80%;
}

.app-account-btn {
    min-width: 9rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--bs-border-radius-lg);
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    flex-grow: 1;
}

.app-account-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ── Scroll lock ────────────────────────────────────────── */

/* Prevent document-level overscroll/bounce globally.
   Each modal backdrop also carries touch-action:none so touching
   the backdrop never scrolls the background — see per-component CSS. */
html, body {
    overscroll-behavior: none;
}

/* ── Text selection ─────────────────────────────────────── */

* {
    user-select: none;
    -webkit-user-select: none;
}

input, textarea, [contenteditable], .bubble-text, .bubble-text * {
    user-select: text;
    -webkit-user-select: text;
}

.admin-page * {
    user-select: text;
    -webkit-user-select: text;
}

/* Error alert boxes: allow copying the message/stack trace. */
.alert-danger, .alert-danger * {
    user-select: text;
    -webkit-user-select: text;
}

/* ── Main ───────────────────────────────────────────────── */

.app-main {
    flex: 1;
}

/* ── Blazor error boundary ─────────────────────────────── */

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: var(--bs-border-radius);
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* ── Settings voice-type rows (used inside SettingsDrawer) ── */

.settings-voice-type-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.settings-voice-type-list.settings-disabled {
    opacity: 0.45;
    pointer-events: none;
}

.settings-voice-type-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--bs-border-radius);
}

.settings-voice-type-name {
    flex: 1;
    font-weight: 500;
    font-size: 0.9375rem;
    color: #e2e8f0;
}

.settings-voice-type-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.settings-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.settings-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    margin: 0;
}

.settings-toggle-track {
    position: relative;
    width: 52px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    transition: background 0.2s ease;
}

.settings-toggle input:checked + .settings-toggle-track {
    background: #16a34a;
}

.settings-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}

.settings-toggle input:checked + .settings-toggle-track .settings-toggle-thumb {
    transform: translateX(22px);
}

.settings-offset-input {
    width: 5rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    text-align: right;
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
}

.settings-offset-input:disabled {
    background: rgba(255, 255, 255, 0.03);
    color: #64748b;
}

.settings-offset-label {
    font-size: 0.8125rem;
    color: #94a3b8;
}

/* ── Speech bubble layout ───────────────────────────────── */

.bubble-outer {
    display: flex;
}

.bubble-outer--left { justify-content: flex-start; }
.bubble-outer--right { justify-content: flex-end; }
.bubble-outer--center { justify-content: center; }

.bubble-clickable {
    cursor: pointer;
}

.bubble-wrap {
    width: 90%;
    position: relative;
    margin-top: 10px;
}

.bubble-wrap--center { width: 92%; }

.split-panel .bubble-wrap         { width: 82%; }
.split-panel .bubble-wrap--center { width: 84%; }

.bubble-bridge {
    position: absolute;
    top: -1px;
    left: 8px;
    width: 20px;
    height: 3px;
    z-index: 4;
}

.bubble-icon-circle {
    position: absolute;
    top: -7px;
    left: 5px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid;
    z-index: 5;
}

.bubble-body {
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    border: 1px solid;
    z-index: 1;
}

.bubble-glow-left {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    pointer-events: none;
    z-index: 2;
}

.bubble-glow-right {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    pointer-events: none;
    z-index: 2;
}

.bubble-grad-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    pointer-events: none;
    z-index: 6;
    -webkit-mask-image: linear-gradient(to bottom, white, transparent);
    mask-image: linear-gradient(to bottom, white, transparent);
}

.bubble-grad-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    pointer-events: none;
    z-index: 6;
    -webkit-mask-image: linear-gradient(to top, white, transparent);
    mask-image: linear-gradient(to top, white, transparent);
}

.bubble-text {
    padding: 10px 14px 11px;
    font-size: 14.5px;
    line-height: 1.55;
    color: #b0b4bc;
    position: relative;
    z-index: 1;
}
.bubble-text p { margin: 0 0 0.4em; }
.bubble-text p:last-child { margin-bottom: 0; }
.bubble-text ul, .bubble-text ol { margin: 0.2em 0 0.4em 1.2em; padding: 0; }
.bubble-text li { margin-bottom: 0.15em; }

.bubble-float-spacer {
    float: left;
    width: 21px;
    height: 8px;
    margin-right: 5px;
}

/* Palette: Left (gray) */
.bubble-palette-left .bubble-bridge { background: #1c1f28; }
.bubble-palette-left .bubble-icon-circle {
    background: #1c1f28;
    border-color: #3a4260;
    box-shadow: 0 0 16px rgba(139,149,176,0.44), 0 0 7px rgba(139,149,176,0.32);
}
.bubble-palette-left .bubble-body { background: #1c1f28; border-color: #3a4260; }
.bubble-palette-left .bubble-glow-left { background: linear-gradient(to right, rgba(160,175,230,0.38), transparent); }

/* Palette: Right (green) */
.bubble-palette-right .bubble-bridge { background: #18301f; }
.bubble-palette-right .bubble-icon-circle {
    background: #18301f;
    border-color: #2a4c3a;
    box-shadow: 0 0 14px rgba(74,222,128,0.33), 0 0 5px rgba(74,222,128,0.21);
}
.bubble-palette-right .bubble-body { background: #18301f; border-color: #2a4c3a; }
.bubble-palette-right .bubble-glow-right { background: linear-gradient(to left, rgba(90,240,140,0.40), transparent); }

/* Palette: Center (blue) */
.bubble-palette-center .bubble-bridge { background: #152442; }
.bubble-palette-center .bubble-icon-circle {
    background: #152442;
    border-color: #2a4570;
    box-shadow: 0 0 14px rgba(123,166,226,0.33), 0 0 5px rgba(123,166,226,0.21);
}
.bubble-palette-center .bubble-body { background: #152442; border-color: #2a4570; }
.bubble-palette-center .bubble-glow-left { background: linear-gradient(to right, rgba(120,170,255,0.40), transparent); }
.bubble-palette-center .bubble-glow-right { background: linear-gradient(to left, rgba(120,170,255,0.40), transparent); }

/* ── Bubble interior elements ───────────────────────────── */

.session-transcript-sender {
    font-weight: 600;
    color: #d0d4dc;
    margin-right: 0.2rem;
}

.audio-parts-list {
    margin-top: 0.35rem;
    padding-left: 0;
}

.audio-parts-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.1rem 0.4rem;
    font-size: 0.8125rem;
    color: #8b95b0;
    line-height: 1.5;
}

.audio-parts-name {
    font-weight: 600;
    color: #b0b4bc;
}

.audio-parts-detail {
    color: #64748b;
}

.audio-parts-offset {
    color: #6b7280;
    font-size: 0.75rem;
}

.audio-parts-toggle {
    color: #8b95b0;
    font-size: 0.75rem;
}

.bubble-text--has-replay {
    padding-bottom: 36px;
}

.bubble-replay-btn {
    position: absolute;
    bottom: 4px;
    right: 9px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 0;
    margin: 0;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    color: #8b95b0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    line-height: 1;
}

.bubble-flag-btn {
    position: absolute;
    bottom: 4px;
    right: 9px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 0;
    margin: 0;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    color: #8b95b0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    line-height: 1;
}

.bubble-flag-btn--with-replay { right: 45px; }

.audio-simultaneous-indicator {
    display: block;
    font-size: 0.75rem;
    color: #8b95b0;
    margin-top: 0.15rem;
}
