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

:root {
  /* Colors */
  --bg-dark: #070a13;
  --bg-card: rgba(15, 22, 42, 0.65);
  --bg-input: rgba(30, 41, 59, 0.5);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(59, 130, 246, 0.5);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --accent-color: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --gradient-accent: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #d946ef 100%);
  --gradient-text: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
  
  --color-success: #10b981;
  --color-error: #f43f5e;
  
  /* Fonts */
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Layout */
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --max-width: 1100px;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Background Gradients & Glows */
body::before {
  content: '';
  position: absolute;
  top: -10%;
  left: 10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

body::after {
  content: '';
  position: absolute;
  bottom: -10%;
  right: 10%;
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, rgba(217, 70, 239, 0.1) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-title);
  font-weight: 600;
  letter-spacing: -0.02em;
}

p {
  line-height: 1.6;
  color: var(--text-muted);
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: var(--transition-smooth);
}

a:hover {
  filter: brightness(1.2);
}

/* Container */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 3rem;
}

.logo-container {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.logo-icon {
  background: var(--gradient-accent);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.logo-icon svg {
  fill: #fff;
  width: 24px;
  height: 24px;
}

.logo-text {
  font-family: var(--font-title);
  font-size: 2.25rem;
  font-weight: 700;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

header p {
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Card / Glassmorphism Panel */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Generator Form */
.input-group {
  margin-bottom: 2rem;
}

.input-label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 500;
  color: var(--text-main);
  font-size: 0.95rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  gap: 0.75rem;
}

.input-field {
  flex-grow: 1;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition-smooth);
}

.input-field:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-field::placeholder {
  color: var(--text-dim);
}

.btn {
  background: var(--gradient-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 1rem 2rem;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
  filter: brightness(1.1);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  box-shadow: none;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-muted);
  box-shadow: none;
  transform: translateY(-1px);
}

/* Results Section */
.results-container {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.result-box {
  margin-bottom: 1.5rem;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.result-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.copy-btn {
  background: transparent;
  border: none;
  color: var(--accent-color);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}

.copy-btn:hover {
  background: rgba(59, 130, 246, 0.1);
}

.copy-btn.copied {
  color: var(--color-success);
}

.result-content {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: monospace;
  font-size: 0.9rem;
  word-break: break-all;
  position: relative;
  max-height: 120px;
  overflow-y: auto;
}

/* Accordion / Live Preview */
.preview-accordion {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 2rem;
  overflow: hidden;
}

.accordion-header {
  background: rgba(255, 255, 255, 0.02);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: var(--transition-smooth);
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.accordion-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.accordion-icon {
  transition: var(--transition-smooth);
}

.preview-accordion.open .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  display: none;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-color);
  justify-content: center;
}

.preview-accordion.open .accordion-content {
  display: flex;
}

/* Video Player Box */
.player-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  background: #000;
  border: 1px solid var(--border-color);
}

.player-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Player Page Styles */
.player-page-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 1.5rem;
  flex-grow: 1;
  transition: var(--transition-smooth);
}

.player-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  transition: var(--transition-smooth);
}

.player-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  color: var(--text-muted);
}

.player-header-title strong {
  color: var(--text-main);
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.player-actions {
  display: flex;
  gap: 0.75rem;
}

/* Ambient glow backdrop behind player */
.ambient-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  height: 45%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, rgba(217, 70, 239, 0.08) 50%, transparent 80%);
  z-index: -2;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.8;
  transition: var(--transition-smooth);
}

.player-container {
  width: 100%;
  position: relative;
  transition: var(--transition-smooth);
  margin-bottom: 2rem;
}

.player-container.theatre-mode {
  max-width: 100% !important;
  padding: 0;
}

/* Theatre Mode transitions */
body.theatre-active {
  padding: 0;
}

body.theatre-active .container {
  max-width: 100%;
  padding: 0;
}

body.theatre-active .player-page-container {
  max-width: 100%;
  padding: 0;
  height: 100vh;
  justify-content: flex-start;
}

body.theatre-active .player-header {
  padding: 1rem 2rem;
  background: rgba(7, 10, 19, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  z-index: 10;
}

body.theatre-active .player-container {
  flex-grow: 1;
  margin-bottom: 0;
}

body.theatre-active .player-wrapper {
  aspect-ratio: auto;
  width: 100%;
  height: calc(100vh - 69px);
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border-color);
}

body.theatre-active .ambient-glow {
  display: none;
}

/* Error card styling */
.error-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 500px;
  width: 100%;
  padding: 3rem 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.error-icon {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.error-icon svg {
  stroke: var(--color-error);
  width: 32px;
  height: 32px;
}

.error-card h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.error-card p {
  margin-bottom: 2rem;
  color: var(--text-muted);
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 0;
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  color: var(--text-dim);
  font-size: 0.85rem;
}

footer p {
  font-size: 0.85rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
  .logo-text {
    font-size: 1.75rem;
  }
  
  .glass-panel {
    padding: 1.5rem;
  }
  
  .input-wrapper {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
  }
  
  .player-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .player-actions {
    width: 100%;
  }
  
  .player-actions .btn {
    flex: 1;
  }
}

/* Clean Viewport Player Layout */
body.clean-player-body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.clean-player-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  background-color: #000;
  overflow: hidden;
}

.clean-player-container iframe {
  width: 100%;
  height: 100%;
  border: 0;
  margin: 0;
  padding: 0;
  display: block;
}

body.clean-player-body .error-card {
  position: relative;
  z-index: 10;
  margin: 1.5rem;
}
