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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 1rem 2rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-content h1 {
  font-size: 1.5rem;
  color: #667eea;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-right span {
  font-weight: 500;
}

.nav-right a {
  color: #667eea;
  text-decoration: none;
  font-weight: 500;
}

.nav-right a:hover {
  text-decoration: underline;
}

.container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-box {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
}

.login-box h1 {
  text-align: center;
  color: #667eea;
  margin-bottom: 2rem;
}

.cookie-status {
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cookie-status.cookie-active {
  background: #d1fae5;
  border: 2px solid #10b981;
}

.cookie-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cookie-info span {
  font-weight: 500;
  color: #555;
}

.cookie-status.cookie-active .cookie-info span {
  color: #059669;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  background: transparent;
  color: #666;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s;
}

.tab-btn:hover {
  color: #667eea;
}

.tab-btn.active {
  color: #667eea;
  border-bottom-color: #667eea;
}

.tab-content {
  display: none;
}

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

.download-form,
.admin-panel {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #555;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="file"],
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
}

.form-group small {
  display: block;
  margin-top: 0.25rem;
  color: #888;
  font-size: 0.875rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.checkbox-label span {
  font-weight: normal;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  transition: all 0.3s;
}

.radio-group label:hover {
  border-color: #667eea;
  background: #f5f7ff;
}

.radio-group input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #e0e0e0;
  color: #333;
}

.btn-secondary:hover {
  background: #d0d0d0;
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-danger {
  background: #ef4444;
  color: white;
}

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

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.error {
  color: #ef4444;
  background: #fee2e2;
  padding: 0.75rem;
  border-radius: 8px;
  margin-top: 1rem;
  display: none;
}

.error:not(:empty) {
  display: block;
}

.success {
  color: #10b981;
  background: #d1fae5;
  padding: 0.75rem;
  border-radius: 8px;
  margin-top: 1rem;
  display: none;
}

.success:not(:empty) {
  display: block;
}

.video-info {
  background: #f5f7ff;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.video-info h4 {
  margin: 0.5rem 0;
  color: #333;
}

.video-info p {
  color: #666;
  margin: 0.25rem 0;
}

.thumbnail {
  width: 100%;
  max-width: 300px;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.progress-container {
  margin: 1.5rem 0;
}

.progress-bar {
  width: 100%;
  height: 30px;
  background: #e0e0e0;
  border-radius: 15px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  text-align: center;
  font-weight: bold;
  font-size: 1.1rem;
  margin-top: 0.5rem;
  color: #667eea;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 1rem auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#progress {
  text-align: center;
  padding: 2rem 0;
}

#statusLog {
  background: #1a1a1a;
  color: #00ff00;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  padding: 1rem;
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 1rem;
  text-align: left;
}

.status-line {
  padding: 0.25rem 0;
  word-wrap: break-word;
}

.status-info {
  color: #00ff00;
}

.status-success {
  color: #00ff00;
  font-weight: bold;
}

.status-error {
  color: #ff4444;
  font-weight: bold;
}

#result {
  text-align: center;
  padding: 2rem 0;
}

.batch-url-list {
  background: #f5f7ff;
  padding: 1rem;
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  list-style: none;
}

.batch-url-list li {
  padding: 0.5rem;
  border-bottom: 1px solid #e0e0e0;
  word-break: break-all;
}

.batch-url-list li:last-child {
  border-bottom: none;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: #f5f7ff;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
  transition: all 0.3s;
}

.history-item:hover {
  border-color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.history-item.unavailable {
  opacity: 0.6;
  background: #f9fafb;
}

.history-info {
  flex: 1;
}

.history-title {
  font-weight: 600;
  color: #333;
  margin-bottom: 0.25rem;
}

.history-meta {
  font-size: 0.875rem;
  color: #666;
}

.history-actions {
  display: flex;
  gap: 0.5rem;
}

.expired-label {
  padding: 0.5rem 1rem;
  background: #fee2e2;
  color: #ef4444;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
}

.no-history {
  text-align: center;
  padding: 3rem;
  color: #888;
  font-style: italic;
}

.user-management {
  margin-bottom: 2rem;
}

.user-management h2 {
  margin-bottom: 1.5rem;
  color: #667eea;
}

.user-management h3 {
  margin: 1.5rem 0 1rem;
  color: #555;
}

.add-user-form {
  background: #f5f7ff;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.users-list {
  margin-top: 2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

thead {
  background: #667eea;
  color: white;
}

th, td {
  padding: 1rem;
  text-align: left;
}

tbody tr:nth-child(even) {
  background: #f9fafb;
}

tbody tr:hover {
  background: #f5f7ff;
}

@media (max-width: 768px) {
  .nav-content {
    flex-direction: column;
    gap: 1rem;
  }

  .container {
    padding: 0 0.5rem;
  }

  .download-form,
  .admin-panel {
    padding: 1rem;
  }

  .tabs {
    flex-wrap: wrap;
  }

  .tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .history-actions {
    width: 100%;
  }

  .history-actions .btn {
    width: 100%;
  }

  table {
    font-size: 0.875rem;
  }

  th, td {
    padding: 0.5rem;
  }
  
  #statusLog {
    font-size: 0.75rem;
    max-height: 200px;
  }
}