/*
 * Speech Lab - Arke template styling
 * Path: StudyNFun_Hub/speechlab/speechlab.css
 */

:root {
  --background: #00000F;
  --surface: rgba(15, 15, 40, 0.3);
  --surface-light: rgba(3, 7, 18, 0.2);
  --on-surface: #e0e0e0;
  --grey: #b3c2cc;

  --primary: #40c4ff;
  --secondary: #00bcd4;
  --success: #4caf50;
  --warning: #ff9800;
  --danger: #f44336;
  --info: #2196f3;
  --accent: #9c27b0;

  --border-color: rgba(64, 196, 255, 0.2);
  --card-radius: 8px;
  --shadow: 0 4px 12px rgba(64, 196, 255, 0.075), 0 2px 6px rgba(0, 0, 0, 0.2);

  --standard-spacing: 20px;
  --container-max-width: 840px;

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.85);
  --text-muted: rgba(255, 255, 255, 0.6);
}

html, body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background: var(--background);
  color: var(--on-surface);
  font-size: 15px;
  min-height: 100vh;
  overflow-x: hidden;
}

* { box-sizing: border-box; }

.stars, .fireflies, .fireflies-front {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

.fireflies { z-index: 1; }
.fireflies-front { z-index: 2; }

.container {
  min-height: 100vh;
  position: relative;
  z-index: 10;
}

.navigation-wrap {
  max-width: var(--container-max-width);
  width: 100%;
  margin: var(--standard-spacing) auto;
  padding: 0 var(--standard-spacing);
  display: flex;
  flex-direction: column;
  gap: var(--standard-spacing);
  position: relative;
  z-index: 1;
}

.top-navigation-header,
.header-wrap,
.section-title,
.info-block,
.footer-wrap {
  background: var(--surface-light);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.top-navigation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--standard-spacing);
}

.nav-home, .nav-help {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 8px 16px;
  background: rgba(64, 196, 255, 0.1);
  border: 1px solid rgba(64, 196, 255, 0.3);
  border-radius: var(--card-radius);
  color: var(--primary);
  text-decoration: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.nav-home::before {
  content: '';
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 12L5 10M5 10L12 3L19 10M5 10V20C5 20.5523 5.44772 21 6 21H9M19 10L21 12M19 10V20C19 20.5523 18.5523 21 18 21H15M9 21C9.55228 21 10 20.5523 10 20V16C10 15.4477 10.4477 15 11 15H13C13.5523 15 14 15.4477 14 16V20C14 20.5523 14.4477 21 15 21M9 21H15' stroke='%2340c4ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  flex-shrink: 0;
}

.nav-home:hover, .nav-help:hover {
  background: rgba(64, 196, 255, 0.2);
  border-color: var(--primary);
}

.header-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--standard-spacing);
  min-height: 80px;
  background: var(--surface-light);
  border-radius: var(--card-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-sizing: border-box;
}

.logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.main-title {
  font-size: 2.2em;
  font-weight: 700;
  margin: 0;
  color: var(--primary);
  text-align: center;
}

.title-img { display: block; max-width: 240px; width: 100%; height: auto; object-fit: contain; }

.subtitle {
  font-size: 1.1em;
  color: var(--text-muted);
  margin: 0;
  text-align: center;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: var(--standard-spacing);
}

.section-title {
  font-size: 1.6em;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  padding: 12px 20px;
  text-align: center;
}

.info-block {
  display: flex;
  flex-direction: column;
  padding: var(--standard-spacing);
}

.info-label {
  color: #ffb066;
  font-weight: 700;
  font-size: 1em;
  margin-bottom: 5px;
}

.info-label::before { content: "📝 "; }

.info-content {
  width: 100%;
  color: var(--grey);
  font-size: 1em;
  line-height: 1.6;
  text-align: left;
}

.info-content code {
  background: rgba(64, 196, 255, 0.12);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
}

.footer-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--standard-spacing) 0;
}

.footer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.copyright {
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: center;
  margin: 0;
  color: #fbbf24;
}

