/**
 * TTS Admin Redesign — Complete Stylesheet
 *
 * Organised in 14 sections matching the TTS-REDESIGN.md specification.
 *
 * @package Mementor_TTS
 * @since   2.2.0
 */

/* ==========================================================================
   1. Design Tokens (spec section 4)
   ========================================================================== */

:root {
  --tts-sidebar-width: 220px;
  --tts-topbar-height: 52px;
  --tts-content-padding: 24px;
  --tts-radius-sm: 6px;
  --tts-radius-md: 8px;
  --tts-radius-lg: 12px;
  --tts-border-color: #e2e2e2;
  --tts-border: 0.5px solid #e2e2e2;
  --tts-font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --tts-text-primary: #1a1a1a;
  --tts-text-secondary: #555;
  --tts-text-hint: #999;
  --tts-bg-primary: #fff;
  --tts-bg-secondary: #f7f7f6;
  --tts-bg-tertiary: #f0f0ee;
  /* Accent — lilla fra QR-Kode / ttswp.com merkevare */
  --tts-purple: #6B45D4;
  --tts-purple-dark: #5435B0;
  --tts-purple-bg: #F0EBFD;
  --tts-purple-border: #C9B8F5;
  --tts-purple-text: #4A2FA0;

  /* Semantiske farger */
  --tts-green: #1D9E75;
  --tts-green-bg: #E1F5EE;
  --tts-green-border: #9FE1CB;
  --tts-red: #E24B4A;
  --tts-red-bg: #FCEBEB;
  --tts-red-border: #F09595;
  --tts-amber: #BA7517;
  --tts-amber-bg: #FAEEDA;
  --tts-amber-border: #FAC775;
  --tts-blue: #185FA5;
  --tts-blue-bg: #E6F1FB;
}

/* ==========================================================================
   2. Outer Layout (spec section 2)
   ========================================================================== */

.tts-admin-wrap {
  display: flex;
  min-height: calc(100vh - 32px);
  background: var(--tts-bg-primary);
  border: var(--tts-border);
  border-radius: var(--tts-radius-lg);
  overflow: clip;
  margin: 16px 20px 16px 0;
}

.tts-sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--tts-bg-secondary);
  border-right: var(--tts-border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.tts-main {
  flex: 1;
  overflow: visible;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tts-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: var(--tts-border);
  height: 45px;
  background: #f9f8ff;
}

.tts-topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 1;
}

.tts-topbar-title {
  font-size: 17px;
  font-weight: 500;
  color: var(--tts-text-primary);
}

.tts-topbar-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--tts-text-secondary);
  flex-wrap: wrap;
}

.tts-topbar-meta-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--tts-text-hint);
}

.tts-topbar-meta-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tts-green);
  flex-shrink: 0;
}

.tts-topbar-meta-plan {
  font-weight: 600;
  color: var(--tts-text-primary);
}

.tts-topbar-meta-sep {
  color: var(--tts-text-hint);
}

.tts-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Save changes button at the bottom of the quick-settings form (moved out of
   the topbar to make room for the contextual Upgrade/Manage plan CTA). */
.tts-quick-settings-save {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.tts-main-content {
  padding: 24px;
  flex: 1;
  font-size: 14px;
  background: #f9f8ff;
}

/* ==========================================================================
   3. Sidebar Elements (spec section 3)
   ========================================================================== */

.tts-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 18px;
  border-bottom: var(--tts-border);
  margin-bottom: 12px;
}

.tts-logo-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tts-logo-icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 7px;
}

.tts-plugin-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--tts-text-primary);
  line-height: 1.3;
}

.tts-plugin-version {
  font-size: 11px;
  color: #261750;
}

.tts-upgrade-link {
  color: var(--tts-purple);
  text-decoration: none;
  font-weight: 500;
  margin-left: 4px;
}

.tts-upgrade-link:hover {
  text-decoration: underline;
  color: var(--tts-purple-dark);
}

.tts-update-link {
  color: #e25555;
  text-decoration: none;
  font-weight: 500;
  margin-left: 4px;
  font-size: 11px;
}

.tts-update-link:hover {
  text-decoration: underline;
}

.tts-nav {
  flex: 1;
  padding: 0 8px;
  overflow-y: auto;
}

.tts-nav-group {
  margin-bottom: 2px;
}

/* Top-level nav item (no group) */
.tts-nav-item-top {
  margin-bottom: 2px;
}

.tts-nav-item-top .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
}

/* Collapsible group toggle */
.tts-nav-label {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--tts-text-primary);
  padding: 7px 10px;
  border-radius: var(--tts-radius-md);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  transition: background 0.1s;
}

