/* Design System Configuration */
:root {
  --font-primary: 'Inter', sans-serif;
  --font-brand: 'Outfit', sans-serif;
  
  /* Palette Colors */
  --bg-base: #0b0b14;
  --bg-card: rgba(22, 22, 38, 0.55);
  --border-card: rgba(255, 255, 255, 0.07);
  --border-card-hover: rgba(255, 255, 255, 0.15);
  
  --primary-glow: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --accent-purple: #a855f7;
  --accent-blue: #6366f1;
  --accent-pink: #ec4899;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Status Colors */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
}

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

body {
  font-family: var(--font-primary);
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Ambient Background Blurs */
.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  opacity: 0.15;
  pointer-events: none;
}

.glow-1 {
  width: 400px;
  height: 400px;
  background: var(--accent-purple);
  top: -100px;
  right: 5%;
}

.glow-2 {
  width: 500px;
  height: 500px;
  background: var(--accent-blue);
  bottom: 10%;
  left: -100px;
}

/* App Container */
.app-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 30px 20px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 15px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  background: var(--primary-glow);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 1.5rem;
  color: #fff;
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.3);
}

.brand-text h1 {
  font-family: var(--font-brand);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.sandbox-badge {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: #fbbf24;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(245, 158, 11, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

/* Tabs */
.tabs-container {
  margin-bottom: 25px;
}

.tabs-list {
  display: flex;
  gap: 8px;
  background: rgba(22, 22, 38, 0.4);
  border: 1px solid var(--border-card);
  padding: 5px;
  border-radius: 12px;
  width: max-content;
}

.tab-trigger {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-trigger:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.tab-trigger.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Tab Panels */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Card layout (Glassmorphism) */
.card {
  border-radius: 16px;
  padding: 30px;
}

.card-glass {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.card h2 {
  font-family: var(--font-brand);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.card-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 25px;
}

/* Workspace Grid */
.workspace-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 25px;
  align-items: start;
}

@media (max-width: 900px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

/* Buttons */
.btn {
  font-family: var(--font-primary);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background: var(--primary-glow);
  color: #fff;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.25);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.35);
}

.btn-primary:disabled {
  background: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-card-hover);
}

.btn-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 10px;
}

.btn-block {
  width: 100%;
  padding: 14px;
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea {
  width: 100%;
  background: rgba(10, 10, 15, 0.5);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  transition: all 0.25s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.15);
  background: rgba(10, 10, 15, 0.8);
}

/* Drag and Drop Zone */
.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(10, 10, 15, 0.3);
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-purple);
  background: rgba(168, 85, 247, 0.03);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.drop-icon {
  color: var(--accent-purple);
  margin-bottom: 12px;
}

.drop-text-primary {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.drop-text-secondary {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.browse-link {
  color: var(--accent-blue);
  text-decoration: underline;
}

.file-hidden {
  display: none;
}

.drop-zone-selected {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.success-icon {
  color: var(--success);
  margin-bottom: 12px;
}

.selected-file-name {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.change-file-btn {
  font-size: 0.8rem;
  color: var(--error);
  text-decoration: underline;
}

/* Destinations (Toggle switches) */
.destinations-group {
  margin-bottom: 30px;
}

.section-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.destination-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: rgba(10, 10, 15, 0.4);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  margin-bottom: 12px;
}

.dest-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.dest-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.youtube-color {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.spreaker-color {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.dest-info h4 {
  font-size: 0.95rem;
  font-weight: 500;
}

.dest-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Toggle Switch Styles */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s;
  border-radius: 34px;
  border: 1px solid var(--border-card);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--accent-purple);
}

input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

/* Console Panel */
.console-card {
  display: flex;
  flex-direction: column;
  height: 580px;
}

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

.status-indicator {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 6px;
}

#consoleStatus {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
}

#consoleStatus.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.console-progress-box {
  background: rgba(10, 10, 15, 0.5);
  border: 1px solid var(--border-card);
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 15px;
}

.progress-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

#progressText {
  color: var(--text-secondary);
}

#progressPercent {
  font-weight: 600;
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--primary-glow);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.console-output {
  flex-grow: 1;
  background: #06060c;
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 15px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  overflow-y: auto;
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-line {
  line-height: 1.4;
  animation: logFadeIn 0.2s ease;
}

@keyframes logFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.system-line { color: var(--text-muted); }
.info-line { color: var(--accent-blue); }
.success-line { color: var(--success); }
.error-line { color: var(--error); font-weight: 500; }

/* Backlog Import Grid */
.backlog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 25px;
}

.backlog-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(10, 10, 15, 0.4);
  border: 1px solid var(--border-card);
  padding: 12px 18px;
  border-radius: 12px;
  margin-bottom: 20px;
  animation: slideDown 0.3s ease;
}

.select-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select-info label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.count-badge {
  background: rgba(168, 85, 247, 0.15);
  color: var(--accent-purple);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  min-height: 200px;
}

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon {
  margin-bottom: 15px;
}

.empty-state h3 {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 1.1rem;
  margin-bottom: 5px;
}

/* Video Card Grid Item */
.video-card {
  background: rgba(10, 10, 15, 0.3);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.video-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-card-hover);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.video-card.selected {
  border-color: var(--accent-purple);
  background: rgba(168, 85, 247, 0.03);
}

.thumbnail-container {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  overflow: hidden;
}

.thumbnail-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.duration-tag {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.card-select-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
}

.card-select-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-purple);
}

.video-details {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
}

.video-title {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 5, 10, 0.8);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  background: #11111e;
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 20px 48px rgba(0,0,0,0.4);
  transform: translateY(15px);
  transition: transform 0.3s ease;
}

.modal-overlay.open .modal-card {
  transform: translateY(0);
}

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

.modal-header h2 {
  font-family: var(--font-brand);
  font-size: 1.4rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-primary);
}

.settings-section {
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.settings-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.settings-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.settings-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 12px;
}

.sandbox-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.auth-status-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(5,5,10,0.3);
  border: 1px solid var(--border-card);
  padding: 12px;
  border-radius: 10px;
}

.auth-status-box .status-indicator {
  font-size: 0.8rem;
}

.status-indicator.connected {
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
}

.status-indicator.disconnected {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.margin-top {
  margin-top: 15px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Login Overlay Styles */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(15, 23, 42, 0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.login-card {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 3rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: slideDown 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--secondary), transparent);
  opacity: 0.8;
}

.login-card .brand-logo {
  margin: 0 auto 1.5rem;
  width: 70px;
  height: 70px;
  font-size: 1.75rem;
  box-shadow: 0 0 30px var(--primary-glow);
}

.login-card h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #f8fafc;
}

.login-card p {
  color: #cbd5e1 !important;
}

.login-card label {
  color: #e2e8f0;
}

/* Login Input Adjustments */
.login-card input[type="text"],
.login-card input[type="password"] {
  background: rgba(15, 23, 42, 0.8) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  font-weight: 500;
}

.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-glow) !important;
}

/* Fix browser autofill styling */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #0f172a inset !important;
    -webkit-text-fill-color: #ffffff !important;
    transition: background-color 5000s ease-in-out 0s;
}
