:root {
  --bg: #090d0b;
  --surface: rgba(20, 27, 23, 0.85);
  --surface-strong: #151d18;
  --border: rgba(255, 255, 255, 0.09);
  --text: #f3f7f4;
  --muted: #98a89f;
  --green: #1db954;
  --green-hover: #1ed760;
  --green-soft: rgba(29, 185, 84, 0.14);
  --danger: #ff5c6c;
  --danger-soft: rgba(255, 92, 108, 0.14);
  --info: #4ea8ff;
  --info-soft: rgba(78, 168, 255, 0.14);
  --warn: #f5b942;
  --warn-soft: rgba(245, 185, 66, 0.15);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 12%, rgba(29, 185, 84, 0.2), transparent 42%),
    radial-gradient(circle at 82% 18%, rgba(29, 185, 84, 0.1), transparent 36%),
    radial-gradient(circle at 50% 95%, rgba(18, 92, 46, 0.16), transparent 50%);
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 20px 56px;
}

.hero {
  text-align: center;
  margin-bottom: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--green-soft);
  border: 1px solid rgba(29, 185, 84, 0.35);
  margin-bottom: 18px;
}

.brand-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  color: var(--green);
}

.brand-name {
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  color: #b7f7cd;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 4vw, 2.55rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.subtitle {
  margin: 0 auto;
  max-width: 620px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.subtitle code,
.alert code {
  color: #c5f7d6;
  background: rgba(255, 255, 255, 0.07);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.9em;
}

.search-card,
.preview-card {
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.38);
}

.preview-card {
  margin-top: 22px;
}

.search-form {
  display: flex;
  gap: 12px;
}

.input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrap:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.2);
}

.input-wrap input {
  width: 100%;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 0.98rem;
  padding: 15px 14px 15px 16px;
  min-width: 0;
}

.input-wrap input::placeholder {
  color: #708077;
}

.ghost-btn {
  margin-right: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: var(--green);
  color: #05130a;
  border: 0;
  border-radius: 13px;
  padding: 0 22px;
  min-height: 50px;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.primary-btn:hover:not(:disabled) {
  background: var(--green-hover);
}

.primary-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 18px;
  border-radius: 13px;
  border: 1px solid rgba(29, 185, 84, 0.4);
  background: var(--green-soft);
  color: #bff8d2;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.secondary-btn:hover {
  background: rgba(29, 185, 84, 0.24);
}

.format-hints {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--muted);
}

.pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.77rem;
  color: #c2d1c8;
}

.alert {
  margin-top: 14px;
  padding: 12px 15px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.alert-error {
  background: var(--danger-soft);
  border: 1px solid rgba(255, 92, 108, 0.35);
  color: #ffc7cd;
}

.alert-info {
  background: var(--info-soft);
  border: 1px solid rgba(78, 168, 255, 0.3);
  color: #cbe6ff;
}

.collection-header {
  display: flex;
  gap: 20px;
  align-items: center;
}

.cover-img {
  width: 132px;
  height: 132px;
  border-radius: 14px;
  object-fit: cover;
  background: #1a241e;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.collection-meta {
  flex: 1;
  min-width: 0;
}

.type-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #9df7bc;
  margin-bottom: 8px;
}

.collection-title {
  margin: 0 0 6px;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.2;
  word-break: break-word;
}

.collection-subtitle {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.collection-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.audio-source-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.audio-source-select option {
  background: #121915;
  color: var(--text);
}

.audio-source-select:focus {
  border-color: var(--green);
}

.audio-source-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.progress-panel {
  margin-top: 20px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
}

.progress-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #16a34a, #1ed760);
  transition: width 0.25s ease;
}

.progress-counts {
  margin: 9px 0 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.playlist-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding: 10px 4px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.select-all-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-weight: 600;
}

.select-all-label input,
.track-checkbox {
  width: 17px;
  height: 17px;
  accent-color: var(--green);
  cursor: pointer;
}

.selected-counter {
  color: var(--muted);
  font-size: 0.86rem;
}

.tracks-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  max-height: 430px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(9, 13, 11, 0.55);
}

.track-item {
  display: grid;
  grid-template-columns: auto 28px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.track-item.is-single {
  grid-template-columns: 28px 1fr auto auto;
}

.track-item:last-child {
  border-bottom: 0;
}

.track-index {
  color: var(--muted);
  font-size: 0.84rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.track-info {
  min-width: 0;
}

.track-title {
  font-weight: 600;
  font-size: 0.93rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-error-msg {
  color: #ff9ba6;
  font-size: 0.76rem;
  margin-top: 4px;
  line-height: 1.35;
  word-break: break-word;
}

.track-duration {
  color: var(--muted);
  font-size: 0.83rem;
  font-variant-numeric: tabular-nums;
}

.status-badge {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-pending {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.status-active {
  background: var(--warn-soft);
  color: #ffdd8f;
}

.status-completed {
  background: var(--green-soft);
  color: #9df7bc;
}

.status-error {
  background: var(--danger-soft);
  color: #ffb8c0;
}

/* Estilos do Instalador */
.section-heading {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 700;
}

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  font-size: 0.92rem;
}

.check-item.is-ok .check-dot {
  color: var(--green);
  font-weight: 800;
}

.check-item.is-fail {
  background: var(--danger-soft);
  border-color: rgba(255, 92, 108, 0.35);
}

.check-item.is-fail .check-dot {
  color: var(--danger);
  font-weight: 800;
}

.install-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

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

.field-full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  padding: 12px 13px;
  font-size: 0.93rem;
  outline: none;
}

.field select option {
  background: #121915;
  color: var(--text);
}

.field input:focus,
.field select:focus {
  border-color: var(--green);
}

.btn-spinner {
  width: 17px;
  height: 17px;
  border: 2.5px solid rgba(5, 19, 10, 0.25);
  border-top-color: #05130a;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.hidden {
  display: none !important;
}

.footer {
  margin-top: 26px;
  text-align: center;
  color: #6f7f76;
  font-size: 0.83rem;
}

.cookies-panel {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.cookies-summary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}

.cookies-summary-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cookies-chevron {
  display: inline-block;
  transition: transform 0.2s ease;
}

.cookies-summary[aria-expanded='true'] .cookies-chevron {
  transform: rotate(180deg);
}

.cookies-body {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.cookies-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.cookies-textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  resize: vertical;
}

.cookies-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.cookies-feedback {
  font-size: 0.82rem;
  color: #9df7bc;
}

@media (max-width: 680px) {
  .search-form,
  .install-grid {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .collection-header {
    flex-direction: column;
    text-align: center;
  }

  .collection-actions {
    justify-content: center;
  }

  .track-item {
    grid-template-columns: auto 22px 1fr auto;
  }

  .track-duration {
    display: none;
  }
}