.tts-nav-label:hover {
  background: var(--tts-bg-secondary);
}

.tts-nav-label .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  color: var(--tts-text-hint);
}

.tts-nav-chevron {
  margin-left: auto;
  color: var(--tts-text-hint);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.tts-nav-group.open .tts-nav-chevron {
  transform: rotate(180deg);
}

/* Collapsible items container */
.tts-nav-items {
  display: none;
  padding-left: 24px;
}

.tts-nav-group.open .tts-nav-items {
  display: block;
}

.tts-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--tts-radius-md);
  font-size: 14px;
  color: var(--tts-text-secondary);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}

.tts-nav-item:hover {
  background: var(--tts-bg-primary);
  color: var(--tts-text-primary);
}

.tts-nav-item:focus {
  outline: none;
  box-shadow: none;
}

.tts-nav-item.active {
  background: var(--tts-purple-bg);
  color: var(--tts-purple);
  font-weight: 500;
  border: 0.5px solid var(--tts-purple-border);
}

.tts-nav-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 10px;
  font-weight: 500;
}

.tts-badge-error {
  background: #FCEBEB;
  color: #A32D2D;
}

.tts-badge-pro {
  background: var(--tts-purple-bg);
  color: var(--tts-purple-text);
}

.tts-sidebar-cta {
  padding: 12px 16px 0;
  margin-top: 40px;
}

.tts-sidebar-cta .tts-sidebar-cta-btn {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 12px;
  box-sizing: border-box;
  justify-content: center;
}

.tts-sidebar-footer {
  padding: 10px 16px 0;
}

.tts-footer-link {
  font-size: 11px;
  color: var(--tts-text-hint);
  text-decoration: none;
}

.tts-footer-link:hover {
  color: var(--tts-text-secondary);
}

/* ==========================================================================
   4. Cards (spec section 5)
   ========================================================================== */

.tts-card {
  background: var(--tts-bg-primary);
  border: var(--tts-border);
  border-radius: var(--tts-radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.tts-card-inset {
  background: var(--tts-bg-secondary);
}

.tts-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #dddddd;
}

.tts-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--tts-text-primary);
  margin: 0;
}

.tts-card-desc {
  font-size: 12px;
  color: var(--tts-text-secondary);
  margin: -3px 0 0;
}

.tts-card-header-inline {
  align-items: center;
}

.tts-card-header-inline .tts-card-title {
  margin: 0;
}

.tts-card-header-inline .tts-card-desc {
  margin-top: 0;
}

.tts-tip-card {
  background: var(--tts-bg-subtle, #f0f0f1);
}

.tts-tip-body {
  font-size: 13px;
  color: var(--tts-text-secondary);
  margin: 0;
}

.tts-tip-card code {
  background: var(--tts-bg, #fff);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
}

/* ==========================================================================
   5. Setting Rows (spec section 5)
   ========================================================================== */

.tts-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: var(--tts-border);
}

.tts-setting-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.tts-setting-row:first-child {
  padding-top: 0;
}

.tts-setting-label {
  font-size: 14px;
  color: var(--tts-text-primary);
  margin: 0;
  white-space: nowrap;
}

.tts-setting-hint {
  font-size: 12px;
  color: var(--tts-text-secondary);
  margin: 2px 0 0;
}

.tts-setting-row-locked .tts-setting-label,
.tts-setting-row-locked .tts-setting-hint {
  color: #514567;
}

.tts-lock-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  color: var(--tts-text-hint);
}

.tts-pro-badge {
  background: var(--tts-purple-bg);
  color: var(--tts-purple-text);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.tts-fields-disabled,
#tts-label-settings.tts-fields-disabled {
  opacity: 0.45 !important;
  pointer-events: none !important;
  user-select: none !important;
  position: relative;
}

.tts-fields-disabled::after,
#tts-label-settings.tts-fields-disabled::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  cursor: not-allowed;
}

/* Sticky footer admin preview */
.mementor-tts-sticky-preview-bar {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 99999 !important;
}

.mementor-tts-sticky-preview-bar .tts-sticky-preview-label {
  position: absolute;
  top: -24px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  background: #6b45d4;
  padding: 3px 10px;
  border-radius: 4px 4px 0 0;
  border: none;
}

/* ==========================================================================
   6. Status Banners (spec section 5)
   ========================================================================== */

.tts-status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--tts-radius-md);
  margin-bottom: 20px;
  font-size: 14px;
}

.tts-banner-warning {
  background: var(--tts-amber-bg);
  border: 0.5px solid var(--tts-amber-border);
  color: var(--tts-amber);
}

.tts-banner-error {
  background: var(--tts-red-bg);
  border: 0.5px solid var(--tts-red-border);
  color: #A32D2D;
}

