/* ==================== FRONTEND/CSS/TUNING.CSS ==================== */

/* ==================== UNIFIED AI TUNING HUB MODAL & DRAWER ==================== */

.btn-tuning-hub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  color: #C7D2FE;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.btn-tuning-hub:hover {
  background: rgba(99, 102, 241, 0.22);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 14px var(--primary-glow);
  transform: translateY(-0.5px);
}

.tuning-model-badge {
  font-size: 11px;
  font-weight: 600;
  color: #e5e7eb;
  letter-spacing: -0.2px;
}

.tuning-active-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

/* VOICE INPUT BUTTON */
.btn-voice {
  color: var(--text-muted);
  transition: all 0.2s ease;
}

/* ==================== UNIFIED PLUS ACTION MENU ==================== */

.btn-plus-action {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: var(--radius-sm, 6px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-top: 1px solid var(--border-glass-specular);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  box-sizing: border-box;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-plus-action:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 10px var(--primary-glow);
  transform: translateY(-0.5px);
}

.plus-action-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 220px;
  background: rgba(16, 20, 32, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-top: 1px solid var(--border-glass-specular);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 20px rgba(99, 102, 241, 0.15);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 1000;
  animation: popoverFadeUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.plus-action-popover.hidden,
.quick-model-popover.hidden {
  display: none !important;
}

@keyframes popoverFadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.action-popover-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
}

.action-popover-item:hover {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.3);
  color: #fff;
}

.action-popover-item i {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.icon-act-upload { color: #38BDF8; }
.icon-act-drive { color: #34D399; }
.icon-act-voice { color: #F43F5E; }
.icon-act-web { color: #A78BFA; }
.icon-act-fork { color: #818CF8; }
.icon-act-promote { color: #F59E0B; }
.icon-act-export { color: #EC4899; }

.action-popover-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

.action-popover-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  padding: 4px 8px 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.plus-action-popover {
  width: 250px !important;
}

.action-item-content {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.action-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-bright);
}

.action-item-desc {
  font-size: 10.5px;
  color: var(--text-dim);
}


/* ==================== QUICK MODEL SELECTOR POPOVER ==================== */

.btn-quick-model-pill {
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  color: #C7D2FE;
  padding: 0 10px;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 11.5px;
  font-weight: 600;
  box-sizing: border-box;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.btn-quick-model-pill:hover {
  background: rgba(99, 102, 241, 0.24);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 14px var(--primary-glow);
  transform: translateY(-0.5px);
}

.icon-model-bolt {
  font-size: 11px;
  color: var(--accent-cyan);
}

.icon-model-chevron {
  font-size: 9px;
  opacity: 0.65;
  margin-left: 2px;
}

.quick-model-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 310px;
  max-width: 90vw;
  background: rgba(16, 20, 32, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-top: 1px solid var(--border-glass-specular);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.8), 0 0 20px rgba(99, 102, 241, 0.15);
  z-index: 1000;
  animation: popoverFadeUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.quick-model-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 6px;
}

.quick-model-header-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-deep-tuning-link {
  background: transparent;
  border: none;
  color: var(--accent-cyan);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn-deep-tuning-link:hover {
  background: rgba(56, 189, 248, 0.12);
  color: #fff;
}

.quick-model-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}

.quick-model-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
}

.quick-model-item:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
}

.quick-model-item.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--primary);
  border-top-color: var(--accent-cyan);
}


/* ==================== GOOGLE AI STUDIO RUN SETTINGS STREAM ==================== */

.tuning-dashboard-stream {
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
  padding: 18px 16px 36px !important;
  overflow-y: auto !important;
  flex: 1 1 auto !important;
  max-height: none !important;
}

.run-settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid var(--border-color);
  border-top: 1px solid var(--border-glass-specular);
  border-radius: var(--radius-md, 8px);
  padding: 14px 14px 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s ease;
}

.run-settings-section:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.section-label-header {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* Custom Sleek Dropdown (Exact Match with Quick Selector Glass Highlight) */
.custom-dropdown-wrap {
  position: relative;
  width: 100%;
}

.btn-custom-select {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: rgba(18, 24, 38, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm, 6px);
  color: #F1F5F9;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.btn-custom-select:hover {
  background: rgba(26, 34, 52, 0.98);
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}

.btn-custom-select.active {
  border-color: var(--primary);
  border-top-color: var(--accent-cyan);
  box-shadow: 0 0 0 1px var(--primary), 0 0 14px var(--primary-glow);
}

.custom-select-label-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.custom-select-arrow {
  font-size: 10px;
  color: var(--text-dim);
  transition: transform 0.2s ease;
}

.btn-custom-select.active .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-select-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: rgba(16, 20, 32, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-top: 1px solid var(--border-glass-specular);
  border-radius: var(--radius-md, 8px);
  padding: 6px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.8), 0 0 20px rgba(99, 102, 241, 0.15);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: popoverFadeUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-select-popover.hidden {
  display: none !important;
}

.popover-textarea {
  width: 100%;
  background-color: rgba(18, 24, 38, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm, 6px);
  color: var(--text-main);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 10px;
  resize: none !important;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.popover-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.model-desc-helper {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 2px;
}

.tool-switches-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tool-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm, 6px);
  gap: 12px;
  transition: all 0.18s ease;
}

.tool-switch-row:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(99, 102, 241, 0.3);
}

.tool-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.tool-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 7px;
}

