/* YouTube Automator Premium Styling System */

:root {
  --bg-base: #0b0c10;
  --bg-surface: #151922;
  --bg-surface-glass: rgba(21, 25, 34, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(124, 58, 237, 0.3);

  --color-primary: #7c3aed; /* Royal Purple */
  --color-primary-glow: rgba(124, 58, 237, 0.5);
  --color-secondary: #06b6d4; /* Electric Cyan */
  --color-secondary-glow: rgba(6, 182, 212, 0.4);
  --color-success: #10b981; /* Emerald Green */
  --color-danger: #f43f5e; /* Rose Red */
  --color-warning: #f59e0b; /* Amber Yellow */

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #1f2937;

  --font-primary: 'Outfit', sans-serif;
  --border-radius-lg: 16px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  background: radial-gradient(circle at top right, rgba(124, 58, 237, 0.15), transparent 45%),
              radial-gradient(circle at bottom left, rgba(6, 182, 212, 0.1), transparent 40%);
  filter: blur(8px);
  pointer-events: none;
  transition: filter 0.5s ease;
}

.app-container.authenticated {
  filter: blur(0);
  pointer-events: all;
}

/* Authentication Overlay */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 12, 16, 0.85); /* Matches --bg-base */
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.auth-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 40px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-premium);
  text-align: center;
  max-width: 400px;
}

.auth-card h1 {
  font-size: 24px;
  margin-bottom: 10px;
  color: white;
}

.auth-card p {
  color: var(--text-muted);
  margin-bottom: 30px;
  line-height: 1.5;
}

.auth-card .btn {
  width: 100%;
}

/* Sidebar Panel */
.sidebar {
  width: 320px;
  background-color: var(--bg-surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-color);
  padding: 24px;
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
}

.logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  box-shadow: 0 8px 24px var(--color-primary-glow);
  animation: pulse-glow 3s infinite alternate;
}

.brand-details h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #d1d5db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.status-badge {
  font-size: 11px;
  color: var(--color-success);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-weight: 500;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-success);
  border-radius: 50%;
  display: inline-block;
  animation: status-pulse 1.5s infinite;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--border-radius-md);
  font-weight: 500;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
}

.nav-item i {
  font-size: 18px;
}

.nav-item:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  color: white;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(6, 182, 212, 0.05));
  border: 1px solid rgba(124, 58, 237, 0.3);
  box-shadow: inset 0 0 12px rgba(124, 58, 237, 0.1);
}

.credentials-panel {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  margin-top: 24px;
}

.credentials-panel h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.input-group.flex-row {
  flex-direction: row;
  gap: 10px;
}

.input-group.flex-row input {
  flex: 1;
  margin-bottom: 0;
}

.input-group label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group input {
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  color: white;
  font-size: 13px;
  transition: var(--transition-smooth);
}

.input-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.25);
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  height: 100vh;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 24px;
}

.header-title h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.header-title p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 800px;
  line-height: 1.5;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-profile i {
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.user-profile i:hover {
  color: white;
}

.avatar {
  width: 40px;
  height: 40px;
  background-color: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Dynamic Panels Layout */
.panel-container {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
}

/* Cards general design */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-premium);
  display: flex;
  flex-direction: column;
}

.card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
}

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

.card-header-actions h3 {
  margin-bottom: 0;
}

/* Source Selection Card */
.source-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.source-btn {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-align: left;
  color: var(--text-muted);
}

.source-btn i {
  font-size: 28px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #ffffff, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.source-btn span {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: white;
  margin-bottom: 4px;
}

.source-btn p {
  font-size: 12px;
}

.source-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.04);
}

.source-btn.active {
  border-color: var(--color-secondary);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(6, 182, 212, 0.02));
  box-shadow: inset 0 0 12px rgba(6, 182, 212, 0.1);
}

.source-btn.active i {
  background: linear-gradient(135deg, var(--color-secondary), #ffffff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Drag & Drop Dropzone */
.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius-md);
  padding: 40px 20px;
  text-align: center;
  background-color: rgba(0, 0, 0, 0.15);
  transition: var(--transition-smooth);
  cursor: pointer;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--color-primary);
  background-color: rgba(124, 58, 237, 0.03);
}

.dropzone-icon {
  font-size: 48px;
  color: var(--color-primary);
  margin-bottom: 16px;
  opacity: 0.8;
}