.tts-banner-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.tts-banner-text {
  flex: 1;
}

.tts-banner-action {
  font-weight: 500;
  color: inherit;
  text-decoration: underline;
  white-space: nowrap;
}

.tts-banner-close {
  background: none;
  border: none;
  font-size: 18px;
  color: inherit;
  cursor: pointer;
  padding: 0 0 0 8px;
  opacity: 0.6;
  line-height: 1;
}

.tts-banner-close:hover {
  opacity: 1;
}

/* ==========================================================================
   7. Buttons (spec section 5)
   ========================================================================== */

.tts-btn {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--tts-radius-md);
  border: 0.5px solid var(--tts-border-color);
  background: var(--tts-bg-primary);
  color: var(--tts-text-primary);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.1s;
}

.tts-btn:hover {
  background: var(--tts-bg-secondary);
}

.tts-btn-primary {
  background: var(--tts-purple);
  color: #fff;
  border-color: var(--tts-purple-dark);
}

.tts-btn-primary:hover {
  background: var(--tts-purple-dark);
  color: #fff;
}

.tts-btn-danger {
  background: var(--tts-red-bg);
  color: var(--tts-red);
  border-color: var(--tts-red-border);
}

/* Global input styles */
.tts-admin-wrap input[type="text"],
.tts-admin-wrap input[type="email"],
.tts-admin-wrap input[type="password"],
.tts-admin-wrap input[type="number"],
.tts-admin-wrap input[type="url"],
.tts-admin-wrap textarea,
.tts-admin-wrap select {
  background: var(--tts-bg-secondary);
  border: 1px solid var(--tts-border-color);
  border-radius: var(--tts-radius-md);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--tts-text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tts-admin-wrap input[type="text"]:hover,
.tts-admin-wrap input[type="email"]:hover,
.tts-admin-wrap input[type="password"]:hover,
.tts-admin-wrap input[type="number"]:hover,
.tts-admin-wrap input[type="url"]:hover,
.tts-admin-wrap textarea:hover,
.tts-admin-wrap select:hover {
  border-color: var(--tts-text-secondary);
}

.tts-admin-wrap input[type="text"]:focus,
.tts-admin-wrap input[type="email"]:focus,
.tts-admin-wrap input[type="password"]:focus,
.tts-admin-wrap input[type="number"]:focus,
.tts-admin-wrap input[type="url"]:focus,
.tts-admin-wrap textarea:focus,
.tts-admin-wrap select:focus {
  border-color: var(--tts-purple);
  background: var(--tts-bg-primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--tts-purple-bg);
}

/* Toggle checked state — purple tick on white background */
.tts-admin-wrap input[type="checkbox"]:checked {
  border-color: var(--tts-purple);
}

.tts-admin-wrap input[type="checkbox"]:checked::before {
  content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%237c3aed%27%2F%3E%3C%2Fsvg%3E");
}

/* Progress bars */
.tts-progress-bar {
  background: var(--tts-purple);
}

/* ==========================================================================
   8. Pills (spec section 5)
   ========================================================================== */

.tts-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 10px;
}

