/* Web panel styles */
:root {
  --primary-color: #f44336;
  --primary-hover: #d32f2f;
  --text-color: #333;
  --background-color: #f9f9f9;
  --card-background: #ffffff;
  --border-color: #e0e0e0;
  --input-background: #ffffff;
}

[data-theme="dark"] {
  --text-color: #e0e0e0;
  --background-color: #121212;
  --card-background: #1e1e1e;
  --border-color: #3d3d3d;
  --input-background: #2d2d2d;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
  margin: 0;
  padding: 0;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

.header {
  text-align: center;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header h1 {
  font-size: 2.5rem;
  color: var(--primary-color);
}

/* Theme toggle styles */
.theme-switch-wrapper {
  display: flex;
  align-items: center;
  margin-top: 1rem;
  gap: 10px;
}

.theme-toggle {
  position: relative;
  display: inline-block;
}

.toggle-checkbox {
  position: absolute;
  opacity: 0;
  height: 0;
  width: 0;
}

.toggle-label {
  display: inline-block;
  position: relative;
  cursor: pointer;
  width: 50px;
  height: 26px;
}

.toggle-inner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  border-radius: 34px;
  transition: background-color 0.2s ease;
}

.toggle-switch {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-switch i {
  font-size: 12px;
  color: #121212;
}

.toggle-checkbox:checked + .toggle-label .toggle-inner {
  background-color: var(--primary-color);
}

.toggle-checkbox:checked + .toggle-label .toggle-switch {
  transform: translateX(24px);
}

.toggle-checkbox:not(:checked) + .toggle-label .toggle-switch i.fa-moon {
  display: none;
}

.toggle-checkbox:not(:checked) + .toggle-label .toggle-switch::before {
  content: '\f185'; /* Unicode for fa-sun */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 12px;
  color: #ffb700;
}

.card {
  background: var(--card-background);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
  transition: background-color 0.3s ease;
}

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

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  transition: border 0.2s, background-color 0.3s;
  background-color: var(--input-background);
  color: var(--text-color);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
}

.btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn:hover {
  background-color: var(--primary-hover);
}

.btn:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

/* Configuration info box */
.config-info {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  font-size: 0.9rem;
}

[data-theme="dark"] .config-info {
  background-color: rgba(255, 255, 255, 0.05);
}

.config-info p {
  margin: 0;
  color: var(--text-color);
}

.config-info strong {
  color: var(--primary-color);
}

.result-section {
  margin-top: 2rem;
}

.alert {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.alert-success {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.alert-danger {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.copy-btn {
  background-color: #4CAF50;
  margin-left: 10px;
}

.copy-btn:hover {
  background-color: #388E3C;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  margin-right: 10px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none;
}

.video-info {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.download-link {
  word-break: break-all;
  font-family: monospace;
  padding: 0.5rem;
  background-color: var(--input-background);
  border-radius: 4px;
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

/* History section styles */
.history-container {
  background: var(--card-background);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-top: 2rem;
  transition: background-color 0.3s ease;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.history-container h2 {
  margin-top: 0;
  color: var(--primary-color);
  margin-bottom: 0;
  font-size: 1.8rem;
}

.btn-danger {
  background-color: var(--primary-color);
  color: white;
}

.btn-danger:hover {
  background-color: var(--primary-hover);
}

.history-entry {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.history-entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.video-info h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quality-badge {
  font-size: 0.8rem;
  background-color: var(--primary-color);
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  margin-left: auto;
}
.timestamp {
  font-size: 0.8rem;
  color: #777;
  margin-top: 0.5rem;
  display: block;
}

.countdown {
  margin-left: 5px;
  font-weight: bold;
}

.countdown.warning {
  color: #f39c12;
}

.countdown.danger {
  color: #e74c3c;
}

.empty-history {
  font-style: italic;
  color: #777;
  text-align: center;
  padding: 1.5rem 0;
}

/* Input field with buttons */
.input-with-buttons {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-buttons .form-control {
  flex-grow: 1;
  padding-right: 80px; /* Space for the buttons */
  border-radius: 4px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 10px;
  position: absolute;
  height: 100%; /* Full height */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  border-radius: 0;
  top: 0; /* Align to the top of container */
  transition: background-color 0.2s, color 0.2s;
  margin: 0; /* Remove any margin */
  border: none; /* Explicitly remove border */
}

#pasteUrlBtn {
  right: 40px; /* Position for paste button */
  background-color: #4CAF50; /* Green */
  color: white;
  width: 40px; /* Fixed width */
  padding: 0; /* Remove padding */
}

#clearUrlBtn {
  right: 0;
  background-color: #f44336; /* Red */
  color: white;
  border-top-right-radius: 3px;
  border-bottom-right-radius: 3px;
  width: 40px; /* Fixed width */
  padding: 0; /* Remove padding */
}

/* Video actions button styling */
.video-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.video-actions .btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  box-sizing: border-box;
  text-align: center;
}

.video-actions .btn.copy-btn {
  background-color: #4CAF50; /* Green for Copy Link button */
}

.video-actions .btn.open-btn {
  background-color: var(--primary-color); /* Red for Open Video button */
}

.video-actions .btn:hover.copy-btn {
  background-color: #388E3C;
}

.video-actions .btn:hover.open-btn {
  background-color: var(--primary-hover);
}