:root {
  --bg-primary: #f8f9fc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f2f7;
  --bg-card: #ffffff;
  --bg-hover: #eef0f5;
  --bg-input: #f4f5f9;

  --text-primary: #2d3748;
  --text-secondary: #5a6478;
  --text-muted: #8a92a6;
  --text-inverse: #ffffff;

  --accent: #6b7dd4;
  --accent-hover: #5a6cc3;
  --accent-light: #e8eaf6;
  --accent-subtle: rgba(107, 125, 212, 0.08);

  --success: #6bc5a0;
  --success-light: #e6f9f1;
  --danger: #e57373;
  --danger-light: #fde8e8;
  --warning: #f0c76e;
  --warning-light: #fef6e0;

  --border: #e2e5ed;
  --border-light: #eef0f5;

  --shadow-sm: 0 1px 3px rgba(45, 55, 72, 0.04);
  --shadow-md: 0 4px 12px rgba(45, 55, 72, 0.06);
  --shadow-lg: 0 8px 30px rgba(45, 55, 72, 0.08);
  --shadow-accent: 0 4px 14px rgba(107, 125, 212, 0.2);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition: 0.2s ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Navbar */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.9);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 64px;
  gap: 32px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.nav-brand-icon {
  width: 24px;
  height: 24px;
}

.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}

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

.nav-link.active {
  color: var(--accent);
  background: var(--accent-subtle);
}

.nav-icon {
  width: 18px;
  height: 18px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-username {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-logout {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.nav-logout:hover {
  color: var(--danger);
}

/* Container */
.main {
  padding: 32px 24px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 24px 28px 0;
}

.card-body {
  padding: 24px 28px;
}

.card-footer {
  padding: 0 28px 24px;
}

/* Page Header */
.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Auth pages */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg-primary);
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card .card-body {
  padding: 40px 36px;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}

.auth-brand svg {
  width: 32px;
  height: 32px;
}

.auth-title {
  text-align: center;
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

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

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-input);
  transition: all var(--transition);
  outline: none;
}

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

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

.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-full {
  width: 100%;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.825rem;
}

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

.btn-danger:hover {
  background: #d66060;
}

/* Video Grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.video-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all var(--transition);
  cursor: pointer;
}

.video-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  transform: translateY(-2px);
}

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

.video-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

.video-card-meta {
  display: flex;
  gap: 16px;
  font-size: 0.825rem;
  color: var(--text-muted);
}

.video-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.video-card-langs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.lang-tag {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--accent-light);
  color: var(--accent);
}

/* Upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-input);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.upload-area-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  color: var(--text-muted);
}

.upload-area.dragover .upload-area-icon {
  color: var(--accent);
}

.upload-area-text {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.upload-area-hint {
  font-size: 0.825rem;
  color: var(--text-muted);
}

/* Progress bar */
.progress-wrapper {
  margin-top: 24px;
  display: none;
}

.progress-wrapper.active {
  display: block;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b9de8);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  width: 0%;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 24px;
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  color: var(--text-muted);
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Alerts */
.messages {
  margin-bottom: 24px;
}

.alert {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.alert-success {
  background: var(--success-light);
  color: #2d7a5a;
  border: 1px solid rgba(107, 197, 160, 0.3);
}

.alert-error {
  background: var(--danger-light);
  color: #b33030;
  border: 1px solid rgba(229, 115, 115, 0.3);
}

.alert-warning {
  background: var(--warning-light);
  color: #8a6d20;
  border: 1px solid rgba(240, 199, 110, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
  .nav-container {
    padding: 0 16px;
    gap: 16px;
  }

  .nav-links {
    gap: 2px;
  }

  .nav-link {
    padding: 8px 10px;
    font-size: 0.825rem;
  }

  .nav-username {
    display: none;
  }

  .main {
    padding: 20px 16px;
  }

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

  .auth-card .card-body {
    padding: 32px 24px;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card, .video-card {
  animation: fadeIn 0.3s ease;
}

/* Hidden file input */
.upload-input {
  display: none;
}

/* Subtitle languages list in video detail */
.sub-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
}