.tts-pill::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.tts-pill-success { background: var(--tts-green-bg); color: #0F6E56; }
.tts-pill-error   { background: var(--tts-red-bg);   color: #A32D2D; }
.tts-pill-neutral { background: var(--tts-bg-secondary); color: var(--tts-text-secondary); }

/* ==========================================================================
   9. Metrics (spec section 5)
   ========================================================================== */

.tts-metric {
  background: var(--tts-bg-secondary);
  border-radius: var(--tts-radius-md);
  padding: 10px 12px;
}

.tts-metric-value {
  font-size: 20px;
  font-weight: 500;
  color: var(--tts-text-primary);
  line-height: 1.2;
}

.tts-metric-label {
  font-size: 12px;
  color: var(--tts-text-secondary);
  margin-top: 2px;
}

/* ==========================================================================
   10. Grids (spec section 5)
   ========================================================================== */

.tts-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.tts-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.tts-metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

/* ==========================================================================
   11. Inner Tabs (spec section 11)
   ========================================================================== */

.tts-inner-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: var(--tts-border);
  padding-bottom: 0;
}

.tts-inner-tab {
  font-size: 14px;
  padding: 8px 14px;
  color: var(--tts-text-secondary);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -0.5px;
}

.tts-inner-tab.active {
  color: var(--tts-purple);
  font-weight: 500;
  border-bottom-color: var(--tts-purple);
}

/* ==========================================================================
   12. Tips Panel (spec section 16)
   ========================================================================== */

.tts-tips-panel {
  background: var(--tts-bg-secondary);
  border-radius: var(--tts-radius-lg);
  padding: 16px;
  font-size: 12px;
  color: var(--tts-text-secondary);
  line-height: 1.7;
  align-self: flex-start;
  position: sticky;
  top: 20px;
}

/* ==========================================================================
   13. Player Preview (spec section 10)
   ========================================================================== */

.tts-player-preview {
  background: var(--tts-bg-secondary);
  border: var(--tts-border);
  border-radius: var(--tts-radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
}

/* ==========================================================================
   14. Audio Grid Components (shared by Voices, Player, etc.)
   ========================================================================== */

.tts-audio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tts-audio-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tts-audio-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--tts-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

.tts-audio-label .tooltip-text {
  text-transform: none;
  letter-spacing: normal;
  font-size: 13px;
}

.tts-audio-field.is-pro {
  pointer-events: none;
}

.tts-audio-field.is-pro select,
.tts-audio-field.is-pro input[type="text"],
.tts-audio-field.is-pro input[type="number"] {
  background: var(--tts-bg-tertiary);
  border-style: dashed;
  color: var(--tts-text-secondary);
  cursor: not-allowed;
  box-shadow: none;
}

.tts-audio-locked-value {
  font-size: 13px;
  padding: 8px 12px;
  border: 1px dashed var(--tts-border-color);
  border-radius: var(--tts-radius-md);
  background: var(--tts-bg-tertiary);
  color: var(--tts-text-hint);
}

.tts-audio-field select,
.tts-audio-field input[type="text"],
.tts-audio-field input[type="number"] {
  font-size: 13px;
  padding: 8px 12px !important;
  border: 1px solid var(--tts-border-color);
  border-radius: var(--tts-radius-md);
  background: var(--tts-bg-primary);
  color: var(--tts-text-primary);
  width: 100% !important;
  max-width: 100% !important;
  min-height: 0 !important;
  height: auto !important;
  line-height: 1.4 !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: border-color 0.15s;
}

.tts-audio-field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px !important;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.tts-audio-field select:hover,
.tts-audio-field input[type="text"]:hover,
.tts-audio-field input[type="number"]:hover {
  border-color: var(--tts-text-secondary);
}

.tts-audio-field select:focus,
.tts-audio-field input[type="text"]:focus,
.tts-audio-field input[type="number"]:focus {
  border-color: var(--tts-purple);
  outline: none;
  box-shadow: 0 0 0 3px var(--tts-purple-bg);
}

.tts-audio-separator {
  border-top: var(--tts-border);
  margin: 14px 0 8px;
  padding-top: 14px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tts-text-hint);
}

.mementor-tts-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mementor-tts-input-group input[type="number"] {
  flex: 1;
}

.tts-unit-label {
  font-size: 12px;
  color: var(--tts-text-secondary);
  white-space: nowrap;
}

.tts-separator-title {
  color: #6b45d4;
  font-weight: 600;
  font-size: 13px;
  text-transform: none;
  letter-spacing: normal;
}

@media screen and (max-width: 782px) {
  .tts-audio-grid {
    grid-template-columns: 1fr;
  }
  .tts-controls-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .tts-color-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Two-panel grid (Controls + Colors side-by-side) */
.tts-two-panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.tts-panel-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--tts-text-primary);
  margin-bottom: 2px;
}

.tts-panel-desc {
  font-size: 11px;
  color: var(--tts-text-secondary);
  margin-bottom: 12px;
}

.tts-panel:first-child {
  border-right: var(--tts-border);
  padding-right: 24px;
}

.tts-panel:last-child {
  padding-left: 24px;
}

.tts-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.tts-control-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: var(--tts-border);
  border-radius: var(--tts-radius-md);
  background: var(--tts-bg-secondary);
}

.tts-control-item:has(input:checked) {
  background: var(--tts-purple-bg);
  border-color: var(--tts-purple-border);
}

.tts-control-item:has(input:checked) .tts-control-label {
  color: var(--tts-purple-text);
}

.tts-control-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--tts-text-primary);
  white-space: nowrap;
}

.tts-control-item .mementor-tts-toggle {
  flex-shrink: 0;
  width: auto;
}

.tts-control-item .mementor-tts-toggle label {
  flex-direction: row;
}

.tts-color-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.tts-color-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.tts-color-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Input group: number + unit select side by side */
.tts-audio-field .mementor-tts-input-group {
  display: flex;
  gap: 0;
}

.tts-audio-field .mementor-tts-input-group input[type="number"] {
  flex: 1;
  min-width: 0;
  width: auto !important;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  border-right: none !important;
}

