/* ============================================
   PPL Platform — The Neon Nocturne
   Custom styles beyond Tailwind CSS
   ============================================ */

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
  --ppl-bg: #0c0c1d;
  --ppl-primary: #ff8aa5;
  --ppl-primary-dim: #e40a65;
  --ppl-primary-container: #ff7195;
  --ppl-tertiary: #ff68a7;
  --ppl-tertiary-container: #fc0d90;
  --ppl-secondary: #e8d1ff;
  --ppl-surface: #0c0c1d;
  --ppl-surface-low: #000000;
  --ppl-surface-mid: #18182b;
  --ppl-surface-high: #24233b;
  --ppl-text: #ffffff;
  --ppl-text-muted: #aba9bf;
  --ppl-border: #474659;
  --ppl-ghost-border: rgba(71, 70, 89, 0.15);
  --ppl-neon-shadow: rgba(255, 45, 120, 0.08);
  --ppl-glow: rgba(255, 113, 149, 0.3);
  --ppl-glass-bg: rgba(255, 255, 255, 0.05);
  --ppl-glass-blur: blur(20px);
}

/* --- Base --- */
html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--ppl-bg);
  color: var(--ppl-text-muted);
  overflow-x: hidden;
}

/* --- Scrollbar (Webkit) --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--ppl-surface-low);
}

::-webkit-scrollbar-thumb {
  background: var(--ppl-surface-high);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ppl-border);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--ppl-surface-high) var(--ppl-surface-low);
}

/* --- Glassmorphism --- */
.glass {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: var(--ppl-glass-blur);
  -webkit-backdrop-filter: var(--ppl-glass-blur);
  border: 1px solid var(--ppl-ghost-border);
  border-radius: 1.5rem;
}

/* Interactive glass card — more transparent + hover lift */
.glass-hover {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: var(--ppl-glass-blur);
  -webkit-backdrop-filter: var(--ppl-glass-blur);
  border: 1px solid var(--ppl-ghost-border);
  border-radius: 1.5rem;
  transition: transform 0.25s ease-out, background 0.25s ease-out, box-shadow 0.25s ease-out;
  cursor: default;
}

.glass-hover:hover {
  transform: translateY(-6px);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 8px 40px rgba(255, 45, 120, 0.08);
}

.glass-sm {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--ppl-ghost-border);
  border-radius: 1rem;
}

/* --- Neon Buttons --- */
.btn-neon {
  background: var(--ppl-primary-dim);
  color: #ffffff;
  font-weight: 600;
  padding: 0.75rem 2rem;
  border-radius: 9999px;
  box-shadow: 0 0 20px var(--ppl-glow);
  transition: all 0.2s ease-out;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  border: none;
  text-decoration: none;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.875rem;
}

.btn-neon:hover {
  box-shadow: 0 0 30px rgba(255, 113, 149, 0.5);
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn-neon:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

.btn-neon:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  filter: none;
  box-shadow: none;
}

/* Secondary button — ghost style */
.btn-ghost {
  background: transparent;
  color: var(--ppl-primary);
  font-weight: 500;
  padding: 0.75rem 2rem;
  border-radius: 9999px;
  border: 1px solid var(--ppl-ghost-border);
  transition: all 0.2s ease-out;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.875rem;
  text-decoration: none;
}

.btn-ghost:hover {
  background: rgba(255, 138, 165, 0.08);
  border-color: rgba(255, 138, 165, 0.3);
}

.btn-ghost:active {
  background: rgba(255, 138, 165, 0.12);
}

/* --- Background Orbs (atmospheric depth) --- */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

.orb-pink {
  background: radial-gradient(circle, rgba(252, 13, 144, 0.15), transparent 70%);
  width: 400px;
  height: 400px;
}

.orb-purple {
  background: radial-gradient(circle, rgba(232, 209, 255, 0.08), transparent 70%);
  width: 350px;
  height: 350px;
}

/* --- Toast Notifications --- */
.toast {
  padding: 0.875rem 1.25rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 280px;
  max-width: 420px;
  animation: toast-in 0.25s ease-out;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.toast-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.toast-info {
  background: rgba(255, 138, 165, 0.12);
  border: 1px solid rgba(255, 138, 165, 0.2);
}

.toast-exit {
  animation: toast-out 0.2s ease-in forwards;
}

/* --- Skeleton Loader --- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--ppl-surface-mid) 25%,
    var(--ppl-surface-high) 50%,
    var(--ppl-surface-mid) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: 0.75rem;
}

.skeleton-text {
  height: 0.875rem;
  margin-bottom: 0.5rem;
  border-radius: 0.375rem;
}

.skeleton-title {
  height: 1.5rem;
  width: 60%;
  margin-bottom: 0.75rem;
  border-radius: 0.375rem;
}

.skeleton-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
}

.skeleton-card {
  height: 200px;
  border-radius: 1.5rem;
}

/* --- Spinner --- */
.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--ppl-surface-high);
  border-top-color: var(--ppl-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

/* --- Confirm Dialog --- */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fade-in 0.15s ease-out;
}

.dialog-box {
  background: var(--ppl-surface-mid);
  border: 1px solid var(--ppl-ghost-border);
  border-radius: 1.5rem;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  animation: dialog-enter 0.2s ease-out;
}

/* --- Form Inputs --- */
.input-field {
  background: var(--ppl-surface-low);
  color: var(--ppl-text);
  border: 1px solid var(--ppl-ghost-border);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.875rem;
  width: 100%;
  min-height: 44px;
  transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
  outline: none;
}

.input-field::placeholder {
  color: rgba(171, 169, 191, 0.5);
}

.input-field:focus {
  border-color: rgba(255, 138, 165, 0.4);
  box-shadow: 0 0 0 3px rgba(228, 10, 101, 0.1);
}

.input-field:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.input-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ppl-text-muted);
  margin-bottom: 0.375rem;
}

.input-error {
  font-size: 0.75rem;
  color: #ef4444;
  margin-top: 0.25rem;
}

/* --- Progress Bar --- */
.progress-track {
  height: 4px;
  background: rgba(36, 35, 59, 0.4);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ppl-primary), var(--ppl-tertiary));
  border-radius: 999px;
  transition: width 0.3s ease-out;
}

/* --- Status Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-live {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.badge-live::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #ef4444;
  border-radius: 50%;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.badge-scheduled {
  background: rgba(96, 165, 250, 0.15);
  color: #93bbfd;
}

.badge-ended {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
}

/* --- Animations --- */
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialog-enter {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* --- Focus Visible (Accessibility) --- */
:focus-visible {
  outline: 2px solid var(--ppl-primary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Utility Classes --- */
.text-gradient {
  background: linear-gradient(135deg, var(--ppl-primary), var(--ppl-tertiary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glow-cta {
  box-shadow: 0 0 40px rgba(252, 13, 144, 0.4);
}

.neon-shadow {
  box-shadow: 0 4px 40px var(--ppl-neon-shadow);
}