.tool-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
}

.advanced-params-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.param-slider-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm, 6px);
}

.param-slider-group .slider-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  gap: 8px;
}

.param-slider-group .slider-row > span:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.param-slider-group .slider-val-sm {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  color: var(--accent-cyan);
  white-space: nowrap;
  flex-shrink: 0;
  padding: 1px 6px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 4px;
}

.quick-model-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.quick-model-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quick-model-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-bright);
}

.quick-model-desc {
  font-size: 10.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-model-check {
  color: var(--accent-green);
  font-size: 12px;
  flex-shrink: 0;
}


.btn-voice:hover {
  color: var(--accent-cyan);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.btn-voice.recording {
  background: rgba(244, 63, 94, 0.2) !important;
  border-color: #f43f5e !important;
  color: #f43f5e !important;
  animation: voicePulse 1.2s infinite ease-in-out;
}

@keyframes voicePulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.6); }
  50% { transform: scale(1.08); box-shadow: 0 0 14px 4px rgba(244, 63, 94, 0.4); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.6); }
}

/* SLASH COMMANDS MENU */
.slash-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  max-width: 480px;
  background: rgba(18, 22, 35, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-top: 1px solid var(--border-glass-specular);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 20px rgba(99, 102, 241, 0.15);
  z-index: 100;
  overflow: hidden;
  animation: slashFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slashFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.slash-header {
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #C7D2FE;
  background: rgba(99, 102, 241, 0.1);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

.slash-item {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.15s ease;
}

.slash-item:last-child {
  border-bottom: none;
}

.slash-item:hover, .slash-item.active {
  background: rgba(99, 102, 241, 0.18);
}

.slash-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.slash-cmd {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--accent-cyan);
}

.slash-desc {
  font-size: 11.5px;
  color: var(--text-muted);
}

.slash-item i {
  color: var(--text-dim);
  font-size: 11px;
}

/* COST PILL & SPEAKER TTS */
.cost-pill {
  background: rgba(234, 179, 8, 0.12) !important;
  border: 1px solid rgba(234, 179, 8, 0.3) !important;
  color: #fef08a !important;
}

.cost-pill i {
  color: #eab308;
}

.btn-bubble-speak {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
}

.btn-bubble-speak:hover {
  color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.05);
}

.btn-bubble-speak.speaking {
  color: #ef4444 !important;
  animation: speakPulse 1s infinite alternate;
}

@keyframes speakPulse {
  from { transform: scale(1); }
  to { transform: scale(1.18); }
}