.tts-audio-field .mementor-tts-input-group select {
  width: auto !important;
  min-width: 55px;
  flex: 0 0 auto;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}

.tts-color-group-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tts-text-hint);
  margin-bottom: 6px;
}

@media screen and (max-width: 782px) {
  .tts-two-panel-grid {
    grid-template-columns: 1fr;
  }
  .tts-panel:first-child {
    border-right: none;
    padding-right: 0;
    border-bottom: var(--tts-border);
    padding-bottom: 16px;
    margin-bottom: 16px;
  }
  .tts-panel:last-child {
    padding-left: 0;
  }
}

/* Color picker rows */
.tts-color-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.tts-color-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}


.tts-color-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--tts-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tts-color-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border: var(--tts-border);
  border-radius: var(--tts-radius-md);
  padding: 5px 8px;
  background: var(--tts-bg-primary);
}

.tts-color-input-row input[type="color"] {
  width: 20px;
  height: 20px;
  border: none;
  padding: 0;
  border-radius: 3px;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-appearance: none;
}

.tts-color-input-row input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.tts-color-input-row input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 3px;
}

.tts-color-input-row input[type="text"] {
  font-size: 12px;
  font-family: monospace;
  border: none !important;
  background: transparent !important;
  color: var(--tts-text-primary);
  width: 100%;
  padding: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  box-shadow: none !important;
}

.tts-opacity-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tts-opacity-input-row input[type="range"] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--tts-border-light, #dcdcde);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.tts-opacity-input-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--tts-purple, #6b45d4);
  cursor: pointer;
}

.tts-opacity-input-row input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--tts-purple, #6b45d4);
  border: none;
  cursor: pointer;
}

.tts-opacity-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--tts-text-primary);
  min-width: 28px;
  text-align: right;
}

.tts-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--tts-border-light, #dcdcde);
  color: var(--tts-text-secondary, #666);
  font-size: 9px;
  font-weight: 700;
  cursor: help;
  vertical-align: middle;
  margin-left: 2px;
  position: relative;
}

.tts-tooltip-text {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: -8px;
  background: #1d2327;
  color: #fff;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: normal;
  width: 200px;
  text-align: center;
  z-index: 100;
  pointer-events: none;
}

.tts-tooltip-text::before {
  content: '';
  position: absolute;
  bottom: 100%;
  right: 12px;
  border: 5px solid transparent;
  border-bottom-color: #1d2327;
}

.tts-tooltip:hover .tts-tooltip-text {
  display: block;
}

@media screen and (max-width: 782px) {
  .tts-color-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* Toggle purple override — all toggles use purple when checked */
.tts-admin-wrap .mementor-tts-toggle input[type="checkbox"]:checked + label .slider,
.tts-admin-wrap .mementor-tts-toggle input[type="checkbox"]:checked + label .slider::before {
  /* slider bg handled by the slider pseudo */
}
.tts-admin-wrap .mementor-tts-toggle input[type="checkbox"]:checked + label .slider {
  background-color: var(--tts-purple) !important;
}

/* Sticky player preview card — contained within .tts-main-content */
.tts-admin-wrap .tts-player-preview-card,
.tts-admin-wrap .mementor-tts-sticky-preview,
.tts-admin-wrap .mementor-tts-sticky-preview.is-sticky {
  position: sticky;
  top: 46px;
  left: auto;
  right: auto;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-bottom: 16px;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.tts-preview-header {
  align-items: center;
}

.tts-preview-header .tts-card-title {
  margin: 0;
}

.tts-live-label {
  margin: 0;
  color: #322652;
}

.tts-live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tts-green);
  margin-right: 6px;
  vertical-align: middle;
  animation: tts-pulse 2s ease-in-out infinite;
}

@keyframes tts-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(29,158,117,0.4); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(29,158,117,0); }
}

/* ── TTSWP Connect ── */

.tts-onboarding-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.tts-onboarding-card .tts-onboarding-icon {
  flex-shrink: 0;
}

.tts-onboarding-card .tts-onboarding-body {
  flex: 1;
  min-width: 0;
}

.tts-onboarding-card--prominent {
  border: 2px solid #7c3aed;
  background: #faf5ff;
  padding: 32px 36px;
  gap: 24px;
}

.tts-onboarding-card--prominent h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px;
  color: #1a1a1a;
  line-height: 1.3;
}

.tts-onboarding-card--prominent p {
  font-size: 15px;
  color: #555;
  margin: 0 0 20px;
  line-height: 1.6;
}

.tts-onboarding-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 16px;
}

.tts-onboarding-note {
  font-size: 12px;
  color: #888;
}

