/* ═══════════════════════════════════════════════════════════
   stream.christradio.de — Streamer-spezifische Styles
   Erweitert das christradio.de Design-System (styles.css)
   Palette: Midnight Blue · Warm Gold · Ivory · Cream
═══════════════════════════════════════════════════════════ */

/* ─── Broadcast Card States ─────────────────────── */
#broadcast-card {
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

#broadcast-card.state-streaming {
  border-color: rgba(200, 168, 75, 0.55);
  box-shadow:
    var(--shadow),
    0 0 32px rgba(200, 168, 75, 0.22),
    0 0 0 1px rgba(200, 168, 75, 0.12) inset;
  animation: card-pulse 2.6s ease-in-out infinite;
}

#broadcast-card.state-error {
  border-color: rgba(224, 96, 96, 0.55);
  box-shadow:
    var(--shadow),
    0 0 28px rgba(224, 96, 96, 0.25);
}

@keyframes card-pulse {
  0%, 100% { box-shadow: var(--shadow), 0 0 24px rgba(200, 168, 75, 0.15); }
  50%       { box-shadow: var(--shadow), 0 0 42px rgba(200, 168, 75, 0.35); }
}

/* ─── Stream Button – Streaming State ──────────── */
#btn-stream.btn-streaming {
  background: linear-gradient(145deg, #b83232 0%, #8a1818 100%);
  border-color: #c84040;
  box-shadow: 0 4px 22px rgba(184, 48, 48, 0.45);
}

#btn-stream.btn-streaming:hover {
  box-shadow: 0 6px 30px rgba(224, 64, 64, 0.65);
}

/* ─── Icon – Loading Spin ───────────────────────── */
.icon-loading {
  animation: spin 0.9s linear infinite;
}

/* ─── Level Meter ───────────────────────────────── */
.level-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 4px;
}

.level-row .vol-icon {
  flex-shrink: 0;
  color: var(--muted);
}

.level-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  overflow: visible;
  position: relative;
}

.level-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  transition: width 60ms linear, background 200ms;
  will-change: width;
}

/* Red clip marker at ~95% (≈ –3 dBFS) */
.level-clip-mark {
  position: absolute;
  right: 5%;
  top: -3px;
  bottom: -3px;
  width: 1px;
  background: rgba(200, 168, 75, 0.3);
  border-radius: 1px;
}

.level-db {
  font-family: 'Cormorant SC', serif;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--muted);
  min-width: 52px;
  text-align: right;
  flex-shrink: 0;
}

/* ─── Settings Grid ─────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 14px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Wide = takes left column only (2/3 of grid) */
.form-field--wide {
  grid-column: span 1;
}

/* Full width */
.form-field--full {
  grid-column: 1 / -1;
}

/* ─── SSL Toggle ────────────────────────────────── */
.ssl-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.ssl-label {
  font-family: 'Cormorant SC', serif;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color var(--transition);
}

.ssl-toggle:has(input:checked) .ssl-label {
  color: var(--gold);
}

.toggle-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.toggle-wrap input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  display: inline-flex;
  align-items: center;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  padding: 2px;
  transition: background var(--transition), border-color var(--transition);
  cursor: pointer;
}

/* JS setzt .checked auf .toggle-track sobald Checkbox aktiv ist */
.toggle-track.checked {
  background: var(--gold-dim);
  border-color: var(--gold);
}

.toggle-thumb {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform var(--transition), background var(--transition);
  will-change: transform;
}

.toggle-track.checked .toggle-thumb {
  transform: translateX(16px);
  background: var(--gold);
}

/* ─── select arrow reset ────────────────────────── */
select.form-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a8fa8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

select.form-input option {
  background-color: var(--panel);
  color: var(--cream);
}

/* ─── number input – hide arrows ───────────────── */
input[type="number"].form-input::-webkit-inner-spin-button,
input[type="number"].form-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"].form-input {
  -moz-appearance: textfield;
}

/* ─── Status message colors ─────────────────────── */
#status-msg {
  transition: color var(--transition);
}

#status-msg.msg-error {
  color: #e07070;
}

#status-msg.msg-success {
  color: #70c870;
}

/* ─── Stream Footer ─────────────────────────────── */
.stream-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
}

.footer-note {
  font-family: 'Crimson Pro', serif;
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--muted);
  text-align: center;
  line-height: 1.65;
}

.footer-note strong {
  color: var(--gold);
  font-weight: 600;
}

.footer-link {
  font-family: 'Cormorant SC', serif;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--gold);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.footer-link:hover {
  opacity: 1;
}

/* ─── Broadcast card – label colors ─────────────── */
#stream-state-label {
  transition: color var(--transition);
}

#broadcast-card.state-streaming #stream-state-label {
  color: #70c870;
}

#broadcast-card.state-error #stream-state-label {
  color: #e07070;
}

/* ─── LIVE dot next to label ────────────────────── */
#broadcast-card.state-streaming #stream-state-label::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #70c870;
  margin-right: 7px;
  vertical-align: middle;
  animation: live-blink 1.2s ease-in-out infinite;
}

@keyframes live-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 380px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .form-field--wide {
    grid-column: 1 / -1;
  }
}

@media (min-width: 520px) {
  .settings-grid {
    grid-template-columns: 2fr 1fr;
  }
}
