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

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --bg-gradient: radial-gradient(circle at top left, #1e1b4b, #030712);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

html {
  font-size: 12px;
  /* Scales whole 16px-based UI down by 25% */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 40px 2rem 40px;
}

.glass-container {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2rem;
  width: 100%;
  max-width: 1200px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  text-align: center;
}

@media (max-width: 768px) {
  body {
    padding: 40px 40px 1rem 40px;
    align-items: flex-start;
  }

  .glass-container {
    padding: 1.5rem;
    border-radius: 12px;
    width: 100%;
  }

  .header-content {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

  .brand h1 {
    font-size: 1.75rem;
  }

  header p {
    margin-bottom: 1.5rem;
  }

  .user-profile {
    width: 100%;
    justify-content: center;
  }
}

header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, #818cf8, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

header p {
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

.player-controls {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.playback-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(1);
}

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  min-width: 120px;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* Equalizer Styles */

.eq-container {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.3s ease-in-out;
  max-height: 500px;
  overflow: hidden;
}

.eq-container.collapsed {
  max-height: 48px;
  padding-bottom: 0.5rem;
}

.eq-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.5rem;
}

.btn-small {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #a5b4fc;
  padding: 0.15rem 0.5rem;
  /* Tighter padding */
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-small:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
  color: white;
}

.btn-small.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: #6366f1;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

#eq-preset-select {
  background: #1e1b4b;
  /* Solid dark background */
  color: #a5b4fc;
  cursor: pointer;
  outline: none;
}

#eq-preset-select option {
  background: #1e1b4b;
  color: #f8fafc;
  padding: 8px;
}

#eq-preset-select:hover {
  border-color: rgba(99, 102, 241, 0.5);
  color: white;
}

#eq-sliders {
  display: flex;
  justify-content: space-between;
  height: 120px;
  padding: 0 0.5rem;
  transition: all 0.3s ease-in-out;
  overflow-x: auto;
  gap: 0.5rem;
}

.collapsed #eq-sliders {
  height: 0;
  opacity: 0;
  pointer-events: none;
  margin: 0;
  padding: 0;
}

#eq-toggle {
  transition: transform 0.3s ease;
}

.collapsed #eq-toggle {
  transform: rotate(-90deg);
}

.eq-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.eq-slider-container {
  flex: 1;
  display: flex;
  align-items: center;
  width: 100%;
}

.eq-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  transform: rotate(-90deg);
  border-radius: 2px;
}

.eq-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
  border: 2px solid white;
}

.eq-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.status-panel {
  background-color: rgba(0, 0, 0, 0.2);
  background-image: linear-gradient(to right, rgba(99, 102, 241, 0.4), rgba(99, 102, 241, 0.4));
  background-repeat: no-repeat;
  background-size: var(--progress, 0%) 100%;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 2rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  min-height: 4.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: background-size 0.3s ease;
  position: relative;
}

#status-message {
  color: #fbbf24;
  margin-bottom: 0.25rem;
}

#cancel-container {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.4);
  color: white;
  border-color: #ef4444;
}

#file-info {
  color: var(--text-muted);
}

.selector-container {
  width: 100%;
  height: 200px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

#selector-canvas {
  width: 100%;
  height: 100%;
  cursor: col-resize;
}

.visualizer-container {
  width: 100%;
  height: 250px;
  /* Increased further */
  background: rgba(0, 0, 0, 0.3);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

#visualizer {
  width: 100%;
  flex: 1;
}

#piano-keyboard {
  height: 150px;
  /* Much taller */
  width: 100%;
  display: flex;
  border-top: 1px solid var(--glass-border);
  position: relative;
}

.key {
  flex: 1;
  height: 100%;
  box-sizing: border-box;
  transition: background-color 0.1s ease;
}

.key.white {
  background: rgba(255, 255, 255, 0.9);
  border-right: 0.1px solid rgba(0, 0, 0, 0.1);
  z-index: 1;
}