.tts-btn-connect {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #7c3aed;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}

.tts-btn-connect:hover {
  background: #6d28d9;
  color: #fff;
}

.tts-connect-gate {
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.tts-connect-gate .dashicons {
  color: #999;
}

.tts-connect-gate a {
  color: var(--tts-green);
  text-decoration: none;
  font-weight: 500;
}

.tts-connect-gate a:hover {
  text-decoration: underline;
}

.tts-connect-gate + * {
  pointer-events: none;
  opacity: 0.4;
}

/* Hide footer */
.tts-admin-wrap ~ #wpfooter,
.tts-admin-wrap #wpfooter {
  display: none;
}

/* ==========================================================================
   15. Toast Notifications
   ========================================================================== */



/* ==========================================================================
   16. Legacy Overrides
   ========================================================================== */

/* Hide WP admin notices inside our layout — we use toast notifications */
.tts-admin-wrap .notice,
.tts-admin-wrap .updated,
.tts-admin-wrap .error,
.tts-main-content > .notice,
.tts-main-content > .updated {
  display: none !important;
}

/* Hide old horizontal tab navigation */
.tts-admin-wrap .mementor-tts-admin-nav { display: none; }

/* ==========================================================================
   Review nudge card
   ========================================================================== */
.tts-review-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: #f3f0ff;
  border: 1px solid #e0d9ff;
  border-radius: var(--tts-radius-lg);
  margin-bottom: 16px;
}

.tts-review-card-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.tts-review-card-icon {
  flex-shrink: 0;
}

.tts-review-card-text h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--tts-text-primary);
  margin: 0 0 2px;
}

.tts-review-card-text p {
  font-size: 13px;
  color: var(--tts-text-secondary);
  margin: 0;
}

.tts-review-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.tts-review-btn-review {
  white-space: nowrap;
}

.tts-review-btn-later {
  white-space: nowrap;
}

.tts-review-btn-never {
  background: none;
  border: none;
  color: var(--tts-text-secondary);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tts-review-btn-never:hover {
  color: var(--tts-text-primary);
}

@media (max-width: 782px) {
  .tts-review-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .tts-review-card-actions {
    flex-wrap: wrap;
  }
}

/* Hide old page headers */
.tts-admin-wrap .mementor-tts-header-layout { display: none; }

/* Neutralize old wrapper flex layout */
.tts-admin-wrap .mementor-tts-wrap {
    display: block;
    margin-top: 0;
    min-height: auto;
    gap: 0;
}

/* Hide old right sidebar */
.tts-admin-wrap .mementor-tts-sidebar {
    display: none;
}

/* Reset old main width */
.tts-admin-wrap .mementor-tts-main {
    width: 100%;
    flex: none;
}

/* Hide inline submit buttons */
.tts-admin-wrap .submit { display: none; }

/* Hide WP submenu for Text to Speech — navigation is in our own sidebar */
#adminmenu .toplevel_page_text-to-speech-tts-settings .wp-submenu,
#adminmenu .toplevel_page_text-to-speech-tts .wp-submenu,
#adminmenu li[class*="text-to-speech-tts"] .wp-submenu {
  display: none !important;
}

/* Hide WP footer */
.tts-admin-wrap + #wpfooter { display: none; }
#wpfooter { display: none; }

/* Plugin footer */
.tts-footer-text {
  text-align: center;
  color: #6b45d4;
  font-size: 13px;
  padding: 25px 0 4px;
  border-top: var(--tts-border);
  margin-top: 24px;
}

.tts-footer-text a {
  color: #6b45d4;
  text-decoration: none;
}

.tts-footer-heart {
  color: #e25555;
}

.tts-footer-sub {
  color: #555;
  font-size: 12px;
}

.tts-footer-sub a {
  color: #555;
}

/* ==========================================================================
   CSS Tooltips (data-tooltip attribute)
   ========================================================================== */

.mementor-tts-wrap [data-tooltip],
.tts-admin-wrap [data-tooltip] {
  position: relative;
}

.mementor-tts-wrap [data-tooltip]::after,
.tts-admin-wrap [data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--tts-text-primary, #1a1a1a);
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  padding: 6px 10px;
  border-radius: var(--tts-radius-sm, 6px);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10000;
}

.mementor-tts-wrap [data-tooltip]:hover::after,
.tts-admin-wrap [data-tooltip]:hover::after {
  opacity: 1;
}

/* ==========================================================================
   Content Page
   ========================================================================== */

/* Two-column grid rows (Post Types + Auto Gen, Selectors) */
.tts-content-grid-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.tts-content-grid-card {
  margin-bottom: 0;
  min-width: 0;
  overflow: hidden;
}

/* 5-column controls grid override */
.tts-controls-grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

