/* ==========================================================================
   Go2Market Voice Studio
   Palette: Go2Market orange + navy
   ========================================================================== */
:root {
    --orange: #E8611D;
    --orange-2: #E56F3B;
    --orange-dark: #C8500F;
    --orange-soft: #FDEEE6;
    --navy: #0F1C3F;
    --navy-2: #1B2B5B;
    --ink: #1A2340;
    --muted: #6B7590;
    --line: #E4E7F0;
    --bg: #F5F6FA;
    --card: #FFFFFF;
    --ok: #1B9A6F;
    --danger: #D64545;
    --radius: 14px;
    --font: 'Plus Jakarta Sans', 'Noto Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-script: 'Plus Jakarta Sans', 'Noto Sans Devanagari', 'Noto Sans Bengali', 'Noto Sans Tamil', 'Noto Sans Telugu',
        'Noto Sans Gujarati', 'Noto Sans Kannada', 'Noto Sans Malayalam', 'Noto Sans Gurmukhi', 'Noto Sans Oriya', system-ui, sans-serif;
    --player-h: 0px;
}

* { -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    padding-bottom: var(--player-h);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
body.has-player { --player-h: 84px; }
main { flex: 1 0 auto; }
.min-w-0 { min-width: 0; }
.script-text, .clip-native, .pl-native, .view-native, .lang-native { font-family: var(--font-script); }

:focus-visible { outline: 3px solid rgba(232, 97, 29, .45); outline-offset: 2px; }

/* ---- Bootstrap theming --------------------------------------------------- */
.btn { font-weight: 600; border-radius: 10px; padding: .55rem 1rem; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.btn-primary {
    --bs-btn-bg: var(--orange); --bs-btn-border-color: var(--orange); --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--orange-dark); --bs-btn-hover-border-color: var(--orange-dark); --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #A94509; --bs-btn-active-border-color: #A94509;
    --bs-btn-disabled-bg: var(--orange); --bs-btn-disabled-border-color: var(--orange);
    --bs-btn-focus-shadow-rgb: 232, 97, 29;
}
.btn-outline-navy {
    --bs-btn-color: var(--navy); --bs-btn-border-color: #C9D0E4; --bs-btn-bg: #fff;
    --bs-btn-hover-bg: var(--navy); --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: var(--navy);
    --bs-btn-active-bg: var(--navy-2); --bs-btn-active-color: #fff;
}
.btn-light { --bs-btn-bg: #EEF0F7; --bs-btn-border-color: #EEF0F7; --bs-btn-hover-bg: #E2E6F2; --bs-btn-hover-border-color: #E2E6F2; }
.btn-link { color: var(--orange-dark); text-decoration: none; font-weight: 600; }
.btn-link:hover { color: var(--orange); text-decoration: underline; }
.form-control, .form-select { border-radius: 10px; border-color: #D5DAE8; padding: .6rem .85rem; }
.form-control:focus, .form-select:focus { border-color: var(--orange); box-shadow: 0 0 0 .22rem rgba(232, 97, 29, .16); }
.form-label { font-weight: 600; font-size: .875rem; color: var(--navy); margin-bottom: .35rem; }
.form-check-input:checked { background-color: var(--orange); border-color: var(--orange); }
.form-check-input:focus { border-color: var(--orange); box-shadow: 0 0 0 .2rem rgba(232, 97, 29, .18); }
.form-range { accent-color: var(--orange); }
.form-range::-webkit-slider-thumb { background: var(--orange); }
.form-range::-moz-range-thumb { background: var(--orange); }
.form-range:focus::-webkit-slider-thumb { box-shadow: 0 0 0 .25rem rgba(232, 97, 29, .25); }
.progress-bar { background-color: var(--orange); }
.modal-content { border: 0; border-radius: 18px; box-shadow: 0 30px 80px rgba(15, 28, 63, .28); }
.modal-header { border-bottom: 1px solid var(--line); padding: 1.1rem 1.4rem; }
.modal-footer { border-top: 1px solid var(--line); padding: .9rem 1.4rem; }
.modal-body { padding: 1.3rem 1.4rem; }
.modal-title { font-size: 1.15rem; font-weight: 700; color: var(--navy); margin: 0; }
.modal-backdrop.show { background: #0F1C3F; opacity: .55; }
.modal-sm-plus { --bs-modal-width: 400px; }
.page-link { color: var(--navy); border-radius: 10px !important; margin: 0 .15rem; border-color: var(--line); font-weight: 600; }
.page-item.active .page-link { background: var(--orange); border-color: var(--orange); color: #fff; }
.page-link:hover { color: var(--orange-dark); background: var(--orange-soft); }

/* ---- Top bar ------------------------------------------------------------- */
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: .7rem 0; position: sticky; top: 0; z-index: 1030; }
.brand { display: flex; align-items: center; gap: .85rem; text-decoration: none; color: var(--navy); }
.brand-fallback { font-weight: 800; font-size: 1.3rem; color: var(--orange); }
.brand-sep { width: 1px; height: 24px; background: var(--line); }
.brand-product { font-weight: 700; color: var(--navy); font-size: 1rem; }

/* ---- Hero ----------------------------------------------------------------- */
.hero {
    background:
        radial-gradient(700px 260px at 92% -10%, rgba(232, 97, 29, .38), transparent 70%),
        linear-gradient(180deg, var(--navy) 0%, #14244F 100%);
    color: #fff;
    padding: 2.6rem 0 4.2rem;
}
.hero-title { font-size: clamp(1.7rem, 3.2vw, 2.5rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; max-width: 18ch; margin: 0 0 .8rem; }
.hero-sub { color: #C3CCE6; max-width: 52ch; margin: 0; line-height: 1.6; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; border-left: 1px solid rgba(255, 255, 255, .14); }
.stats > div { padding: .2rem 1rem; border-right: 1px solid rgba(255, 255, 255, .14); }
.stats dt { font-size: .78rem; font-weight: 500; color: #AEB9D9; margin-bottom: .25rem; }
.stats dd { font-size: 1.9rem; font-weight: 800; margin: 0; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats dd small { font-size: .95rem; font-weight: 600; color: #AEB9D9; }

/* ---- Toolbar -------------------------------------------------------------- */
.main { margin-top: -2.3rem; padding-bottom: 3rem; }
.toolbar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: 0 10px 30px rgba(15, 28, 63, .08); position: relative; z-index: 2; }
.search { position: relative; }
.search > i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .form-control { padding-left: 2.5rem; padding-right: 2.4rem; }
.search kbd { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); background: #EEF0F7; color: var(--muted); font-size: .72rem; padding: .1rem .45rem; border-radius: 6px; }
.btn-tool { background: #fff; border: 1px solid #D5DAE8; color: var(--navy); padding: .55rem .75rem; border-radius: 10px; }
.btn-group .btn-tool:first-child { border-radius: 10px 0 0 10px; }
.btn-group .btn-tool:last-child { border-radius: 0 10px 10px 0; margin-left: -1px; }
.btn-tool:hover { background: var(--orange-soft); border-color: var(--orange-2); color: var(--orange-dark); }
.btn-tool[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
#fFav[aria-pressed="true"] { background: var(--orange); border-color: var(--orange); }
.toolbar-meta { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: .85rem; padding-top: .85rem; border-top: 1px solid var(--line); font-size: .9rem; }
.result-count { color: var(--muted); }
.selection { display: flex; align-items: center; gap: .75rem; font-weight: 600; color: var(--navy); }

/* ---- Results -------------------------------------------------------------- */
.results { margin-top: 1.5rem; min-height: 280px; transition: opacity .15s; }
.results.is-loading { opacity: .55; pointer-events: none; }
.state-box { text-align: center; padding: 4rem 1rem; color: var(--muted); }
.state-box .state-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--orange-soft); color: var(--orange); display: grid; place-items: center; font-size: 1.7rem; margin: 0 auto 1rem; }
.state-box h2 { font-size: 1.15rem; color: var(--navy); font-weight: 700; }
.state-box p { max-width: 42ch; margin: .4rem auto 1.2rem; }

/* ---- Clip card ------------------------------------------------------------ */
.clip { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); height: 100%; display: flex; flex-direction: column; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.clip:hover { border-color: #C9D0E4; box-shadow: 0 8px 24px rgba(15, 28, 63, .07); }
.clip.is-current { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(232, 97, 29, .14); }
.clip-head { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; background: linear-gradient(90deg, #F1F3FA, #F8F9FD); border-bottom: 1px solid var(--line); }
.clip.is-current .clip-head { background: var(--orange-soft); }
.clip-check { margin: 0; display: grid; place-items: center; }
.clip-check input { width: 1.1rem; height: 1.1rem; margin: 0; cursor: pointer; accent-color: var(--orange); }
.clip-lang { min-width: 0; flex: 1; line-height: 1.2; }
.clip-native { display: block; font-size: 1.35rem; font-weight: 700; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-code { font-size: .75rem; color: var(--muted); font-weight: 500; }
.icon-btn { background: transparent; border: 0; width: 34px; height: 34px; border-radius: 9px; color: var(--muted); display: inline-grid; place-items: center; font-size: 1rem; transition: background .12s, color .12s; }
.icon-btn:hover { background: #EAEDF6; color: var(--navy); }
.icon-btn.danger:hover { background: #FBE9E9; color: var(--danger); }
.icon-btn.fav.on { color: #F2A100; }
.clip-body { padding: 1rem 1rem .4rem; flex: 1; }
.clip-title { font-weight: 700; font-size: 1rem; color: var(--navy); margin: 0 0 .35rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-text { color: var(--muted); font-size: .9rem; line-height: 1.6; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-family: var(--font-script); }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .75rem; }
.chip { font-size: .75rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px; background: #EEF0F7; color: var(--navy-2); display: inline-flex; align-items: center; gap: .3rem; }
.chip.accent { background: var(--orange-soft); color: var(--orange-dark); }

.clip-player { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; }
.play-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--orange); color: #fff; font-size: 1.35rem; display: grid; place-items: center; transition: background .15s, transform .1s; box-shadow: 0 6px 14px rgba(232, 97, 29, .32); }
.play-btn:hover { background: var(--orange-dark); }
.play-btn:active { transform: scale(.94); }
.play-btn i { line-height: 1; }
.play-btn .bi-play-fill { margin-left: 2px; }
.wave-wrap { flex: 1; min-width: 0; }
.wave { display: flex; align-items: center; gap: 2px; height: 34px; cursor: pointer; }
.wave span { flex: 1; min-width: 2px; border-radius: 2px; background: #D3D9EA; transition: background .1s; }
.wave span.on { background: var(--orange); }
.wave-time { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-top: .2rem; font-variant-numeric: tabular-nums; }
.clip-actions { display: flex; align-items: center; justify-content: space-between; padding: .35rem .6rem .6rem; border-top: 1px solid var(--line); margin-top: .1rem; }
.clip-actions .when { font-size: .75rem; color: var(--muted); padding-left: .4rem; }

/* ---- Table view ----------------------------------------------------------- */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.clip-table { margin: 0; min-width: 860px; }
.clip-table th { font-size: .78rem; font-weight: 600; color: var(--muted); background: #F8F9FD; border-bottom: 1px solid var(--line); white-space: nowrap; padding: .8rem .9rem; }
.clip-table td { vertical-align: middle; padding: .7rem .9rem; border-color: var(--line); font-size: .9rem; }
.clip-table tr.is-current td { background: var(--orange-soft); }
.clip-table .play-btn { width: 36px; height: 36px; font-size: 1.1rem; box-shadow: none; }
.clip-table .t-title { font-weight: 700; color: var(--navy); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-table .t-text { color: var(--muted); max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-script); }
.clip-table .t-lang { font-weight: 700; color: var(--navy); font-family: var(--font-script); white-space: nowrap; }
.clip-table .t-lang small { display: block; font-family: var(--font); font-weight: 500; color: var(--muted); font-size: .72rem; }

/* ---- Sticky player -------------------------------------------------------- */
.player-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040; background: var(--navy); color: #fff; box-shadow: 0 -10px 30px rgba(15, 28, 63, .25); border-top: 3px solid var(--orange); }
.player-bar[hidden] { display: none; }
.player-inner { display: grid; grid-template-columns: minmax(180px, 1.1fr) auto minmax(220px, 2fr) auto; align-items: center; gap: 1.2rem; min-height: 81px; }
.pl-info { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.pl-native { flex: none; min-width: 46px; height: 46px; padding: 0 .6rem; border-radius: 12px; background: rgba(255, 255, 255, .1); display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; }
.pl-text { min-width: 0; line-height: 1.25; }
.pl-text strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.pl-text small { color: #AEB9D9; }
.pl-controls { display: flex; align-items: center; gap: .3rem; }
.pl-btn { background: transparent; border: 0; color: #fff; width: 38px; height: 38px; border-radius: 50%; font-size: 1.15rem; display: grid; place-items: center; }
.pl-btn:hover { background: rgba(255, 255, 255, .12); }
.pl-btn:disabled { opacity: .35; }
.pl-btn.pl-main { background: var(--orange); width: 46px; height: 46px; font-size: 1.5rem; }
.pl-btn.pl-main:hover { background: var(--orange-2); }
.pl-seek { display: flex; align-items: center; gap: .7rem; font-size: .78rem; color: #C3CCE6; font-variant-numeric: tabular-nums; }
.pl-seek .form-range { flex: 1; }
.pl-extra { display: flex; align-items: center; gap: .6rem; }
.pl-extra .form-select { width: 82px; background-color: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .2); padding: .3rem 1.6rem .3rem .6rem; --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }
.pl-extra .form-select option { color: #111; }
.pl-extra .form-range { width: 90px; }

/* ---- Modals: form / view / delete / bulk ---------------------------------- */
.pace-out { color: var(--orange-dark); font-weight: 700; }
.range-scale { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); }
.note { display: flex; gap: .6rem; padding: .75rem .9rem; border-radius: 10px; font-size: .88rem; align-items: flex-start; }
.note-warn { background: var(--orange-soft); color: #7A3510; }
.note i { margin-top: .1rem; }
.view-head .view-native { flex: none; min-width: 56px; height: 56px; padding: 0 .8rem; border-radius: 14px; background: var(--orange-soft); color: var(--orange-dark); display: grid; place-items: center; font-weight: 700; font-size: 1.2rem; }
.view-audio { height: 46px; accent-color: var(--orange); }
.section-label { font-size: .82rem; font-weight: 700; color: var(--muted); margin: 0 0 .5rem; }
.view-text { background: #F8F9FD; border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; line-height: 1.8; white-space: pre-wrap; max-height: 220px; overflow: auto; }
.details { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .9rem 1.2rem; margin: 0; }
.details dt { font-size: .75rem; color: var(--muted); font-weight: 500; }
.details dd { margin: .1rem 0 0; font-weight: 600; color: var(--navy); word-break: break-word; }
.del-icon { width: 64px; height: 64px; border-radius: 50%; background: #FBE9E9; color: var(--danger); display: grid; place-items: center; font-size: 1.6rem; margin: 0 auto; }
.bulk-progress { height: 8px; border-radius: 99px; background: #E9ECF5; }
.lang-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.lang-list li { display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.lang-list li.is-running { border-color: var(--orange); background: var(--orange-soft); }
.lang-list li.is-done { border-color: #BFE6D6; background: #F2FBF7; }
.lang-list li.is-failed { border-color: #F0C2C2; background: #FDF3F3; }
.lang-list .lang-native { font-weight: 700; color: var(--navy); }
.lang-list .lang-name { font-size: .75rem; color: var(--muted); display: block; line-height: 1.1; }
.lang-list .lang-status { margin-left: auto; font-size: .75rem; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.is-done .lang-status { color: var(--ok); }
.is-failed .lang-status { color: var(--danger); }
.is-running .lang-status { color: var(--orange-dark); }

/* ---- Toasts --------------------------------------------------------------- */
#toasts { bottom: 0; transition: bottom .2s; z-index: 1090; }
body.has-player #toasts { bottom: 84px; }
.toast { border: 0; border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 28, 63, .25); background: var(--navy); color: #fff; }
.toast .toast-body { display: flex; align-items: center; gap: .6rem; font-weight: 500; }
.toast.t-ok .bi { color: #4FD1A5; }
.toast.t-err { background: #7F1D1D; }
.toast .btn-close { filter: invert(1); margin-right: .6rem; }

.site-foot { padding: 1.5rem 0 2rem; color: var(--muted); font-size: .85rem; text-align: center; }

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 991.98px) {
    .stats { grid-template-columns: repeat(2, 1fr); border-left: 0; row-gap: 1rem; }
    .stats > div { border-left: 1px solid rgba(255, 255, 255, .14); border-right: 0; }
    .player-inner { grid-template-columns: 1fr auto; row-gap: .4rem; padding-top: .6rem; padding-bottom: .6rem; }
    .pl-seek { grid-column: 1 / -1; order: 3; }
    .pl-extra { justify-content: flex-end; grid-column: 1 / -1; order: 4; display: none; }
    body.has-player { --player-h: 128px; }
    body.has-player #toasts { bottom: 128px; }
}
@media (max-width: 575.98px) {
    .lang-list { grid-template-columns: 1fr; }
    .hero { padding-bottom: 3.6rem; }
    .brand-product { display: none; }
    .brand-sep { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
}
