/* =========================================================================
   Vidio Átjátszó — Dashboard Stíluslap
   Premium sötét téma, glassmorphism, micro-animációk
   ========================================================================= */

:root {
  --bg-base: #0a0a0f;
  --bg-gradient: radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
                 radial-gradient(ellipse at 80% 20%, rgba(6, 182, 212, 0.06) 0%, transparent 50%);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-hover: rgba(255, 255, 255, 0.06);
  --accent-gradient: linear-gradient(135deg, #7c3aed, #06b6d4);
  --accent-purple: #7c3aed;
  --accent-cyan: #06b6d4;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --input-bg: rgba(255, 255, 255, 0.05);
  --input-border: rgba(255, 255, 255, 0.1);
  --input-focus: rgba(124, 58, 237, 0.4);
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #eab308;
  --info: #3b82f6;
  --orange: #f97316;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.15);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--bg-gradient);
  z-index: -1;
  pointer-events: none;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* =========================================================================
   Bejelentkezés
   ========================================================================= */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 48px 36px;
  text-align: center;
  animation: fadeSlideUp 0.6s ease-out;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
}

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
}

/* =========================================================================
   Glass Card
   ========================================================================= */

.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-glow);
}

/* =========================================================================
   Logo & Fejléc
   ========================================================================= */

.logo-text {
  font-size: 28px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.8);
}

.header-left .logo-text {
  font-size: 20px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}

/* =========================================================================
   Tab navigáció
   ========================================================================= */

.tab-nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--glass-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

.tab-btn {
  padding: 8px 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

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

.tab-btn.active {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.3);
}

.tab-content {
  display: none;
  padding: 32px;
  animation: fadeIn 0.3s ease-out;
}

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

/* =========================================================================
   Stat kártyák
   ========================================================================= */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  padding: 24px;
  text-align: center;
  animation: fadeSlideUp 0.5s ease-out both;
}

.stat-card:nth-child(1) { animation-delay: 0.0s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.2s; }
.stat-card:nth-child(4) { animation-delay: 0.3s; }

.stat-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

/* =========================================================================
   Section kártyák
   ========================================================================= */

.section-card {
  padding: 28px;
  margin-bottom: 20px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

/* =========================================================================
   Űrlap elemek
   ========================================================================= */

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--input-focus);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-row .form-input {
  min-width: 160px;
}

.flex-grow {
  flex: 1;
}

/* =========================================================================
   Gombok
   ========================================================================= */

.btn {
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}

.btn-ghost:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

/* =========================================================================
   Táblázatok
   ========================================================================= */

.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--glass-border);
}

.data-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.data-table .url-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 13px;
}

/* =========================================================================
   Toggle switch
   ========================================================================= */

.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

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

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

/* =========================================================================
   Felhasználó kártyák
   ========================================================================= */

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

.user-card {
  padding: 24px;
  animation: fadeSlideUp 0.4s ease-out both;
}

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

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  color: white;
}

.user-name {
  font-weight: 600;
  font-size: 15px;
}

.rank-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rank-admin {
  background: rgba(124, 58, 237, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(124, 58, 237, 0.3);
}

.rank-user {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.token-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px 12px;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
}

.token-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-copy {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
  background: var(--glass-bg);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-copy:hover {
  color: var(--text-primary);
  border-color: var(--accent-purple);
}

.sources-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.source-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--input-bg);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.source-check:hover {
  border-color: var(--glass-border);
}

.source-check input[type="checkbox"] {
  accent-color: var(--accent-purple);
}

.source-check.checked {
  background: rgba(124, 58, 237, 0.1);
  color: var(--text-primary);
  border-color: rgba(124, 58, 237, 0.2);
}

/* =========================================================================
   Letöltés kártyák & Progress bar
   ========================================================================= */

.downloads-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.download-card {
  padding: 20px 24px;
  animation: fadeSlideUp 0.4s ease-out both;
}

.download-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.download-title {
  font-weight: 600;
  font-size: 15px;
}

.download-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.progress-container {
  margin: 12px 0;
}

.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease, background 0.3s ease;
  position: relative;
}

.progress-fill.status-downloading {
  background: var(--warning);
}

.progress-fill.status-completed {
  background: var(--warning);
}

.progress-fill.status-converting {
  background: var(--orange);
  animation: pulse-glow 1.5s ease-in-out infinite;
}

.progress-fill.status-uploading {
  background: var(--success);
  animation: pulse-glow 1.5s ease-in-out infinite;
}

.progress-fill.status-uploaded {
  background: var(--accent-cyan);
}

.progress-fill.status-failed {
  background: var(--danger);
}

.progress-fill.status-paused {
  background: var(--orange);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.progress-pct {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-downloading {
  background: rgba(234, 179, 8, 0.12);
  color: var(--warning);
  border: 1px solid rgba(234, 179, 8, 0.25);
}

.badge-completed {
  background: rgba(234, 179, 8, 0.12);
  color: var(--warning);
  border: 1px solid rgba(234, 179, 8, 0.25);
}

.badge-converting {
  background: rgba(249, 115, 22, 0.12);
  color: var(--orange);
  border: 1px solid rgba(249, 115, 22, 0.25);
}

.badge-uploading {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.badge-uploaded {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.badge-failed {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-paused,
.badge-waiting_upload {
  background: rgba(249, 115, 22, 0.1);
  color: var(--orange);
  border: 1px solid rgba(249, 115, 22, 0.2);
}

/* =========================================================================
   Aktivitás lista
   ========================================================================= */

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.activity-item .activity-title {
  flex: 1;
  font-size: 14px;
}

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

/* =========================================================================
   Toast
   ========================================================================= */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(20px);
  animation: toastIn 0.3s ease-out;
  min-width: 260px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.toast-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--success);
}

.toast-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.toast-info {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--info);
}

/* =========================================================================
   Segéd
   ========================================================================= */

.muted { color: var(--text-muted); font-size: 14px; }
.hidden { display: none !important; }

/* =========================================================================
   Animációk
   ========================================================================= */

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

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

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* =========================================================================
   Reszponzív
   ========================================================================= */

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
  }

  .tab-nav {
    width: 100%;
    overflow-x: auto;
  }

  .tab-content {
    padding: 16px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    flex-direction: column;
  }

  .form-row .form-input { min-width: 100%; }

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

  .header-left .logo-text { font-size: 16px; }
}

/* =========================================================================
   Modal overlay (jelszóváltoztatás)
   ========================================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

/* =========================================================================
   Manifest URL gomb
   ========================================================================= */

.btn-manifest {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.btn-manifest:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.5);
}