.key.black {
  background: #1a1a1a;
  height: 60%;
  width: 0.8%;
  /* Narrower relative width */
  margin-left: -0.4%;
  margin-right: -0.4%;
  z-index: 2;
  border-radius: 0 0 2px 2px;
}

.key.white.active {
  background-color: #ff9800 !important;
  opacity: var(--active-opacity, 1);
  box-shadow: 0 0 10px rgba(255, 152, 0, 0.6);
  z-index: 10;
}

.key.black.active {
  background-color: #e65100 !important;
  box-shadow: 0 0 12px rgba(230, 81, 0, 0.8);
}

/* Animations */

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

.loading {
  animation: pulse 1.5s infinite ease-in-out;
}

/* Speed Controls */

.speed-controls-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.75rem;
  gap: 0.6rem;
}

.control-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6366f1;
  font-weight: 700;
  opacity: 0.8;
}

.speed-slider-wrapper {
  width: 100%;
  max-width: 300px;
  padding: 0 10px;
}

.speed-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  outline: none;
  transition: all 0.2s;
}

.speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
  transition: all 0.2s;
}

.speed-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  background: var(--primary-hover);
}

#speed-label {
  color: #fff;
  margin-left: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
}

#speed-ticks,
.speed-ticks {
  display: flex;
  position: relative;
  width: 100%;
  height: 8px;
  margin-top: 4px;
}

.speed-ticks .tick {
  position: absolute;
  width: 1px;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  transform: translateX(-50%);
}

.selector-controls {
  display: flex;
  align-items: center;
  gap: 13px;
  /* Slightly increased distance */
  margin-bottom: 0.75rem;
  justify-content: flex-start;
}

.view-toggle {
  display: flex;
  gap: 0.5rem;
}

/* Header & Branding */

header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand h1 {
  font-size: 2rem;
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}

.brand p {
  color: var(--text-base);
  font-size: 0.9rem;
  opacity: 0.8;
}

/* User Profile */

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-info {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.2s;
}

.user-trigger:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.user-info .avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.dropdown-arrow {
  font-size: 0.6rem;
  opacity: 0.5;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 200px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  padding: 8px;
  z-index: 1000;
  text-align: left;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  animation: dropdownSlide 0.2s ease-out;
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-header {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  font-size: 0.65rem;
  background: var(--primary);
  color: white;
  padding: 1px 6px;
  border-radius: 4px;
  width: fit-content;
}

.badge.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

.dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 4px 0;
}

.dropdown-item {
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 0.85rem;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.dropdown-item.logout:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

#user-name {
  font-size: 0.85rem;
  font-weight: 500;
}

.btn-tiny {
  padding: 2px 8px;
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.1);
}

.btn-tiny:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* Login Modal */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  width: 100%;
  max-width: 400px;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-content h2 {
  margin: 0;
  font-size: 1.5rem;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}

.btn-close:hover {
  color: white;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 8px;
  opacity: 0.8;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(0, 0, 0, 0.3);
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 30px;
}

.modal-actions .btn {
  flex: 1;
}

.auth-toggle {
  margin-top: 20px;
  font-size: 0.85rem;
  text-align: center;
  color: var(--text-muted);
}

.auth-toggle a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-toggle a:hover {
  text-decoration: underline;
}

/* Social Login */

.social-login-separator {
  margin: 24px 0;
  text-align: center;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-login-separator::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.social-login-separator span {
  background: #1e1b4b;
  /* Matches modal background */
  padding: 0 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  z-index: 1;
}

.social-login-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-social {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
}

.btn-social:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-google .icon {
  color: #ea4335;
}

.btn-github .icon {
  color: #f8fafc;
}

/* Utilities */

.hidden {
  display: none !important;
}

/* Alert Banners */

.alert-banner {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.alert-banner.warning {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.2);
}

.alert-banner.success {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.2);
}

.btn-tiny {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: none;
  cursor: pointer;
}

.btn-tiny:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Admin Modal Tab UI */

.admin-tabs {
  display: flex;
  gap: 1rem;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 1.5rem;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 0;
  cursor: pointer;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}