/* ═══════════════════════════════════════════════════
   YT Audio Player Pro v2 — Premium Design
   Aesthetic: High-end audio app, dark & minimal
   Font: Outfit (Google Fonts)
═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ── Variables ── */
.ytap {
  --bg:        #0A090F;
  --surface:   #13121A;
  --surface2:  #1C1B24;
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.12);
  --text:      #EFEFF5;
  --text2:     rgba(239,239,245,0.5);
  --text3:     rgba(239,239,245,0.3);
  --accent:    #7C5CFC;
  --accent-r:  124,92,252;
  --accent2:   #A78BFA;
  --red:       #F87171;
  --green:     #4ADE80;
  --ease:      cubic-bezier(.4,0,.2,1);
  --ease-out:  cubic-bezier(0,0,.2,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);

  /* layout */
  font-family: 'Outfit', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  border-radius: 20px;
  border: 1px solid var(--border);
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(124,92,252,0.1) inset,
    0 32px 80px rgba(0,0,0,0.7),
    0 8px 24px rgba(0,0,0,0.4);
  position: relative;
}

.ytap * { box-sizing: border-box; margin: 0; padding: 0; }
.ytap button { cursor: pointer; font-family: inherit; }

/* ── TOP BAR ── */
.ytap-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.ytap-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ytap-brand-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-r), 0.7);
  animation: ytap-dot-pulse 2.5s ease-in-out infinite;
}
@keyframes ytap-dot-pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.5; transform:scale(.75); }
}

.ytap-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 3px 8px;
}

/* ── SEARCH AREA ── */
.ytap-search-area {
  padding: 16px 20px 0;
}

.ytap-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 4px 4px 4px 14px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.ytap-search-box:focus-within {
  border-color: rgba(var(--accent-r), 0.5);
  box-shadow: 0 0 0 3px rgba(var(--accent-r), 0.1);
}

.ytap-search-icon {
  color: var(--text3);
  flex-shrink: 0;
}

.ytap-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  min-width: 0;
  padding: 9px 0;
}
.ytap-search-input::placeholder { color: var(--text3); }

.ytap-load-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s;
  box-shadow: 0 4px 16px rgba(var(--accent-r), 0.35);
}
.ytap-load-btn:hover  { transform: translateY(-1px); box-shadow: 0 7px 22px rgba(var(--accent-r), 0.5); }
.ytap-load-btn:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(var(--accent-r), 0.3); }
.ytap-load-btn:disabled { opacity: .5; pointer-events: none; }

.ytap-err {
  font-size: 12px;
  color: var(--red);
  min-height: 20px;
  padding: 5px 2px 0;
}

/* ── IDLE STATE ── */
.ytap-idle-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 44px;
  position: relative;
}

.ytap-idle-rings {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  pointer-events: none;
}
.ytap-idle-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(var(--accent-r), 0.1);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: ytap-idle-expand 3s ease-out infinite;
}
.ytap-idle-ring.r1 { width:80px;  height:80px;  animation-delay:0s;    }
.ytap-idle-ring.r2 { width:120px; height:120px; animation-delay:0.5s;  }
.ytap-idle-ring.r3 { width:160px; height:160px; animation-delay:1s;    }
@keyframes ytap-idle-expand {
  0%   { opacity:.4; }
  100% { opacity:0; }
}

.ytap-idle-icon {
  color: var(--text3);
  margin-bottom: 12px;
  position: relative;
  z-index:1;
}
.ytap-idle-text {
  font-size: 14px;
  color: var(--text3);
  font-weight: 400;
  position: relative;
  z-index:1;
}

/* ── LOADING STATE ── */
.ytap-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 44px 24px;
  color: var(--text2);
  font-size: 14px;
}
.ytap-spinner svg {
  animation: ytap-spin 0.9s linear infinite;
  color: var(--accent);
}
@keyframes ytap-spin { to { transform:rotate(360deg); } }

/* ══════════════════════════════════
   PLAYER STATE
══════════════════════════════════ */
.ytap-player {
  padding: 20px 20px 22px;
}

/* ── Art + Info ── */
.ytap-top {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
}

.ytap-art-wrap {
  position: relative;
  flex-shrink: 0;
}
.ytap-art-glow {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-r), 0.3) 0%, transparent 70%);
  filter: blur(10px);
  opacity: 0;
  transition: opacity 0.5s;
}
.ytap-art-wrap.glowing .ytap-art-glow { opacity: 1; }

