/* ===============================
   EzTunes.XYZ Community Styles
   Modular Spotify/Emby layout
   =============================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0e1224;
  --bg2: #141939;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-border: rgba(255, 255, 255, 0.12);
  --txt: #fff;
  --acc1: #667eea;
  --acc2: #764ba2;
  --grad: linear-gradient(45deg, #667eea, #764ba2);
  --grad2: linear-gradient(45deg, #FF8E53, #FE6B8B);
  --tag-bg: rgba(102, 126, 234, 0.2);
  --tag-border: rgba(102, 126, 234, 0.3);
}

/* Light Theme Variables */
body.light {
  --bg: #f7f8fc;
  --bg2: #fff;
  --panel: rgba(0, 0, 0, 0.05);
  --panel-border: rgba(0, 0, 0, 0.1);
  --txt: #111;
  --acc1: #667eea;
  --acc2: #764ba2;
  --grad: linear-gradient(45deg, #667eea, #764ba2);
  --grad2: linear-gradient(45deg, #FF8E53, #FE6B8B);
  --tag-bg: rgba(102, 126, 234, 0.1);
  --tag-border: rgba(102, 126, 234, 0.2);
}

/* Base Layout */
html, body {
  height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--txt);
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  overflow-x: hidden;
}

body.light {
  background: #f7f8fc;
}

/* Top Navigation */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  background: rgba(20, 25, 57, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--panel-border);
}

body.light .topnav {
  background: rgba(255, 255, 255, 0.85);
  color: #111;
}

.brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
}
.brand i {
  color: #FF8E53;
}
.brand span {
  font-weight: 800; font-size: 1.15rem;
  background: linear-gradient(45deg, #FF8E53, #FE6B8B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-actions {
  display: flex; align-items: center; gap: 10px;
}

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; border-radius: 8px; padding: 8px 12px; cursor: pointer;
  font-weight: 700; color: #fff; transition: background 0.2s;
  text-decoration: none;
}
.btn:link, .btn:visited { color: #fff; text-decoration: none; }

.btn-prim { background: var(--grad2); }
.btn-sec {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.28);
  color: #fff;
}
.btn-sec:hover { background: rgba(255,255,255,0.20); }

body.light .btn-sec {
  background: rgba(0, 0, 0, 0.05);
  color: #111;
}

.search {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  max-width: 640px; margin: 0 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 12px;
}
.search input {
  flex: 1; background: transparent; border: none;
  color: var(--txt); font-size: 0.95rem; outline: none;
}

/* Page Layout */
.page {
  display: grid;
  grid-template-columns: 260px 1fr;
  margin-top: 64px;
  min-height: calc(100vh - 64px);
}

/* Sidebar */
.sidebar {
  position: sticky; 
  top: 64px; 
  align-self: start;
  height: calc(100vh - 64px);
  overflow: auto;
  background: var(--bg2);
  border-right: 1px solid var(--panel-border);
  padding: 16px 14px;
  min-width: 260px;
}
.side-section { margin-bottom: 18px; }
.side-title {
  opacity: 0.9; font-weight: 800; margin-bottom: 8px; letter-spacing: 0.3px;
}
.profile-card {
  background: var(--panel); border: 1px solid var(--panel-border);
  padding: 12px; border-radius: 12px;
  display: flex; gap: 10px; align-items: center;
}
.profile-card i { font-size: 24px; color: #FF8E53; }
.profile-meta { font-size: 0.9rem; }
.kv { opacity: 0.85; }

.side-link, .follow-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px; text-decoration: none;
  color: var(--txt);
  border: 1px solid transparent;
  margin-bottom: 6px;
  transition: background 0.2s;
}
.side-link:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--panel-border);
}
.follow-toggle label {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
}

.switch {
  position: relative; width: 38px; height: 20px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 20px; flex-shrink: 0;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; background: #fff;
  border-radius: 50%; transition: 0.2s;
}
.switch.on { background: var(--acc1); }
.switch.on::after { transform: translateX(18px); }

/* Main Content */
.content {
  padding: 18px 18px 80px 18px;
  overflow: hidden;
}
.section { margin-bottom: 26px; }
.section h2 {
  font-size: 1.1rem; margin-bottom: 10px;
  font-weight: 800; opacity: 0.95; letter-spacing: 0.3px;
}
.row-scroll {
  display: flex; gap: 16px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding-bottom: 6px;
}
.row-scroll::-webkit-scrollbar { height: 8px; }
.row-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* Cards */
.music-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 14px; overflow: hidden;
  min-width: 280px; max-width: 280px;
  position: relative; transition: 0.2s;
}
.music-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
  border-color: rgba(255, 142, 83, 0.5);
}
.music-embed {
  width: 100%; height: 180px; position: relative;
  overflow: hidden; background: rgba(0, 0, 0, 0.35);
}
.music-embed img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0; transition: 0.2s;
}
.music-embed:hover .play-overlay { opacity: 1; }
.play-icon { font-size: 40px; color: #fff; }

.music-info { padding: 12px; }
.music-info h3 {
  color: #FF8E53; font-size: 1.02rem; margin-bottom: 6px;
}
.music-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.music-header h3 {
  color: #FF8E53;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.music-icons {
  display: flex;
  gap: 10px;
}

.icon-btn {
  position: relative;
  cursor: pointer;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.8);
  transition: color 0.2s, transform 0.1s;
}

