* {
  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;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

header {
  text-align: center;
  color: white;
  margin-bottom: 40px;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

main {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.input-section {
  margin-bottom: 40px;
}

.input-section h2 {
  margin-bottom: 15px;
  color: #333;
}

textarea {
  width: 100%;
  padding: 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  font-family: monospace;
  resize: vertical;
  transition: border-color 0.3s;
}

textarea:focus {
  outline: none;
  border-color: #667eea;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background: #667eea;
  color: white;
  margin-top: 15px;
}

.btn-primary:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #f5f5f5;
  color: #333;
}

.btn-secondary:hover {
  background: #e0e0e0;
}

.jobs-section h2 {
  color: #333;
  margin-bottom: 20px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.job-card {
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 15px;
  cursor: pointer;
  transition: all 0.3s;
}

.job-card:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.job-id {
  font-family: monospace;
  font-size: 14px;
  color: #666;
}

.job-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pending {
  background: #fff3cd;
  color: #856404;
}

.status-processing {
  background: #cce5ff;
  color: #004085;
}

.status-completed {
  background: #d4edda;
  color: #155724;
}

.status-failed {
  background: #f8d7da;
  color: #721c24;
}

.job-progress {
  margin-top: 10px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 5px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  transition: width 0.3s;
}

.job-stats {
  display: flex;
  gap: 20px;
  margin-top: 10px;
  font-size: 14px;
  color: #666;
}

.job-platforms {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}

.job-platforms .platform-badge {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.job-platforms .platform-badge.enabled {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.job-platforms .platform-badge.disabled {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  opacity: 0.6;
}

.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.video-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
}

.video-url {
  font-size: 12px;
  color: #666;
  word-break: break-all;
  margin-bottom: 10px;
}

.platform-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.platform {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}

.platform-name {
  font-weight: 600;
}

.platform-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  text-transform: uppercase;
}

.badge-pending {
  background: #f5f5f5;
  color: #666;
}

.badge-in-progress {
  background: #cce5ff;
  color: #004085;
}

.badge-success {
  background: #d4edda;
  color: #155724;
}

.badge-failed {
  background: #f8d7da;
  color: #721c24;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  max-height: 80vh;
  overflow-y: auto;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 20px;
}

.close:hover,
.close:focus {
  color: #000;
}

.log-section {
  margin-top: 30px;
}

.log-section h3 {
  margin-bottom: 10px;
}

#jobLog {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 12px;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.empty-state svg {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  opacity: 0.3;
}

/* Parsed URLs Section */
.parsed-urls-section {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.parsed-urls-section h2 {
  margin-bottom: 20px;
  color: #333;
}

.bulk-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.url-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.url-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px solid #e9ecef;
}

.platform-checkboxes {
  display: flex;
  gap: 20px;
  padding: 8px 0;
  font-size: 14px;
  background: #fff;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

.platform-checkboxes label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
}

.platform-checkboxes input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.custom-caption-section {
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

.custom-caption-input {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

.custom-caption-input:focus {
  outline: none;
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.url-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.url-number {
  display: inline-block;
  min-width: 35px;
  padding: 4px 8px;
  background: #007bff;
  color: white;
  border-radius: 4px;
  font-weight: bold;
  text-align: center;
  font-size: 12px;
}

.url-input-field {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 14px;
  background: white;
  min-width: 300px;
}

.schedule-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.schedule-controls label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  cursor: pointer;
}

.schedule-controls input[type="radio"] {
  cursor: pointer;
}

.schedule-time {
  padding: 6px 10px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 13px;
}

.schedule-time:disabled {
  background: #e9ecef;
  cursor: not-allowed;
}

.btn-submit-single {
  padding: 8px 16px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-left: auto;
}

.btn-submit-single:hover {
  background: #218838;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-remove {
  padding: 6px 12px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: background 0.2s;
}

.btn-remove:hover {
  background: #c82333;
}

.scheduled-badge {
  font-size: 13px;
  color: #28a745;
  background: #d4edda;
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 8px;
  display: inline-block;
}

.platforms-info {
  margin-top: 15px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.platforms-info strong {
  margin-right: 5px;
}

.platform-indicator {
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.platform-indicator.enabled {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.platform-indicator.disabled {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  opacity: 0.7;
  text-decoration: line-through;
}

.url-item-detail {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 4px;
  margin-bottom: 8px;
}

.url-text {
  flex: 1;
  font-size: 13px;
  word-break: break-all;
}

/* Countdown Banner */
.countdown-banner {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 0;
  margin-bottom: 20px;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
  overflow: hidden;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.countdown-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 25px;
  color: white;
}

.countdown-info {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
}

.countdown-icon {
  font-size: 40px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.countdown-details strong {
  display: block;
  font-size: 18px;
  margin-bottom: 5px;
}

.countdown-details p {
  margin: 0;
  font-size: 14px;
  opacity: 0.9;
}

.countdown-timer-circle {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid white;
  margin: 0 20px;
}

.countdown-timer-circle span {
  font-size: 32px;
  font-weight: bold;
  color: white;
}

.btn-cancel-countdown {
  background: #dc3545;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.btn-cancel-countdown:hover {
  background: #c82333;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.countdown-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
}

.countdown-progress-fill {
  height: 100%;
  background: white;
  width: 0%;
  transition: width 1s linear;
}

/* Responsive */
@media (max-width: 768px) {
  .url-item {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .schedule-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .bulk-actions {
    flex-direction: column;
  }
}
