* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  background: white;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

/* HEADER */
header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

header h1 {
  font-size: 28px;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.yt-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 14px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffc107;
  animation: pulse 2s infinite;
}

.status-indicator.connected {
  background: #4caf50;
}

.status-indicator.disconnected {
  background: #f44336;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* BUTTONS */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
}

.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: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-success {
  background: #28a745;
  color: white;
}

.btn-success:hover {
  background: #218838;
}

.btn-warning {
  background: #ffc107;
  color: #212529;
}

.btn-warning:hover {
  background: #e0a800;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #c82333;
}

.btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* MAIN CONTENT */
main {
  padding: 30px;
}

.actions {
  margin-bottom: 30px;
}

/* JOBS LIST */
.jobs-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.job-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 20px;
  transition: all 0.3s;
  cursor: pointer;
}

.job-card:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
  transform: translateY(-2px);
}

.job-card.running {
  border-color: #28a745;
  background: linear-gradient(to right, #f0fff4, white);
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.job-id {
  font-weight: 600;
  color: #667eea;
}

.job-badge {
  padding: 5px 12px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 600;
}

.badge-running {
  background: #28a745;
  color: white;
  animation: pulse 2s infinite;
}

.badge-stopped {
  background: #6c757d;
  color: white;
}

.job-info {
  font-size: 14px;
  color: #666;
  line-height: 1.8;
}

.job-info div {
  display: flex;
  justify-content: space-between;
}

.job-info strong {
  color: #333;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 16px;
}

/* LOGS */
.logs-section {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 20px;
}

.logs-section h2 {
  margin-bottom: 15px;
  color: #333;
}

.logs-container {
  background: #1e1e1e;
  border-radius: 5px;
  padding: 15px;
  max-height: 400px;
  overflow-y: auto;
}

#logsOutput {
  color: #d4d4d4;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* MODAL */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal.show {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: white;
  border-radius: 10px;
  padding: 30px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close {
  float: right;
  font-size: 28px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
}

.close:hover {
  color: #000;
}

.modal h2 {
  margin-bottom: 20px;
  color: #333;
}

/* TABS */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  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;
  animation: fadeIn 0.3s;
}

.tab-content.active {
  display: block;
}

.tab-content h3 {
  margin-bottom: 20px;
  color: #333;
}

/* FORM */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
}

.form-group input[type="text"],
.form-group input[type="time"],
.form-group input[type="file"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 5px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
}

.form-group input[type="checkbox"] {
  margin-right: 8px;
}

.days-selector {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.days-selector label {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.status-text {
  margin-top: 10px;
  font-size: 13px;
  color: #666;
}

.modal-actions {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 2px solid #e0e0e0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    text-align: center;
  }

  .jobs-list {
    grid-template-columns: 1fr;
  }

  .modal-content {
    width: 95%;
    padding: 20px;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn {
    width: 100%;
  }
}

/* Force 24-hour format for time input */
input[type="time"] {
  width: 100%;
  padding: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 5px;
  font-size: 16px;
  font-family: monospace;
  transition: border-color 0.3s;
}

input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.5);
}

input[type="time"]:focus {
  outline: none;
  border-color: #667eea;
}

/* Remove AM/PM from time input */
input[type="time"]::-webkit-datetime-edit-ampm-field {
  display: none;
}

input[type="time"]::-webkit-inner-spin-button {
  display: none;
}

/* Time input manual styling */
input[type="text"][id*="Time"] {
  width: 100%;
  padding: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 5px;
  font-size: 16px;
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
  transition: border-color 0.3s;
  text-align: center;
  background: #f9f9f9;
}

input[type="text"][id*="Time"]:focus {
  outline: none;
  border-color: #667eea;
  background: white;
}

input[type="text"][id*="Time"]::placeholder {
  color: #999;
  letter-spacing: normal;
}

.btn-time-quick {
  padding: 5px 12px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
  font-family: monospace;
  transition: all 0.2s;
}

.btn-time-quick:hover {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

/* ========================================
   NAVIGATION TABS (NEW)
   ======================================== */
.main-nav {
  display: flex;
  gap: 0;
  background: #f8f9fa;
  border-bottom: 2px solid #e0e0e0;
  padding: 0;
}

.nav-btn {
  flex: 1;
  padding: 15px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: #666;
  transition: all 0.3s;
}

.nav-btn:hover {
  background: #e9ecef;
  color: #667eea;
}

.nav-btn.active {
  background: white;
  color: #667eea;
  border-bottom-color: #667eea;
}

/* Navigation links (same styling as buttons) */
.nav-btn.nav-link {
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

/* ========================================
   MAIN SECTIONS
   ======================================== */
.main-section {
  display: none;
  animation: fadeIn 0.3s;
}

.main-section.active {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
}

.section-header h2 {
  margin: 0;
  color: #333;
  font-size: 24px;
}

/* ========================================
   STATS DASHBOARD
   ======================================== */
.stats-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 20px;
  color: white;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.stat-icon {
  font-size: 32px;
  opacity: 0.9;
}

.stat-info {
  flex: 1;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  opacity: 0.85;
  margin-top: 4px;
}

/* ========================================
   PLAYLISTS GRID
   ======================================== */
.playlists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.playlist-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 20px;
  transition: all 0.3s;
  cursor: pointer;
}

.playlist-card:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
  transform: translateY(-2px);
}