.dropzone h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.dropzone p {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.dropzone-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* Google Drive Explorer zone */
.drive-explorer {
  height: 200px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  background-color: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
}

.explorer-empty {
  text-align: center;
  color: var(--text-muted);
}

.explorer-empty i {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Buttons systems */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background-color: #6d28d9;
  box-shadow: 0 0 12px var(--color-primary-glow);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.05);
  color: white;
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.btn-success {
  background-color: var(--color-success);
  color: white;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background-color: #059669;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.45);
}

.btn-danger {
  background-color: var(--color-danger);
  color: white;
}

.btn-danger:hover {
  background-color: #e11d48;
}

.btn-outline {
  background-color: transparent;
  color: var(--text-muted);
  border-color: var(--border-color);
}

.btn-outline:hover {
  color: white;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: var(--border-radius-md);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Queue Card styling */
.queue-container {
  flex: 1;
  min-height: 180px;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  background-color: rgba(0, 0, 0, 0.1);
  padding: 16px;
  margin-bottom: 20px;
}

.queue-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 12px;
}

.queue-empty i {
  font-size: 32px;
  opacity: 0.4;
}

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  transition: var(--transition-smooth);
}

.queue-item:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.item-details {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.item-details i {
  font-size: 18px;
  color: var(--color-secondary);
}

.item-name {
  font-size: 13px;
  font-weight: 600;
  max-width: 500px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-size {
  font-size: 11px;
  color: var(--text-muted);
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.item-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.item-status.pending {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
}

.item-status.uploading {
  background-color: rgba(6, 182, 212, 0.15);
  color: var(--color-secondary);
  animation: pulse 1s infinite alternate;
}

.item-status.success {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--color-success);
}

.btn-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-remove:hover {
  color: var(--color-danger);
}

/* Execution Area */
.execution-panel {
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 18px;
}

.execution-progress {
  margin-bottom: 16px;
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.progress-track {
  height: 8px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(to right, var(--color-primary), var(--color-secondary));
  border-radius: 4px;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px var(--color-primary-glow);
}

.execution-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Real-time Console / Terminal Card */
.terminal-card {
  flex: 1;
  min-height: 200px;
}

.terminal-body {
  background-color: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 16px;
  height: 150px;
  overflow-y: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.6;
}

.log-line {
  margin-bottom: 6px;
  display: flex;
  gap: 8px;
}

.log-line .timestamp {
  color: var(--text-muted);
}

.log-line.system {
  color: var(--color-secondary);
}

.log-line.info {
  color: var(--text-main);
}

.log-line.success {
  color: var(--color-success);
}

.log-line.error {
  color: var(--color-danger);
}

/* Utility Helpers */
.hidden {
  display: none !important;
}

/* Keyframes Animations */
@keyframes pulse-glow {
  0% {
    box-shadow: 0 8px 24px var(--color-primary-glow);
  }
  100% {
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.8), 0 0 12px var(--color-secondary-glow);
  }
}

@keyframes status-pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.05);
    opacity: 1;
  }
}

@keyframes pulse {
  0% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}

/* Unified Tabs & Bulk Updater Visual System */
.tab-content {
  display: block;
  transition: var(--transition-smooth);
}

.tab-content.hidden {
  display: none !important;
}

.card-desc {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 30px;
  line-height: 1.6;
}

.bulk-trigger-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  background-color: rgba(0, 0, 0, 0.15);
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius-md);
  gap: 24px;
  margin-bottom: 24px;
}

.bulk-icon-glow {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: white;
  box-shadow: 0 0 30px var(--color-primary-glow);
  animation: status-pulse 2s infinite alternate;
}

.bulk-progress {
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
}

/* Playlist Grid & Manager Dashboard System */
.playlists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  min-height: 200px;
  margin-top: 16px;
}

.playlists-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 12px;
  padding: 40px;
}

.playlists-empty i {
  font-size: 36px;
  opacity: 0.4;
}

.playlist-item-card {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition-smooth);
}

.playlist-item-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.playlist-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.playlist-card-header h4 {
  font-size: 15px;
  font-weight: 600;
  color: white;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  height: 36px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.playlist-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

/* Premium Dropdown Selector Styling */
select.premium-select {
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  color: white;
  font-size: 13px;
  transition: var(--transition-smooth);
  width: 100%;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}

select.premium-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.25);
}

select.premium-select option {
  background-color: var(--bg-surface);
  color: white;
  padding: 10px;
}

/* Google Drive Explorer List Styling */
.drive-explorer.has-files {
  display: block;
  overflow-y: auto;
  padding: 8px 12px;
}

.drive-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.drive-file-item:last-child {
  border-bottom: none;
}

.drive-file-item .file-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex: 1;
}

.drive-file-item input[type="checkbox"] {
  accent-color: var(--color-primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.drive-file-item .file-name {
  color: white;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 500px;
}

.drive-file-item .file-size {
  color: var(--text-muted);
  font-size: 11px;
}