.icon-btn:hover {
  color: #FE6B8B;
  transform: scale(1.1);
}

.icon-btn.delete:hover {
  color: #ff5c5c;
}

/* Tooltip */
.icon-btn[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 140%; /* higher above the icon */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 30, 0.95);
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 1;
  pointer-events: none;
  z-index: 9999;
}

.icon-btn[data-tooltip]::after {
  opacity: 0;
  transition: opacity 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.music-description {
  position: relative;
  max-height: 90px;              /* trims long text */
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
  margin-bottom: 15px;
}

.music-description::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.5em;
  background: linear-gradient(transparent, rgba(22, 33, 62, 1));
}

/* Meta and Follow */
.meta-row {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.meta-left { display: flex; flex-direction: column; gap: 4px; }
.meta-user { display: flex; align-items: center; gap: 6px; }
.meta-right { display: flex; align-items: center; gap: 12px; }

.follow-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--txt);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.78rem;
  cursor: pointer; transition: 0.2s;
}
.follow-btn:hover { background: rgba(255, 255, 255, 0.2); }

/* Tags and Actions */
.music-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 10px;
  position: relative;
  z-index: 2;
}
.tag {
  background: var(--tag-bg);
  color: var(--acc1);
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--tag-border);
  font-size: 0.78rem;
}
.music-actions {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  display: flex; gap: 8px; justify-content: center;
}
.action-btn {
  flex: 1; padding: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--txt);
  border-radius: 6px; cursor: pointer; font-size: 0.9rem;
}
.action-btn:hover { background: rgba(255, 255, 255, 0.2); }
.action-btn.delete {
  background: rgba(255, 107, 107, 0.2);
  border-color: rgba(255, 107, 107, 0.3);
}

/* Scrollable Grid */
.music-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

/* Notification */
.notification {
  position: fixed; top: 70px; right: 18px; z-index: 5000;
  background: var(--grad);
  padding: 12px 16px; border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.music-tags .tag {
  background: rgba(102, 126, 234, 0.15);
  color: #a8b4ff;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  border: 1px solid rgba(102, 126, 234, 0.3);
  white-space: nowrap;
}

/* Mobile Sidebar Toggle */
.mobile-toggle {
  display: none;
  border: none;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--txt);
  padding: 8px 10px;
  border-radius: 8px;
  margin-right: 8px;
}

/* ====== MODAL VISIBILITY FIX ====== */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  padding: 40px;
  border-radius: 20px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.close {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  background: none;
  border: none;
}

.close:hover {
  color: #fff;
}

/* ===== FORM FIXES ===== */
.form-group {
  margin-bottom: 20px;
}

.form-control {
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-size: 1rem;
}

.form-control:focus {
  outline: none;
  border-color: #667eea;
}

.btn-primary {
  display: inline-block;
  width: 100%;
  text-align: center;
  padding: 12px 20px;
  background: linear-gradient(45deg, #FF8E53, #FE6B8B);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
}

.icon-btn {
  position: relative;
}

.icon-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%; /* above the icon */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.icon-btn:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

.scroll-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  margin: 1.5rem 0;
}

.scroll-row {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.scroll-row::-webkit-scrollbar {
  display: none;
}

.scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(30, 100, 200, 0.75);
  backdrop-filter: blur(4px);
  border: 2px solid rgba(100, 180, 255, 0.8);
  color: white;
  font-size: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  opacity: 0.85;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-btn:hover {
  opacity: 1;
  background: rgba(50, 150, 255, 0.9);
  border-color: rgba(150, 200, 255, 1);
  transform: translateY(-50%) scale(1.1);
}

.scroll-btn.left { left: 16px; }
.scroll-btn.right { right: 16px; }

/* Keep button links white in all states (fixes purple visited color) */
a.btn, a.btn:link, a.btn:visited, a.btn:hover, a.btn:active { color:#fff; text-decoration:none; }

a.btn.btn-sec { background: rgba(255,255,255,.14); border:1px solid rgba(255,255,255,.28); }
a.btn.btn-sec:hover { background: rgba(255,255,255,.22); }

.topnav .btn {
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
  color: #fff;
  transition: background 0.2s;
  text-decoration: none;
}

/* force all link states to white in the top bar */
.topnav a.btn:link,
.topnav a.btn:visited,
.topnav a.btn:hover,
.topnav a.btn:active {
  color: #fff;
  text-decoration: none;
}

@media (max-width: 768px) {
  .scroll-btn { display: none; }
}

/* Responsive */
@media (max-width: 960px) {
  .page { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-toggle { display: inline-flex; }
  .content { padding: 14px; }
  .row-scroll { gap: 12px; }
  .music-card { min-width: 240px; max-width: 240px; }
  .music-embed { height: 160px; }
}