/* 4-column controls grid override */
.tts-controls-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Submit buttons inside content page cards — override the global .submit hide */
.tts-content-submit {
  margin-top: 12px;
}

.tts-content-submit .tts-btn {
  display: inline-flex;
}

/* Description text */
.tts-content-description {
  font-size: 12px;
  color: var(--tts-text-secondary);
  margin: 8px 0 0;
}

/* Post type selector */
.tts-type-selector {
  position: relative;
  border: 1px solid var(--tts-border-color);
  border-radius: var(--tts-radius-md);
  padding: 8px;
  min-height: 40px;
  cursor: pointer;
  background: var(--tts-bg-primary);
  margin-bottom: 8px;
}

.tts-type-selector:focus {
  outline: none;
  border-color: var(--tts-purple);
  box-shadow: 0 0 0 2px var(--tts-purple-bg);
}

.tts-type-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tts-type-tag {
  display: inline-flex;
  align-items: center;
  background: var(--tts-purple-bg);
  color: var(--tts-purple-text);
  border: 1px solid var(--tts-purple-border);
  padding: 3px 8px;
  border-radius: var(--tts-radius-sm);
  font-size: 12px;
  font-weight: 500;
}

.tts-type-tag .remove-type {
  margin-left: 4px;
  cursor: pointer;
  font-size: 14px;
  color: var(--tts-purple-text);
  opacity: 0.6;
}

.tts-type-tag .remove-type:hover {
  opacity: 1;
}

.tts-type-dropdown-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--tts-text-hint);
}

.tts-type-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: -1px;
  right: -1px;
  background: var(--tts-bg-primary);
  border: 1px solid var(--tts-border-color);
  border-top: none;
  border-radius: 0 0 var(--tts-radius-md) var(--tts-radius-md);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
}

.tts-type-selector:focus .tts-type-dropdown {
  display: block;
}

.tts-type-dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--tts-text-primary);
}

.tts-type-dropdown-item:hover {
  background: var(--tts-bg-secondary);
}

/* Info row (reusable) */
.tts-info-row {
  display: none;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: var(--tts-bg-secondary);
  border-left: 2px solid var(--tts-purple);
  border-radius: 0 var(--tts-radius-md) var(--tts-radius-md) 0;
  font-size: 12px;
  color: var(--tts-text-secondary);
  margin: 8px 0;
}

.tts-info-row.tts-info-visible {
  display: flex;
}

.tts-info-icon {
  color: var(--tts-purple);
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}

.tts-info-link {
  color: var(--tts-purple);
  text-decoration: none;
  font-weight: 500;
}

.tts-info-link:hover {
  text-decoration: underline;
}

/* Product section visibility */
.tts-product-section {
  display: none;
}

.tts-product-section.tts-product-visible {
  display: block;
}

/* Image sub-options */
.tts-image-sub-options {
  display: none;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--tts-bg-primary);
  border: 1px solid var(--tts-border-color);
  border-radius: var(--tts-radius-md);
}

.tts-image-sub-options.tts-sub-visible {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tts-image-sub-options .tts-audio-label {
  margin-right: 4px;
  flex-shrink: 0;
}

.tts-image-sub-checks {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.tts-image-sub-checks label {
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  color: var(--tts-text-secondary);
  cursor: pointer;
}

.tts-image-sub-checks input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--tts-purple);
}

/* Product label row */
.tts-product-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tts-product-hide-label {
  white-space: nowrap;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.tts-product-label-row input[type="text"] {
  flex: 1;
  min-width: 0;
}

/* Textarea in audio fields */
.tts-audio-field textarea {
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--tts-border-color);
  border-radius: var(--tts-radius-md);
  background: var(--tts-bg-primary);
  color: var(--tts-text-primary);
  width: 100%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: border-color 0.15s;
  resize: vertical;
}

.tts-audio-field textarea:hover {
  border-color: var(--tts-text-secondary);
}

.tts-audio-field textarea:focus {
  border-color: var(--tts-purple);
  outline: none;
  box-shadow: 0 0 0 3px var(--tts-purple-bg);
}

/* Collapsible trigger (separator that toggles) */
.tts-collapsible-trigger {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.tts-collapsible-trigger .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  transition: transform 0.2s;
  color: var(--tts-text-hint);
}

.tts-separator-hint {
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--tts-text-hint);
  margin-left: auto;
  text-align: right;
  margin-left: 4px;
}

/* Collapsible content (hidden by default) */
.tts-collapsible-content {
  display: none;
}

/* Template hint */
.tts-template-hint {
  font-size: 10px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--tts-text-hint);
  white-space: nowrap;
}

