/* ============================================
   ViralClips AI — Dashboard Styles
   Clean, Bright, Professional App Layout
   ============================================ */

/* ============ LAYOUT ============ */
.dashboard-body {
  background: var(--bg-secondary);
}

/* ============ TOPBAR ============ */
.dash-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: white;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  z-index: var(--z-sticky);
  box-shadow: var(--shadow-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.sidebar-toggle {
  width: 38px;
  height: 38px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
}

.topbar-logo .logo-icon {
  width: 34px;
  height: 34px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* Credits Display */
.credits-display {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
}

.credits-icon {
  font-size: 18px;
}

.credits-info {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.credits-count {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 800;
  color: var(--text-primary);
}

.credits-label {
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.credits-add {
  width: 28px;
  height: 28px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 8px rgba(255,107,107,0.3);
}

.credits-add:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(255,107,107,0.4);
}

/* User Dropdown */
.topbar-user {
  position: relative;
}

.user-avatar {
  width: 38px;
  height: 38px;
  background: var(--gradient-purple);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-avatar:hover {
  box-shadow: 0 0 0 3px rgba(124,58,237,0.2);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
  z-index: var(--z-dropdown);
}

.topbar-user.open .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  padding: var(--space-4) var(--space-4) var(--space-3);
}

.dropdown-name {
  display: block;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.dropdown-email {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: 0;
}

.dropdown-item {
  display: block;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.dropdown-logout {
  color: var(--error);
}

.dropdown-logout:hover {
  background: #fff5f5;
  color: var(--error);
}

/* ============ SIDEBAR ============ */
.sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  bottom: 0;
  width: 250px;
  background: white;
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-6) var(--space-4);
  z-index: var(--z-sticky);
  overflow-y: auto;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-xl);
  transition: all var(--transition-fast);
  text-decoration: none;
  position: relative;
}

.sidebar-link:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: linear-gradient(135deg, #fff5f5, #f3f0ff);
  color: var(--primary-600);
  font-weight: 700;
}

.sidebar-link.active svg {
  stroke: var(--primary-600);
}

.sidebar-badge {
  margin-left: auto;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 800;
  color: var(--success);
  background: var(--success-light);
  border-radius: var(--radius-full);
  letter-spacing: 0.03em;
}

/* Sidebar Promo */
.sidebar-promo {
  background: linear-gradient(135deg, #fff5f5, #f3f0ff);
  border: 1px solid rgba(124,58,237,0.1);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  text-align: center;
}

.promo-emoji {
  font-size: 1.8rem;
  margin-bottom: var(--space-2);
}

.promo-text {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.promo-btn {
  width: 100%;
  font-size: var(--text-xs) !important;
  padding: var(--space-2) var(--space-4) !important;
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 700;
  border-radius: var(--radius-lg);
}

/* ============ MAIN CONTENT ============ */
.dash-main {
  margin-left: 250px;
  padding: calc(64px + var(--space-8)) var(--space-8) var(--space-8);
  min-height: 100vh;
}

/* ============ WELCOME BANNER ============ */
.welcome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-2xl);
  padding: var(--space-6) var(--space-8);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
}

.welcome-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-primary);
}

.welcome-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.welcome-stats {
  display: flex;
  gap: var(--space-8);
}

.w-stat {
  text-align: center;
}

.w-stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 900;
  color: var(--text-primary);
}

.w-stat-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ============ SECTION HEADING ============ */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.section-heading h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text-primary);
}

.heading-badge {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--purple-500);
  background: var(--purple-50);
  border: 1px solid var(--purple-200);
  border-radius: var(--radius-full);
}

.heading-count {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  font-weight: 600;
}

/* ============ GENERATE FORM ============ */
.generate-section {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-2xl);
  padding: var(--space-6) var(--space-8);
  margin-bottom: var(--space-8);
  box-shadow: var(--shadow-card);
}

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-textarea {
  width: 100%;
  padding: var(--space-4);
  background: var(--bg-secondary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-xl);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-family: var(--font-primary);
  resize: vertical;
  min-height: 110px;
  transition: all var(--transition-base);
  line-height: 1.6;
}

.form-textarea:focus {
  border-color: var(--purple-500);
  box-shadow: 0 0 0 4px rgba(124,58,237,0.08);
  background: white;
  outline: none;
}