.playlist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.playlist-header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

.playlist-count {
  background: #667eea;
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.playlist-description {
  color: #666;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 12px;
  min-height: 42px;
}

.playlist-settings-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.playlist-settings-badges .badge {
  background: #f0f0f0;
  color: #666;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.playlist-footer {
  padding-top: 12px;
  border-top: 1px solid #e0e0e0;
}

.playlist-footer small {
  color: #999;
  font-size: 12px;
}

/* ========================================
   PLAYLIST MODAL
   ======================================== */
.playlist-settings {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  margin: 20px 0;
}

.playlist-settings h3 {
  margin: 0 0 15px 0;
  font-size: 16px;
  color: #333;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.settings-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.settings-grid input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* ========================================
   PLAYLIST VIDEOS SECTION
   ======================================== */
.playlist-videos-section {
  margin-top: 25px;
  padding-top: 25px;
  border-top: 2px solid #e0e0e0;
}

.playlist-videos-section h3 {
  margin-bottom: 15px;
  color: #333;
}

.btn-sm {
  padding: 8px 15px;
  font-size: 13px;
}

.playlist-videos-list {
  margin-top: 15px;
  max-height: 400px;
  overflow-y: auto;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px;
  background: #fafafa;
}

.playlist-video-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  transition: all 0.2s;
  cursor: move;
}

.playlist-video-item:hover {
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.playlist-video-item.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

.video-drag-handle {
  color: #999;
  font-size: 18px;
  cursor: grab;
  user-select: none;
}

.video-drag-handle:active {
  cursor: grabbing;
}

.video-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.video-number {
  background: #667eea;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.video-details {
  flex: 1;
}

.video-details strong {
  display: block;
  color: #333;
  margin-bottom: 4px;
  font-size: 14px;
}

.video-details small {
  display: block;
  color: #666;
  font-size: 12px;
  font-family: 'Courier New', monospace;
}

.video-details p {
  margin: 6px 0 0 0;
  color: #888;
  font-size: 13px;
  line-height: 1.4;
}

.video-actions {
  display: flex;
  gap: 5px;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 5px;
  opacity: 0.6;
  transition: all 0.2s;
}

.btn-icon:hover {
  opacity: 1;
  transform: scale(1.2);
}

/* Simple playlist video item (for job modal) */
.playlist-video-item-simple {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 5px;
  margin-bottom: 8px;
  font-size: 14px;
}

.playlist-video-item-simple.current {
  background: #e8f5e9;
  border-color: #4caf50;
  font-weight: 600;
}

.playlist-video-item-simple .video-number {
  background: #667eea;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.playlist-video-item-simple.current .video-number {
  background: #4caf50;
}

.badge-current {
  background: #4caf50;
  color: white;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
}

/* ========================================
   INFO BOXES
   ======================================== */
.info-box {
  background: #e3f2fd;
  border-left: 4px solid #2196f3;
  padding: 15px;
  border-radius: 5px;
  margin: 15px 0;
  font-size: 14px;
  line-height: 1.6;
}

.success-box {
  background: #e8f5e9;
  border-left: 4px solid #4caf50;
  padding: 15px;
  border-radius: 5px;
  margin: 15px 0;
  font-size: 14px;
  line-height: 1.6;
}

.warning-box {
  background: #fff3e0;
  border-left: 4px solid #ff9800;
  padding: 15px;
  border-radius: 5px;
  margin: 15px 0;
  font-size: 14px;
  line-height: 1.6;
}

.error-box {
  background: #ffebee;
  border-left: 4px solid #f44336;
  padding: 15px;
  border-radius: 5px;
  margin: 15px 0;
  font-size: 14px;
  line-height: 1.6;
}

/* ========================================
   MODAL SMALL (for add video)
   ======================================== */
.modal-small .modal-content {
  max-width: 500px;
}

/* ========================================
   RESPONSIVE - PLAYLISTS
   ======================================== */
@media (max-width: 768px) {
  .main-nav {
    flex-direction: column;
  }

  .nav-btn {
    border-bottom: none;
    border-left: 3px solid transparent;
  }

  .nav-btn.active {
    border-left-color: #667eea;
    border-bottom-color: transparent;
  }

  .playlists-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-header .btn {
    width: 100%;
  }

  .video-info {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes slideInRight {
  from {
    transform: translateX(50px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.playlist-card {
  animation: slideInRight 0.3s ease-out;
}

.playlist-card:nth-child(2) {
  animation-delay: 0.05s;
}

.playlist-card:nth-child(3) {
  animation-delay: 0.1s;
}

.playlist-card:nth-child(4) {
  animation-delay: 0.15s;
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */
.playlist-videos-list::-webkit-scrollbar {
  width: 8px;
}

.playlist-videos-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.playlist-videos-list::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 10px;
}

.playlist-videos-list::-webkit-scrollbar-thumb:hover {
  background: #5568d3;
}

/* ========================================
   UPLOAD PROGRESS BARS
   ======================================== */
.upload-progress {
  margin-top: 15px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
}

.progress-bar {
  width: 100%;
  height: 25px;
  background: #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 8px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 12px;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.3) 50%,
      transparent 100%);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

.progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #666;
  font-weight: 500;
}

.progress-text span:first-child {
  color: #667eea;
  font-weight: 600;
}

/* ========================================
   BACKUP/RESTORE SECTION
   ======================================== */
.backup-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

.backup-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 25px;
  text-align: center;
  transition: all 0.3s;
}

.backup-card:hover {
  border-color: #667eea;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.backup-icon {
  font-size: 48px;
  margin-bottom: 15px;
}

.backup-card h3 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 20px;
}

.backup-card p {
  color: #666;
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.backup-file-info {
  margin-top: 15px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  text-align: left;
  font-size: 13px;
  color: #333;
}

.backup-info {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 25px;
}

.backup-info h3 {
  margin: 0 0 20px 0;
  color: #333;
}

.backup-status-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.backup-status-item {
  display: grid;
  grid-template-columns: 30px 1fr 80px 180px;
  gap: 10px;
  align-items: center;
  padding: 12px 15px;
  background: white;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.backup-status-icon {
  font-size: 18px;
}

.backup-status-name {
  font-weight: 600;
  color: #333;
}

.backup-status-size {
  color: #666;
  font-size: 13px;
  text-align: right;
}

.backup-status-date {
  color: #999;
  font-size: 12px;
  text-align: right;
}

@media (max-width: 768px) {
  .backup-status-item {
    grid-template-columns: 30px 1fr;
  }

  .backup-status-size,
  .backup-status-date {
    display: none;
  }
}

/* ========================================
   LOGS TABS & STREAM HISTORY
   ======================================== */
.logs-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.logs-tab-btn {
  padding: 12px 24px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  transition: all 0.3s;
}

.logs-tab-btn:hover {
  background: #f8f9fa;
  color: #667eea;
}

.logs-tab-btn.active {
  color: #667eea;
  border-bottom-color: #667eea;
}

.logs-tab-content {
  display: none;
  animation: fadeIn 0.3s;
}

.logs-tab-content.active {
  display: block;
}

/* History Stats */
.history-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.history-stat {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  padding: 18px;
  color: white;
  text-align: center;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.history-stat .stat-number {
  display: block;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 5px;
}

.history-stat .stat-label {
  font-size: 12px;
  opacity: 0.85;
}

/* History Actions */
.history-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* History Table */
.history-table-container {
  overflow-x: auto;
  margin-bottom: 20px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.history-table thead {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.history-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
}

.history-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  color: #333;
}

.history-table tbody tr:hover {
  background: #f8f9ff;
}

.history-table tbody tr:last-child td {
  border-bottom: none;
}

/* Status badges in table */
.history-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.history-status.running {
  background: #d4edda;
  color: #155724;
}

.history-status.completed {
  background: #cce5ff;
  color: #004085;
}

.history-status.stopped {
  background: #fff3cd;
  color: #856404;
}

.history-status.error {
  background: #f8d7da;
  color: #721c24;
}

/* History Pagination */
.history-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.history-pagination button {
  padding: 8px 16px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #666;
  transition: all 0.2s;
}

.history-pagination button:hover:not(:disabled) {
  border-color: #667eea;
  color: #667eea;
}

.history-pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.history-pagination .page-info {
  display: flex;
  align-items: center;
  padding: 0 15px;
  color: #666;
  font-size: 13px;
}

/* Empty state */
.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.history-empty-icon {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
}

@media (max-width: 768px) {
  .history-stats {
    grid-template-columns: 1fr;
  }

  .history-actions {
    flex-direction: column;
  }

  .history-actions .btn {
    width: 100%;
  }

  .history-table th,
  .history-table td {
    padding: 10px 12px;
    font-size: 12px;
  }
}

/* ========================================
   PREVIEW CONTAINERS
   ======================================== */
.preview-container {
  margin-top: 15px;
  padding: 15px;
  background: #f8f9fa;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
  color: #333;
}

.btn-toggle-preview {
  padding: 6px 12px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.btn-toggle-preview:hover {
  background: #5568d3;
}

.preview-wrapper {
  margin-top: 10px;
}

/* Thumbnail Preview */
.thumbnail-preview {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  object-fit: contain;
  display: block;
}

/* Video Preview */
.video-preview {
  width: 100%;
  max-height: 400px;
  border-radius: 8px;
  background: #000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
  .preview-container {
    padding: 10px;
  }

  .thumbnail-preview {
    max-height: 200px;
  }

  .video-preview {
    max-height: 250px;
  }
}