/* PRO notice bar */
.tts-content-pro-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-top: 12px;
  background: var(--tts-purple-bg);
  border: 1px solid var(--tts-purple-border);
  border-radius: var(--tts-radius-md);
  font-size: 13px;
  color: var(--tts-purple-text);
}

/* PRO locked overlay */
.tts-content-pro-locked {
  position: relative;
  opacity: 0.7;
}

.tts-content-pro-locked::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(107, 69, 212, 0.04) 10px,
    rgba(107, 69, 212, 0.04) 20px
  );
  pointer-events: none;
  border-radius: var(--tts-radius-md);
}

/* Collapse button in card header */
.tts-card-header-collapsible {
  cursor: default;
}

.tts-collapse-btn {
  background: var(--tts-bg-primary);
  border: 1px solid var(--tts-border-color);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.tts-collapse-btn:hover {
  background: var(--tts-bg-secondary);
  border-color: var(--tts-text-hint);
}

.tts-collapse-btn:focus {
  outline: 2px solid var(--tts-purple);
  outline-offset: 2px;
}

.tts-collapse-btn .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
  transition: transform 0.3s;
  color: var(--tts-text-secondary);
}

.tts-collapse-btn[aria-expanded="true"] .dashicons {
  transform: rotate(180deg);
}

/* Word replacement table */
.tts-word-replacement-card .wp-list-table {
  border: 1px solid var(--tts-border-color);
  border-radius: var(--tts-radius-md);
  overflow: hidden;
}

.tts-word-replacement-card .wp-list-table th {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--tts-text-secondary);
}

.tts-word-replacement-card .wp-list-table td {
  font-size: 13px;
}

.tts-word-replacement-card .wp-list-table .tts-btn {
  font-size: 12px;
  padding: 4px 10px;
}

.tts-empty-table {
  text-align: center;
  color: var(--tts-text-hint);
  padding: 20px;
}

/* Add replacement form */
.tts-add-replacement {
  margin-top: 16px;
  padding: 16px;
  background: var(--tts-bg-primary);
  border: 1px solid var(--tts-border-color);
  border-radius: var(--tts-radius-md);
}

.tts-add-replacement h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--tts-text-primary);
}

/* Replacement examples */
.tts-replacement-examples {
  margin-top: 16px;
  padding: 16px;
  background: var(--tts-bg-tertiary);
  border-radius: var(--tts-radius-md);
}

.tts-examples-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.tts-example-section h4 {
  margin: 0 0 10px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--tts-text-primary);
}

.tts-example-section ul {
  margin: 0;
  padding-left: 18px;
}

.tts-example-section li {
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--tts-text-secondary);
}

.tts-example-section em {
  font-size: 11px;
  color: var(--tts-text-hint);
}

.tts-example-intro {
  margin: -4px 0 10px 0;
  font-size: 12px;
  color: var(--tts-text-hint);
}

.tts-tip {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--tts-text-hint);
  text-align: center;
  padding-top: 10px;
  border-top: 1px solid var(--tts-border-color);
}

/* Responsive: content page grids */
@media screen and (max-width: 1024px) {
  .tts-content-grid-row {
    grid-template-columns: 1fr;
  }

  .tts-content-grid-card {
    margin-bottom: 0;
  }

  .tts-controls-grid-5 {
    grid-template-columns: repeat(3, 1fr);
  }

  .tts-controls-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .tts-examples-grid {
    grid-template-columns: 1fr;
  }
}

@media screen and (max-width: 782px) {
  .tts-controls-grid-5 {
    grid-template-columns: repeat(2, 1fr);
  }

  .tts-controls-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* SSML tooltip popup */
.tts-ssml-btn-wrap {
  position: relative;
}

.mementor-tts-ssml-popup {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  background: var(--tts-bg-primary, #fff);
  border: 1px solid var(--tts-border-color, #e2e4e7);
  border-radius: var(--tts-radius-lg, 12px);
  padding: 20px;
  min-width: 380px;
  max-width: 500px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--tts-text-primary);
}

.mementor-tts-ssml-popup p {
  margin: 0 0 10px;
}

.mementor-tts-ssml-popup i {
  color: var(--tts-text-secondary);
  font-size: 12px;
}

.mementor-tts-ssml-popup .ssml-code {
  background: var(--tts-purple-bg);
  color: var(--tts-purple);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 12px;
}

.mementor-tts-ssml-popup-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--tts-text-hint);
  cursor: pointer;
  line-height: 1;
}

.mementor-tts-ssml-popup-close:hover {
  color: var(--tts-text-primary);
}

.mementor-tts-ssml-popup .mementor-tts-tooltip-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: var(--tts-border);
}