.ytap-art {
  width: 90px; height: 90px;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background: var(--surface2);
  border: 1px solid var(--border2);
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.ytap-art img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.ytap-eq {
  position: absolute;
  bottom: 8px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 18px;
  opacity: 0;
  transition: opacity .3s;
}
.ytap-eq.on { opacity: 1; }
.ytap-eq span {
  width: 3px;
  border-radius: 2px;
  background: #fff;
  display: block;
  animation: ytap-eq 0.7s ease-in-out infinite alternate;
}
.ytap-eq span:nth-child(1){animation-duration:.5s; animation-delay:0s;}
.ytap-eq span:nth-child(2){animation-duration:.7s; animation-delay:.1s;}
.ytap-eq span:nth-child(3){animation-duration:.4s; animation-delay:.05s;}
.ytap-eq span:nth-child(4){animation-duration:.8s; animation-delay:.2s;}
.ytap-eq span:nth-child(5){animation-duration:.6s; animation-delay:.15s;}
@keyframes ytap-eq { from{height:3px} to{height:16px} }

.ytap-info { flex: 1; min-width: 0; }

.ytap-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ytap-channel {
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ytap-quality-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
}
.ytap-dot-live {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 5px var(--green);
  display: inline-block;
}

/* ── Progress ── */
.ytap-progress-section { margin-bottom: 20px; }

.ytap-progress-bar {
  position: relative;
  height: 4px;
  cursor: pointer;
  margin-bottom: 8px;
  padding: 8px 0;
  margin-top: -8px;
}
.ytap-progress-track {
  position: absolute;
  top: 50%; left: 0; right: 0;
  transform: translateY(-50%);
  height: 3px;
  background: var(--surface2);
  border-radius: 99px;
}
.ytap-progress-fill {
  position: absolute;
  top: 50%; left: 0;
  transform: translateY(-50%);
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  pointer-events: none;
  transition: width .15s linear;
}
.ytap-progress-head {
  width: 13px; height: 13px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 50%; left: 0%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: left .15s linear, opacity .2s;
  box-shadow: 0 0 0 3px rgba(var(--accent-r),.3), 0 2px 6px rgba(0,0,0,.4);
}
.ytap-progress-bar:hover .ytap-progress-head { opacity: 1; }

.ytap-times {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  font-variant-numeric: tabular-nums;
}

/* ── Controls ── */
.ytap-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.ytap-btn {
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  background: var(--surface2);
  border-radius: 50%;
  transition: all .18s var(--ease);
}
.ytap-btn:hover { background: var(--surface2); color: var(--text); transform: scale(1.08); }

.ytap-btn-sm {
  width: 44px; height: 44px;
  border: 1px solid var(--border2);
}

.ytap-btn-play {
  width: 62px; height: 62px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 28px rgba(var(--accent-r), 0.4);
  border: none;
}
.ytap-btn-play:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 36px rgba(var(--accent-r), 0.55);
  transform: scale(1.06);
}
.ytap-btn-play:active { transform: scale(0.97); }

/* ── Bottom Row ── */
.ytap-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ytap-vol-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.ytap-mute-btn {
  background: transparent;
  border: none;
  color: var(--text3);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 6px;
  transition: color .18s;
}
.ytap-mute-btn:hover { color: var(--text); }

.ytap-vol-track {
  flex: 1;
  height: 3px;
  background: var(--surface2);
  border-radius: 99px;
  position: relative;
  cursor: pointer;
}
.ytap-vol-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent2);
  pointer-events: none;
}
.ytap-vol-range {
  position: absolute;
  inset: -10px 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}

/* Download button */
.ytap-dl-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid rgba(var(--accent-r), 0.3);
  border-radius: 10px;
  background: transparent;
  color: var(--accent2);
  font-size: 13px;
  font-weight: 600;
  font-family: 'Outfit', system-ui, sans-serif;
  white-space: nowrap;
  transition: all .18s var(--ease);
}
.ytap-dl-btn:hover {
  background: rgba(var(--accent-r), 0.1);
  border-color: rgba(var(--accent-r), 0.55);
  transform: translateY(-1px);
}
.ytap-dl-btn:active { transform: translateY(0); }

/* ══════════════════════
   WARNING MODAL
══════════════════════ */
.ytap-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: ytap-fade-in .2s ease;
}
@keyframes ytap-fade-in { from{opacity:0} to{opacity:1} }

.ytap-modal-box {
  background: #16151F;
  border: 1px solid var(--border2);
  border-radius: 20px;
  max-width: 380px;
  width: 100%;
  padding: 28px 24px 24px;
  box-shadow: 0 40px 90px rgba(0,0,0,0.8);
  animation: ytap-pop-in .28s var(--ease-spring);
}
@keyframes ytap-pop-in {
  from{opacity:0;transform:scale(.88) translateY(10px)}
  to{opacity:1;transform:scale(1) translateY(0)}
}

.ytap-modal-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.ytap-warn-icon {
  width: 42px; height: 42px;
  flex-shrink: 0;
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.22);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--red);
}
.ytap-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}
.ytap-modal-sub {
  font-size: 12px;
  color: var(--text2);
}

.ytap-modal-body {
  font-size: 13px;
  line-height: 1.72;
  color: var(--text2);
  margin-bottom: 16px;
}
.ytap-modal-body strong { color: var(--text); font-weight: 600; }
.ytap-modal-body ul { padding-left: 18px; margin-top: 8px; }
.ytap-modal-body ul li { margin-bottom: 4px; }

.ytap-modal-check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
  user-select: none;
  transition: background .18s;
}
.ytap-modal-check-row:hover { background: rgba(255,255,255,0.05); }
.ytap-modal-check-row input {
  width: 15px; height: 15px;
  accent-color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}

.ytap-modal-footer { display: flex; gap: 10px; }

.ytap-modal-cancel {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text2);
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  transition: all .18s;
}
.ytap-modal-cancel:hover { background: var(--surface); color: var(--text); }

.ytap-modal-ok {
  flex: 1.5;
  padding: 12px;
  border-radius: 12px;
  background: var(--accent);
  border: none;
  color: #fff;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  transition: all .18s;
  box-shadow: 0 4px 16px rgba(var(--accent-r),.3);
}
.ytap-modal-ok:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(var(--accent-r),.45);
}
.ytap-modal-ok:disabled {
  opacity: .35;
  pointer-events: none;
  box-shadow: none;
}

/* ── Utility ── */
.ytap-hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .ytap { border-radius: 16px; }
  .ytap-search-area { padding: 14px 16px 0; }
  .ytap-player { padding: 18px 16px 20px; }
  .ytap-topbar { padding: 14px 16px; }
  .ytap-load-btn span { display: none; }
  .ytap-art { width: 76px; height: 76px; border-radius: 12px; }
}
