:root {
  --radius: 0.625rem;
  --background: #ffffff;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --popover: #ffffff;
  --popover-foreground: #0f172a;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-foreground: #ffffff;
  --secondary: #f1f5f9;
  --secondary-hover: #e2e8f0;
  --secondary-foreground: #0f172a;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --accent: #f1f5f9;
  --accent-foreground: #0f172a;
  --destructive: #ef4444;
  --destructive-foreground: #ffffff;
  --border: #e2e8f0;
  --input: #e2e8f0;
  --ring: #3b82f6;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

html.dark {
  --background: #090d16;
  --foreground: #f8fafc;
  --card: #111827;
  --card-foreground: #f8fafc;
  --popover: #111827;
  --popover-foreground: #f8fafc;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-foreground: #ffffff;
  --secondary: #1e293b;
  --secondary-hover: #334155;
  --secondary-foreground: #f8fafc;
  --muted: #1e293b;
  --muted-foreground: #94a3b8;
  --accent: #1e293b;
  --accent-foreground: #f8fafc;
  --destructive: #f87171;
  --destructive-foreground: #ffffff;
  --border: rgba(255, 255, 255, 0.1);
  --input: rgba(255, 255, 255, 0.15);
  --ring: #60a5fa;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.5), 0 1px 2px -1px rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-color: var(--border);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.15s ease;
}

body {
  background-color: var(--background);
  color: var(--foreground);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 56rem;
  margin: 0 auto;
  padding: 3rem 1rem 4rem;
}

@media (min-width: 640px) {
  .container {
    padding-top: 4rem;
  }
}

/* Header & Theme Toggle */
.header {
  position: relative;
  text-align: center;
}

.theme-toggle-wrapper {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .theme-toggle-wrapper {
    position: absolute;
    right: 0;
    top: 0;
    margin-bottom: 0;
  }
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.25rem;
  gap: 0.25rem;
  box-shadow: var(--shadow-sm);
}

.theme-btn {
  background: none;
  border: none;
  color: var(--muted-foreground);
  padding: 0.375rem;
  border-radius: 9999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.theme-btn:hover {
  color: var(--foreground);
}

.theme-btn.active {
  background-color: var(--secondary);
  color: var(--foreground);
  box-shadow: var(--shadow-sm);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background-color: var(--card);
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.title {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--foreground);
}

@media (min-width: 640px) {
  .title {
    font-size: 3rem;
  }
}

.subtitle {
  margin-top: 0.75rem;
  color: var(--muted-foreground);
  font-size: 1rem;
}

/* Icons */
.icon {
  width: 1rem;
  height: 1rem;
}

.icon-small {
  width: 0.875rem;
  height: 0.875rem;
}

.icon-large {
  width: 1.5rem;
  height: 1.5rem;
}

.icon-xl {
  width: 2rem;
  height: 2rem;
}

.mr-2 {
  margin-right: 0.5rem;
}

.text-primary {
  color: var(--primary);
}

/* Config Section */
.config-section {
  margin-top: 2.5rem;
}

.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
}

.help-text {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.input-text {
  margin-top: 0.5rem;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--input);
  background-color: var(--background);
  color: var(--foreground);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-text:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Dropzone */
.dropzone {
  margin-top: 1rem;
  cursor: pointer;
  border-radius: 1rem;
  border: 2px dashed var(--border);
  background-color: var(--card);
  padding: 2.5rem;
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--primary);
  background-color: rgba(59, 130, 246, 0.05);
}

.dropzone-icon {
  margin: 0 auto;
  display: flex;
  width: 3.5rem;
  height: 3.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background-color: rgba(59, 130, 246, 0.1);
}

.dropzone-title {
  margin-top: 1rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--foreground);
}

.dropzone-subtitle {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.hidden-input {
  display: none;
}

/* Action Bar Center */
.action-bar-center {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.tip-text {
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-sm);
}

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

.btn-secondary {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--secondary-hover);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border);
  color: var(--foreground);
}

.btn-outline:hover:not(:disabled) {
  background-color: var(--secondary);
}

.btn-ghost {
  background-color: transparent;
  border-color: transparent;
  color: var(--muted-foreground);
  padding: 0.25rem;
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--secondary);
  color: var(--foreground);
}

.btn-icon {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.75rem;
  cursor: pointer;
  margin-left: 0.5rem;
  text-decoration: underline;
}

/* Summary Section */
.summary-section {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

@media (min-width: 640px) {
  .summary-section {
    flex-direction: row;
    align-items: center;
  }
}

.summary-text {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

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

.hidden {
  display: none !important;
}

.font-medium {
  font-weight: 500;
}

.text-destructive {
  color: var(--destructive);
}

/* Items List */
.items-list {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.empty-state {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 0;
  text-align: center;
  color: var(--muted-foreground);
}

.empty-text {
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

/* Upload Card Item */
.card-item {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 0.75rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card-item:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(59, 130, 246, 0.3);
}

.preview-box {
  position: relative;
  display: flex;
  width: 4rem;
  height: 4rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 0.375rem;
  background-color: var(--muted);
}

.preview-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-content {
  min-width: 0;
  flex: 1;
}

.item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.item-info {
  min-width: 0;
}

.item-name {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Progress bar */
.progress-bar-bg {
  margin-top: 0.5rem;
  height: 0.375rem;
  width: 100%;
  overflow: hidden;
  border-radius: 9999px;
  background-color: var(--muted);
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--primary);
  width: 0%;
  transition: width 0.2s ease;
}

/* Done Links URL Box */
.url-box {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.url-input {
  min-width: 0;
  flex: 1;
  border-radius: 0.375rem;
  border: 1px solid var(--input);
  background-color: var(--background);
  color: var(--foreground);
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  outline: none;
}

.error-box {
  margin-top: 0.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  border-radius: 0.375rem;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background-color: rgba(239, 68, 68, 0.05);
  padding: 0.375rem 0.5rem;
}

.error-msg {
  font-size: 0.75rem;
  color: var(--destructive);
}

/* Spinner */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinner {
  animation: spin 1s linear infinite;
}

.text-green {
  color: #16a34a;
}

/* Footer & Config Editor */
.footer {
  margin-top: 4rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.code-badge {
  border-radius: 0.25rem;
  background-color: var(--muted);
  padding: 0.125rem 0.375rem;
  font-family: monospace;
  color: var(--foreground);
}

.config-editor {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}

.config-editor-inner {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-md);
  max-width: 20rem;
  width: 100%;
  text-align: left;
}

.config-editor-inner h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--foreground);
}

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

.form-group label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
}

.config-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Toasts */
.toast-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.toast-error {
  border-color: rgba(239, 68, 68, 0.4);
  background-color: var(--card);
  color: var(--destructive);
}

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

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-1rem) scale(0.95);
  }
}