.form-textarea::placeholder {
  color: var(--text-tertiary);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-2);
  font-weight: 500;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

/* Select */
.select-wrapper {
  position: relative;
}

.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-10) var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-xl);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-primary);
  cursor: pointer;
  appearance: none;
  transition: all var(--transition-base);
}

.form-select:focus {
  border-color: var(--purple-500);
  box-shadow: 0 0 0 4px rgba(124,58,237,0.08);
  outline: none;
}

.select-chevron {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

/* Aspect Ratio Picker */
.ratio-group {
  display: flex;
  gap: var(--space-3);
}

.ratio-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-2);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-secondary);
  text-align: center;
}

.ratio-option input { display: none; }

.ratio-option:hover {
  border-color: var(--purple-300);
}

.ratio-option.active {
  border-color: var(--purple-500);
  background: var(--purple-50);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.08);
}

.ratio-preview {
  background: var(--text-tertiary);
  border-radius: 3px;
  opacity: 0.5;
}

.ratio-landscape { width: 36px; height: 22px; }
.ratio-portrait { width: 18px; height: 30px; }
.ratio-square { width: 26px; height: 26px; }

.ratio-option.active .ratio-preview {
  background: var(--purple-500);
  opacity: 1;
}

.ratio-option span {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-secondary);
}

.ratio-use {
  font-size: 10px !important;
  color: var(--text-tertiary) !important;
  font-weight: 600 !important;
}

.ratio-option.active span { color: var(--purple-600); }

/* Generate Button */
.form-actions {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-light);
}

.generate-btn {
  width: 100%;
  padding: var(--space-4) var(--space-6) !important;
  font-size: var(--text-base) !important;
}

.earn-btn {
  background: var(--gradient-purple) !important;
  box-shadow: var(--shadow-purple) !important;
}

/* ============ PROGRESS ============ */
.progress-section {
  margin-bottom: var(--space-8);
}

.progress-card {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  text-align: center;
  box-shadow: var(--shadow-card);
}

.progress-spinner {
  margin-bottom: var(--space-5);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-light);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

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

.progress-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.progress-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
}

.progress-bar-wrapper {
  width: 100%;
  max-width: 400px;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-3);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 30%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  animation: progress-indeterminate 2s ease-in-out infinite;
}

@keyframes progress-indeterminate {
  0% { width: 10%; margin-left: 0; }
  50% { width: 50%; margin-left: 25%; }
  100% { width: 10%; margin-left: 90%; }
}

.progress-status {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: 600;
}

/* ============ VIDEO GRID ============ */
.videos-section {
  margin-bottom: var(--space-8);
}

.empty-state {
  background: white;
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-2xl);
  padding: var(--space-16) var(--space-8);
  text-align: center;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-5);
}

.video-card {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-base);
}

.video-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-3px);
}

.video-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.video-play-overlay {
  width: 56px;
  height: 56px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition-base);
}

.video-play-overlay svg {
  margin-left: 3px;
}

.video-card:hover .video-play-overlay {
  opacity: 1;
}

.video-processing-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: white;
  font-size: var(--text-sm);
  font-weight: 700;
}

.mini-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.video-status-badge {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 800;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

.video-status-badge.complete {
  background: rgba(18,184,134,0.9);
  color: white;
}

.video-status-badge.processing {
  background: rgba(251,191,36,0.9);
  color: #1a1a2e;
}

.video-info {
  padding: var(--space-4) var(--space-5);
}

.video-prompt-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  font-style: italic;
  margin-bottom: var(--space-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.video-style-tag {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-primary);
}

.video-date {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: 500;
}

.video-actions {
  display: flex;
  gap: var(--space-2);
}

.video-download-btn {
  flex: 1;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .welcome-banner {
    flex-direction: column;
    text-align: center;
    gap: var(--space-5);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    z-index: var(--z-overlay);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  .sidebar-toggle { display: flex; }

  .dash-main {
    margin-left: 0;
    padding: calc(64px + var(--space-5)) var(--space-4) var(--space-5);
  }

  .generate-section {
    padding: var(--space-5);
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .welcome-stats {
    gap: var(--space-5);
  }
}

@media (max-width: 480px) {
  .ratio-group {
    gap: var(--space-2);
  }

  .credits-info { display: none; }
}