/* ── Component showcases - content colour coding ─────────────── */
.component-showcase {
  --hue: var(--primary);
  background: rgba(3, 7, 18, 0.3);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--hue);
  border-radius: var(--card-radius);
  padding: var(--standard-spacing);
  margin: var(--standard-spacing) 0 0;
}

.showcase-script { --hue: var(--primary); }
.showcase-cast   { --hue: var(--accent); }
.showcase-stage  { --hue: var(--success); }
.showcase-import { --hue: var(--warning); }

/* every control inside a showcase picks up that section's hue */
.component-showcase .form-input,
.component-showcase .form-textarea,
.component-showcase .form-select,
.component-showcase .spl-select {
  border-color: color-mix(in srgb, var(--hue) 35%, transparent);
}

.component-showcase .form-input:focus,
.component-showcase .form-textarea:focus,
.component-showcase .form-select:focus,
.component-showcase .spl-select:focus {
  border-color: var(--hue);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--hue) 25%, transparent);
}

.component-showcase .spl-check input,
.component-showcase input[type=range] { accent-color: var(--hue); }

/* native dropdown list: selected/hovered option follows the section hue
   (native <select> popups ignore :hover in most browsers, so selects are
   upgraded to .spl-dd by speechlab.js — these rules are the fallback) */
.component-showcase .form-select,
.component-showcase .spl-select { accent-color: var(--hue); }

.component-showcase .form-select option:checked,
.component-showcase .form-select option:hover,
.component-showcase .spl-select option:checked,
.component-showcase .spl-select option:hover {
  background: var(--hue);
  color: #fff;
  box-shadow: 0 0 0 100px var(--hue) inset;
}

/* ── Custom dropdown (built by speechlab.js over each <select>) ── */
.spl-dd { position: relative; width: 100%; }
.spl-dd select { display: none; }

.spl-dd-btn {
  width: 100%;
  text-align: left;
  padding: 12px 36px 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid color-mix(in srgb, var(--hue, var(--primary)) 35%, transparent);
  border-radius: var(--card-radius);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spl-dd-btn::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 0;
  height: 0;
  margin-top: -2px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--hue, var(--primary));
  pointer-events: none;
}

.spl-dd-btn:hover { border-color: var(--hue, var(--primary)); }
.spl-dd.spl-open .spl-dd-btn {
  border-color: var(--hue, var(--primary));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--hue, var(--primary)) 25%, transparent);
}

/* the list is moved to <body> by speechlab.js — panels use backdrop-filter,
   which would otherwise trap and blur it inside its own panel layer */
.spl-dd-list {
  position: fixed;
  z-index: 9999;
  max-height: 260px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #0b0b18;
  border: 1px solid color-mix(in srgb, var(--hue, var(--primary)) 45%, transparent);
  border-radius: var(--card-radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  display: none;
}
.spl-dd-list.spl-open { display: block; }

.spl-dd-list li {
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s ease, color 0.15s ease;
}

.spl-dd-list li:hover,
.spl-dd-list li.spl-cursor {
  background: color-mix(in srgb, var(--hue, var(--primary)) 30%, transparent);
  color: #fff;
}

.spl-dd-list li.spl-sel {
  background: var(--hue, var(--primary));
  color: #fff;
  font-weight: 600;
}
.component-showcase .spl-quota { color: var(--hue); }
.component-showcase .spl-field label { color: var(--text-muted); }
.component-showcase .info-content code { background: color-mix(in srgb, var(--hue) 15%, transparent); color: var(--hue); }

/* ── Buttons ─────────────────────────────────────────────────── */
.button-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: var(--standard-spacing) 0 0;
}

