/* assets/css/lof-base.css */

:root {
  --lof-primary: #c41e3a;
  --lof-background: #0f0c29;
  --lof-surface: #16213e;
  --lof-text: #ffffff;
  --lof-text-muted: #a8b2c1;
  --lof-success: #10b981;
  --lof-error: #ef4444;
}

.lof-viewer-shell {
  background: var(--lof-background);
  color: var(--lof-text);
  padding: 1.5rem;
  border-radius: 1.5rem;
}

.lof-viewer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ========================================
   STATUS PANEL
   ======================================== */

[data-lof='status-panel'] {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

[data-lof='state-indicator'] {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--lof-primary);
}

.lof-state--loading [data-lof='state-indicator'],
.lof-state-indicator.lof-state--loading {
  background: var(--lof-text-muted);
}

.lof-state-indicator.lof-state--active {
  background: var(--lof-success);
}

.lof-state-indicator.lof-state--degraded {
  background: #f59e0b;
}

.lof-state-indicator.lof-state--offline {
  background: var(--lof-error);
}

/* ========================================
   ACTIONS
   ======================================== */

.lof-actions {
  display: flex;
  gap: 0.75rem;
}

.lof-button {
  border-radius: 999px;
  padding: 0.5rem 1rem;
  border: none;
  font: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.lof-button--speaker {
  background: #111827;
  color: var(--lof-text);
}

.lof-button--on {
  background: var(--lof-success);
}

.lof-button--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================================
   SPEAKER CARD
   ======================================== */

.lof-speaker-card {
  background: var(--lof-surface);
  border-radius: 1rem;
  padding: 1rem;
  margin: 1rem 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.lof-speaker-header {
  margin-bottom: 0.75rem;
}

.lof-speaker-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.lof-speaker-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lof-speaker-status {
  font-size: 0.95rem;
  color: var(--lof-text);
  line-height: 1.4;
}

.lof-speaker-countdown {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--lof-success);
}

.lof-button--proximity {
  background: #2563eb;
  color: white;
}

.lof-button--proximity:hover {
  background: #1d4ed8;
}

.lof-speaker-helper {
  font-size: 0.85rem;
  color: var(--lof-text-muted);
  margin: 0;
  line-height: 1.4;
}

.lof-speaker-alternatives {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.lof-alternatives-title {
  font-size: 0.85rem;
  color: var(--lof-text-muted);
  margin-bottom: 0.5rem;
}

.lof-alternatives-buttons {
  display: flex;
  gap: 0.5rem;
}

.lof-button--alt {
  background: rgba(255, 255, 255, 0.05);
  color: var(--lof-text);
  font-size: 0.9rem;
  padding: 0.4rem 0.8rem;
}

.lof-button--alt:hover {
  background: rgba(255, 255, 255, 0.1);
}

.lof-speaker-hint {
  font-size: 0.8rem;
  color: var(--lof-text-muted);
  font-style: italic;
}

/* ========================================
   STREAM PLAYER
   ======================================== */

.lof-stream-player {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 400px;
  max-width: calc(100vw - 2rem);
  background: var(--lof-surface);
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  z-index: 1000;
  transition: all 0.3s;
}

.lof-stream-player--minimized {
  width: 200px;
  height: 50px;
}

.lof-stream-player--minimized .lof-stream-content {
  display: none;
}

.lof-stream-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.lof-stream-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.lof-stream-controls {
  display: flex;
  gap: 0.5rem;
}

.lof-stream-btn {
  background: transparent;
  border: none;
  color: var(--lof-text);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  transition: opacity 0.2s;
}

.lof-stream-btn:hover {
  opacity: 0.7;
}

.lof-stream-content {
  padding: 1rem;
}

.lof-stream-placeholder {
  text-align: center;
}

.lof-stream-placeholder p {
  margin-bottom: 1rem;
  color: var(--lof-text-muted);
  font-size: 0.9rem;
}

.lof-button--primary {
  background: var(--lof-primary);
  color: white;
  font-weight: 600;
}

.lof-button--primary:hover {
  background: #a01729;
}

.lof-stream-iframe-container {
  width: 100%;
  height: 300px;
}

.lof-stream-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ========================================
   SONG GRID
   ======================================== */

[data-lof='song-grid'] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.lof-tile {
  background: var(--lof-surface);
  padding: 0.75rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.lof-tile:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.lof-tile__title {
  font-weight: 600;
}

.lof-tile__artist {
  font-size: 0.8rem;
  color: var(--lof-text-muted);
}

.lof-tile--unavailable,
.lof-tile--cooldown,
.lof-tile--disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.lof-tile--unavailable:hover,
.lof-tile--cooldown:hover,
.lof-tile--disabled:hover {
  background: var(--lof-surface);
  transform: none;
}

/* ========================================
   QUEUE
   ======================================== */

[data-lof='queue'] {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.5rem;
}

.lof-queue-item {
  display: flex;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.25rem 0;
}

.lof-queue-item__position {
  font-weight: 600;
  min-width: 2rem;
}

.lof-queue-item__title {
  flex: 1;
}

.lof-queue-item__requested-by {
  color: var(--lof-text-muted);
}

/* ========================================
   MESSAGES
   ======================================== */

.lof-message {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lof-message--success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--lof-success);
}

.lof-message--error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--lof-error);
}

.lof-message--loading {
  background: rgba(156, 163, 175, 0.15);
}

.lof-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--lof-text);
  border-radius: 50%;
  animation: lof-spin 0.8s linear infinite;
}

@keyframes lof-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================================
   UTILITY
   ======================================== */

.lof-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.lof-empty-grid {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: var(--lof-text-muted);
  font-size: 0.9rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 640px) {
  .lof-viewer-shell {
    padding: 1rem;
  }

  [data-lof='song-grid'] {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
  }

  .lof-stream-player {
    width: calc(100vw - 2rem);
    bottom: 0.5rem;
    right: 0.5rem;
  }

  .lof-alternatives-buttons {
    flex-direction: column;
  }
}