/* ========================================
   Image Background Remover - Styles
   ======================================== */

:root {
  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --success: #10B981;
  --success-hover: #059669;
  --bg-dark: #0F172A;
  --bg-card: #1E293B;
  --bg-card-hover: #334155;
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border: #334155;
  --error: #EF4444;
  --error-bg: rgba(239, 68, 68, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1rem;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--primary), #A855F7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* API Key Section */
.api-key-section {
  margin-bottom: 1.5rem;
}

.api-key-section details {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1rem;
}

.api-key-section summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.875rem;
  user-select: none;
}

.api-key-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.api-key-form input {
  flex: 1;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  font-size: 0.875rem;
}

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

.api-key-form button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 200ms ease-out;
}

.api-key-form button:hover {
  background: var(--primary-hover);
}

.api-key-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Upload Zone */
.upload-zone {
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 200ms ease-out;
  position: relative;
  overflow: hidden;
}

.upload-zone:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.upload-zone.drag-over {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  transform: scale(1.01);
}

.upload-zone.uploading {
  pointer-events: none;
}

.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.upload-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.upload-content p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.upload-hint {
  color: var(--text-muted) !important;
  font-size: 0.75rem !important;
  margin-top: 0.5rem;
}

.upload-zone .file-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.upload-zone .file-name {
  font-weight: 500;
  color: var(--text-primary);
}

.upload-zone .cancel-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
}

/* Loading State */
.loading-state {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 3rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  font-size: 1.125rem;
  font-weight: 500;
}

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

/* Result State */
.result-state {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: fadeIn 300ms ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-preview {
  position: relative;
  width: 100%;
  max-width: 400px;
  border-radius: 12px;
  overflow: hidden;
  background: repeating-conic-gradient(#808080 0% 25%, #c0c0c0 0% 50%) 50% / 20px 20px;
}

.result-preview img {
  width: 100%;
  height: auto;
  display: block;
}

.result-filename {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.result-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.5rem;
}

.btn-download {
  background: var(--success);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease-out;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-download:hover {
  background: var(--success-hover);
  transform: translateY(-1px);
}

.btn-reset {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all 200ms ease-out;
}

.btn-reset:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* Error State */
.error-state {
  background: var(--error-bg);
  border: 1px solid var(--error);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.error-icon {
  font-size: 2.5rem;
}

.error-message {
  color: var(--error);
  font-size: 1rem;
}

.btn-retry {
  background: var(--error);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 200ms ease-out;
}

.btn-retry:hover {
  opacity: 0.9;
}

/* Footer */
.footer {
  text-align: center;
  padding: 1.5rem 0;
  margin-top: auto;
}

.footer p {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Hidden utility */
[hidden] {
  display: none !important;
}

/* Responsive */
@media (max-width: 480px) {
  .container {
    padding: 1.5rem 1rem;
  }

  .logo {
    font-size: 1.5rem;
  }

  .upload-zone {
    padding: 2rem 1rem;
  }

  .upload-icon {
    font-size: 2.5rem;
  }

  .result-actions {
    flex-direction: column;
    width: 100%;
  }

  .btn-download,
  .btn-reset {
    width: 100%;
    justify-content: center;
  }
}