.btn {
  padding: 12px 20px;
  border: 1px solid;
  border-radius: var(--card-radius);
  font-family: inherit;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn-sm { padding: 8px 16px; font-size: 12px; min-height: 36px; }

.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-info    { background: var(--info);    border-color: var(--info);    color: #fff; }

.btn-outline-primary   { background: transparent; border-color: var(--primary);   color: var(--primary); }
.btn-outline-primary:hover   { background: var(--primary);   color: #fff; }
.btn-outline-secondary { background: transparent; border-color: var(--secondary); color: var(--secondary); }
.btn-outline-secondary:hover { background: var(--secondary); color: #fff; }
.btn-outline-neutral   { background: transparent; border-color: var(--grey);      color: var(--grey); }
.btn-outline-neutral:hover   { background: var(--grey);      color: var(--background); }
.btn-outline-warning   { background: transparent; border-color: var(--warning);   color: var(--warning); }
.btn-outline-warning:hover   { background: var(--warning);   color: #fff; }
.btn-outline-danger    { background: transparent; border-color: var(--danger);    color: var(--danger); }
.btn-outline-danger:hover    { background: var(--danger);    color: #fff; }
.btn-outline-info      { background: transparent; border-color: var(--info);      color: var(--info); }
.btn-outline-info:hover      { background: var(--info);      color: #fff; }
.btn-outline-accent    { background: transparent; border-color: var(--accent);    color: var(--accent); }
.btn-outline-accent:hover    { background: var(--accent);    color: #fff; }

/* playing state */
#btnPlay.spl-on { background: var(--warning); border-color: var(--warning); color: #fff; }

/* ── Form elements ───────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--standard-spacing);
  margin: var(--standard-spacing) 0 0;
}

.form-input,
.form-textarea,
.form-select,
.spl-select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.3s ease;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }

.form-input:focus,
.form-textarea:focus,
.form-select:focus,
.spl-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(64, 196, 255, 0.2);
}

.form-textarea { min-height: 100px; resize: vertical; }
.form-select option,
.spl-select option { background: #0b0b18; }

.spl-select { cursor: pointer; }

/* ── Speech Lab specifics (class names used by speechlab.js) ─── */
.spl-hidden { display: none !important; }

.spl-textarea { min-height: 240px; line-height: 1.65; margin-top: var(--standard-spacing); }

.spl-error { margin-top: 12px; min-height: 16px; font-size: 0.9em; color: #ff8a80; }
.spl-hint  { margin: 0; font-size: 0.9em; color: var(--text-muted); }
.spl-quota { font-size: 0.85em; color: var(--secondary); }

.spl-kbdhint { font-size: 0.8em; color: var(--text-muted); }
.spl-kbd {
  display: inline-block;
  min-width: 30px;
  padding: 4px 8px;
  margin: 0 2px;
  border-radius: 4px;
  background: rgba(64, 196, 255, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.8em;
  font-weight: 600;
  text-align: center;
}

.spl-field { margin: 0; }
.spl-field label {
  display: block;
  font-size: 0.75em;
  color: var(--text-muted);
  margin-bottom: 4px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.spl-engine { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: var(--standard-spacing); }
.spl-engine-sel { width: auto; min-width: 190px; }

.spl-check { display: flex; align-items: center; gap: 8px; font-size: 0.9em; color: var(--text-muted); }
.spl-check input { accent-color: var(--primary); width: 16px; height: 16px; }

.spl-file { cursor: pointer; padding: 8px 10px; }
.spl-file::file-selector-button {
  font-family: inherit;
  font-size: 12px;
  margin-right: 10px;
  padding: 6px 12px;
  cursor: pointer;
  background: rgba(255, 152, 0, 0.15);
  color: var(--warning);
  border: 1px solid rgba(255, 152, 0, 0.4);
  border-radius: 6px;
}

/* Cast cards */
.spl-cast-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--standard-spacing);
}

.spl-cast-card {
  --hue: var(--accent);
  background: rgba(3, 7, 18, 0.4);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--hue);
  border-radius: var(--card-radius);
  padding: var(--standard-spacing);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spl-cast-card.spl-female { --hue: var(--accent); }
.spl-cast-card.spl-male   { --hue: var(--info); }

.spl-cast-name {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 1.05em;
  font-weight: 600;
  color: var(--text-primary);
}

.spl-cast-card .spl-cast-name span:last-child { color: var(--hue); }

.spl-cast-meta { font-size: 0.8em; color: var(--text-muted); margin-top: -8px; }
.spl-cast-card .btn, .spl-cast-card .spl-btn-secondary { width: 100%; }

/* TEST VOICE button rendered by JS with class spl-btn-secondary */
.spl-btn-secondary {
  padding: 8px 16px;
  border-radius: var(--card-radius);
  border: 1px solid var(--hue, var(--secondary));
  background: transparent;
  color: var(--hue, var(--secondary));
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 36px;
}
.spl-btn-secondary:hover { background: var(--hue, var(--secondary)); color: #fff; }

/* Sliders */
.spl-sliders { display: flex; flex-wrap: wrap; gap: var(--standard-spacing); font-size: 0.9em; color: var(--text-muted); }
.spl-sliders label { display: flex; align-items: center; gap: 10px; }
.spl-sliders input[type=range] { accent-color: var(--hue, var(--primary)); width: 140px; }
.spl-sliders span { color: var(--hue, var(--primary)); min-width: 56px; }

/* Dialogue lines */
.spl-lines {
  margin-top: var(--standard-spacing);
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 360px;
  overflow-y: auto;
}

.spl-line {
  padding: 10px 14px;
  border-radius: 6px;
  border-left: 4px solid var(--sp, var(--primary));
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.95em;
  line-height: 1.55;
}
.spl-line b { color: var(--sp, var(--primary)); margin-right: 6px; }
.spl-line.spl-active { background: rgba(255, 255, 255, 0.08); }
.spl-line.spl-done { opacity: .45; }
.spl-line.spl-loading b::after { content: ' …'; color: var(--warning); }

.spl-sp0 { --sp: var(--primary); }
.spl-sp1 { --sp: var(--accent); }
.spl-sp2 { --sp: var(--warning); }
.spl-sp3 { --sp: var(--secondary); }
.spl-sp4 { --sp: var(--success); }
.spl-sp5 { --sp: var(--danger); }

/* Transcript output */
.spl-stt-out {
  margin-top: var(--standard-spacing);
  min-height: 70px;
  max-height: 220px;
  overflow-y: auto;
  padding: 12px;
  font-size: 0.9em;
  line-height: 1.55;
  background: rgba(3, 7, 18, 0.4);
  border: 1px dashed rgba(255, 152, 0, 0.45);
  border-radius: var(--card-radius);
  color: var(--text-muted);
}
.spl-stt-out .spl-interim { opacity: .7; font-style: italic; }

/* ── Modal (help) ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-container {
  background: var(--surface-light);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
}
.modal-overlay.active .modal-container { transform: scale(1) translateY(0); }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--standard-spacing);
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { margin: 0; color: var(--text-primary); font-size: 1.4em; font-weight: 600; }

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.modal-close:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.modal-body { padding: var(--standard-spacing); color: var(--grey); line-height: 1.6; }
.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: var(--standard-spacing);
  border-top: 1px solid var(--border-color);
}

.spl-keylist { display: flex; flex-direction: column; gap: 12px; font-size: 0.95em; }
.spl-keylist div { display: flex; align-items: center; gap: 8px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 700px) {
  .main-title { font-size: 1.8em; }
  .subtitle { font-size: 1em; }
  .section-title { font-size: 1.4em; padding: var(--standard-spacing) 15px; }
  .button-grid { flex-direction: column; align-items: stretch; }
  .form-grid { grid-template-columns: 1fr; }
  .spl-cast-list { grid-template-columns: 1fr; }
  .spl-sliders { flex-direction: column; align-items: stretch; gap: 12px; }
  .spl-sliders input[type=range] { flex: 1; width: auto; }
}

@media (max-width: 480px) {
  .main-title { font-size: 1.5em; }
  .section-title { font-size: 1.2em; }
  .copyright { font-size: 0.7rem; }
  .modal-container { width: 95%; }
}

/* Baslik logosu backglow — standart (kaynak: lexitest) */
.logo-container img, .header-wrap img, .header img, .title-logo, .title-img, .main-title-image {
    filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.4));
    filter: drop-shadow(0 0 20px color-mix(in srgb, var(--primary, #3b82f6) 40%, transparent));
}
