:root {
  --card-bg: var(--surface);
  --card-border: var(--border);
  --card-shadow: var(--shadow);
  --toast-bg: #333;
  --toast-text: #fff;
}

[data-theme="light"] {
  --toast-bg: #fff;
  --toast-text: #111;
}

.thumb-panel {
  max-width: 1000px;
  margin: 0 auto;
}

.thumb-card {
  position: relative;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.card-header h3 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 700;
}

.card-header p {
  margin: 0;
  color: var(--muted);
}

.chip {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.85rem;
  border: 1px solid var(--border);
}

/* Input Area */
.input-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.field-label {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.95rem;
}

.field .search-container {
  margin: 0;
  max-width: none;
}

/* Results Area */
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.result-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  display: block;
}

.result-sub {
  font-size: 0.9rem;
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

/* Thumbnail Card */
.thumb-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.thumb-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

.thumb-wrapper {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  overflow: hidden;
  cursor: pointer;
    border-radius: 20px;
}

.thumb-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.thumb-wrapper:hover img {
  transform: scale(1.05);
}

.thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-wrapper:hover .thumb-overlay {
  opacity: 1;
}

.zoom-icon {
  font-size: 2rem;
  color: white;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.thumb-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.res-badge {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}

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

.download-btn {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: white;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}

.download-btn:hover {
  background: #4f8aff; /* Slightly lighter primary */
}

.download-btn:active {
  transform: scale(0.98);
}

/* Toast */
.status-row {
  display: none;
}

#toast-container {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--toast-bg);
  color: var(--toast-text);
  padding: 12px 24px;
  border-radius: 99px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0;
  transform: translateY(20px);
  animation: toast-in 0.3s forwards;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.is-error {
  background: #ef4444;
  color: white;
  border-color: #dc2626;
}

@keyframes toast-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}


.status-text {
  font-size: 0.9rem;
  color: var(--muted);
}

.status-text.is-error {
  color: #ff7a7a;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-title {
  font-weight: 700;
}

.result-sub {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 16px;
  min-height: 690px;
}

.thumb-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}

.thumb-card img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #000;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.thumb-title {
  font-weight: 700;
}

.thumb-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.thumb-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.thumb-actions a {
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 600;
  background: var(--surface);
}

.thumb-actions a.primary {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
}

@media (max-width: 720px) {
  .input-row {
    grid-template-columns: 1fr;
  }
}

/* Centered Layout State */
main.container.is-centered {
  min-height: calc(100vh - 200px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Control Panel Animation */
.control-panel {
  display: none;
  opacity: 0;
  transform: translateY(20px);
}

.control-panel.is-visible {
  display: block;
  animation: panelSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes panelSlideIn {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
