/* CloudStream - Twitch-Inspired Modern UI */

:root {
  --primary: #9147ff;
  --primary-dark: #772ce8;
  --bg-dark: #0e0e10;
  --bg-secondary: #18181b;
  --bg-tertiary: #1f1f23;
  --text-primary: #efeff1;
  --text-secondary: #adadb8;
  --accent: #00f5d4;
  --border: #2d2d35;
  --success: #00f593;
  --error: #ff4444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navbar */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
}

.tagline {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.creator {
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 600;
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  flex: 1;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem 0;
  margin-bottom: 2rem;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

/* Loading */
.loading {
  text-align: center;
  padding: 4rem 0;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--bg-tertiary);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Video Grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.video-card {
  background: var(--bg-secondary);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  border: 1px solid var(--border);
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(145, 71, 255, 0.3);
  border-color: var(--primary);
}

.video-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--bg-tertiary);
}

.video-card-info {
  padding: 1rem;
}

.video-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.video-card-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Watch Page */
.watch-container {
  max-width: 1200px;
}

.video-content {
  margin-top: 2rem;
}

.video-player {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-tertiary);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.video-info {
  margin-bottom: 2rem;
}

.video-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.video-description {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Comments Section */
.comments-section {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 2rem;
  border: 1px solid var(--border);
}

.comments-title {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.comment-form input,
.comment-form textarea {
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.comment-form textarea {
  resize: vertical;
  min-height: 80px;
}

.comment-form button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  align-self: flex-start;
}

.comment-form button:hover {
  background: var(--primary-dark);
}

.comment-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.comments-loading {
  text-align: center;
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--text-secondary);
}

.spinner-small {
  width: 20px;
  height: 20px;
  border: 2px solid var(--bg-tertiary);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comment {
  background: var(--bg-tertiary);
  border-radius: 6px;
  padding: 1rem;
  border: 1px solid var(--border);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.comment-username {
  font-weight: 600;
  color: var(--accent);
}

.comment-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.comment-content {
  color: var(--text-primary);
  line-height: 1.5;
}

/* Footer */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
  margin-top: auto;
}

/* AI Widget */
.ai-widget {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
}

.ai-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(145, 71, 255, 0.4);
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-toggle:hover {
  transform: scale(1.1);
}

.ai-panel {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 350px;
  height: 500px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-panel.hidden {
  display: none;
}

.ai-header {
  background: var(--bg-tertiary);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.ai-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.ai-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.ai-close:hover {
  background: var(--bg-dark);
}

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ai-message {
  padding: 0.75rem;
  border-radius: 8px;
  max-width: 85%;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-message-user {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  margin-left: auto;
}

.ai-message-bot {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.ai-message p {
  margin: 0;
  line-height: 1.5;
}

.ai-form {
  padding: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
}

.ai-form input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.ai-form input:focus {
  outline: none;
  border-color: var(--primary);
}

.ai-form button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.ai-form button:hover {
  background: var(--primary-dark);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-container {
    padding: 0 1rem;
  }

  .hero-title {
    font-size: 1.8rem;
  }

  .video-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .container {
    padding: 1rem;
  }

  .comments-section {
    padding: 1rem;
  }

  .ai-panel {
    width: calc(100vw - 2rem);
    right: 1rem;
    left: 1rem;
  }

  .ai-widget {
    right: 1rem;
    bottom: 1rem;
  }
}

@media (max-width: 480px) {
  .logo {
    font-size: 1.4rem;
  }

  .tagline {
    display: none;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .video-title {
    font-size: 1.4rem;
  }
}
