:root {
  --bg-dark: #080c14;
  --bg-sidebar: #0f172a;
  --card-bg: rgba(15, 23, 42, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(99, 102, 241, 0.4);
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.2);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background Glows */
.background-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

.glow-1 {
  top: -200px;
  left: 20%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
}

.glow-2 {
  bottom: -200px;
  right: 10%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
}

/* App Layout */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 16px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.brand-text h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 1px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  text-align: left;
}

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

.nav-item.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #fff;
  box-shadow: 0 8px 20px var(--primary-glow);
}

.nav-badge {
  margin-left: auto;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.storage-card {
  background: rgba(16, 185, 129, 0.05);
  border: 1px dashed rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
}

.storage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.storage-tag {
  color: var(--emerald);
}

#sidebar-gdrive-status {
  font-size: 0.8rem;
  color: #f87171;
  margin-bottom: 8px;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 28px 36px;
  overflow-y: auto;
}

/* Top Navbar Header */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

#page-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
}

.top-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill-badge {
  font-size: 0.75rem;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 600;
}

.badge-free {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-models {
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.gdrive-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 4px 6px 4px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
}

/* Views */
.view-panel {
  display: none;
}

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

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .grid-2col {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.card-glass {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.card-step-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
}

h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
}

/* Tabs Segmented */
.tabs-segmented {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 18px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
}

.tab-content {
  display: none;
}

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

/* Forms & Inputs */
.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #cbd5e1;
}

.input-styled {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(8, 12, 20, 0.8);
  border: 1px solid var(--border-color);
  color: #fff;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

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

.input-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 36px 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: all 0.2s ease;
}

.drop-zone:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.drop-zone-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.drop-title {
  font-weight: 600;
  font-size: 0.95rem;
}

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

/* Buttons */
.btn {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px var(--primary-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid var(--border-color);
}

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

.btn-gdrive {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
}

.btn-gdrive:hover {
  box-shadow: 0 8px 20px var(--emerald-glow);
}

.btn-hero {
  width: 100%;
  padding: 16px;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

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

.btn-xs {
  padding: 4px 8px;
  font-size: 0.7rem;
  border-radius: 6px;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--emerald);
  color: var(--emerald);
}

/* Status Card & Terminal */
.status-box {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  margin-bottom: 18px;
}

.status-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  margin-bottom: 4px;
}

.status-dot {
  color: #94a3b8;
}

.status-running .status-dot {
  color: #f59e0b;
  animation: pulse 1.5s infinite;
}

.status-success .status-dot {
  color: var(--emerald);
}

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

.steps-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.step-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.step-num {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
}

.step-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border-color: var(--primary);
}

.step-item.done {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: var(--emerald);
}

/* Terminal */
.terminal-box {
  border-radius: var(--radius-md);
  background: #050811;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.terminal-bar {
  background: #0f172a;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.mac-dots {
  display: flex;
  gap: 6px;
}

.mac-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.terminal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.terminal-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #cbd5e1;
}

.watchdog-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
}

.terminal-viewport {
  padding: 16px;
  height: 480px;
  overflow-y: auto;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.82rem;
  line-height: 1.7;
}

.log-line {
  word-break: break-word;
}

.log-line.log-info { color: #38bdf8; }
.log-line.log-success { color: #4ade80; font-weight: 600; }
.log-line.log-warn { color: #fbbf24; }
.log-line.log-error { color: #f87171; font-weight: 600; }
.log-line.log-ai { color: #c084fc; }
.log-line.log-system { color: #a3e635; }

/* Videos Gallery Grid */
.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gallery-search {
  width: 320px;
}

.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.video-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.2s ease;
}

.video-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.video-thumb {
  height: 170px;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.video-thumb::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(8, 12, 20, 0.2) 0%, rgba(8, 12, 20, 0.75) 100%);
  z-index: 1;
}

.play-icon-overlay {
  font-size: 2.6rem;
  color: #fff;
  z-index: 2;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.video-card:hover .play-icon-overlay {
  transform: scale(1.15);
}

.video-body {
  padding: 16px;
}

.video-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.empty-gallery {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-color);
}

.empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
}

/* Modal Window */
.keys-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.keys-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.key-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.key-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #a5b4fc;
}

.modal-card-sm {
  max-width: 460px;
  border-radius: var(--radius-lg);
  background: #0f172a;
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
  animation: modalSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(15px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-status-icon {
  font-size: 1.4rem;
}

.modal-message-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #cbd5e1;
}

.btn-full {
  width: 100%;
}

.margin-top-sm { margin-top: 6px; }

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.active {
  display: flex;
}

.modal-card {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 800px;
  padding: 24px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
}

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

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
}

.modal-iframe {
  width: 100%;
  height: 450px;
  border: none;
  border-radius: var(--radius-md);
}

.margin-top { margin-top: 16px; }
.max-width-600 { max-width: 600px; }
.hidden { display: none !important; }
