/* UI Theme and component styles for AI Image Generator
   Tailwind is loaded via CDN first; this file provides CSS variables and
   small, consistent component classes built on top of Tailwind utilities.
*/

:root {
  --bg: #f8fafc;             /* slate-50 */
  --surface: #ffffff;         /* white */
  --surface-2: #f1f5f9;       /* slate-100 */
  --text: #0f172a;            /* slate-900 */
  --text-muted: #475569;      /* slate-600 */
  --text-inverse: #ffffff;
  --primary: #2563eb;         /* blue-600 */
  --primary-hover: #1d4ed8;   /* blue-700 */
  --accent: #7c3aed;          /* violet-600 */
  --border: #e2e8f0;          /* slate-200 */
  --divider: #e5e7eb;         /* gray-200 */
  --ring: rgba(37, 99, 235, 0.35);
  --danger: #dc2626;          /* red-600 */
  --success: #16a34a;         /* green-600 */
  --warning: #f59e0b;         /* amber-500 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.12);
}

.dark {
  --bg: #0f172a;            /* slate-900 */
  --surface: #111827;       /* gray-900 */
  --surface-2: #0b1220;     /* darker layer */
  --text: #e5e7eb;          /* gray-200 */
  --text-muted: #94a3b8;    /* slate-400 */
  --text-inverse: #0f172a;
  --primary: #3b82f6;       /* blue-500 */
  --primary-hover: #2563eb; /* blue-600 */
  --accent: #a78bfa;        /* violet-400 */
  --border: #1f2937;        /* gray-800 */
  --divider: #273244;       /* dark divider */
  --ring: rgba(59, 130, 246, 0.45);
  --danger: #f87171;        /* red-400 */
  --success: #22c55e;       /* green-500 */
  --warning: #fbbf24;       /* amber-400 */
}

html, body { height: 100%; }
body {
  background: radial-gradient(1200px 800px at 10% -10%, rgba(37,99,235,0.08), transparent 50%),
              radial-gradient(1000px 600px at 110% 10%, rgba(124,58,237,0.08), transparent 60%),
              var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/***** Cards *****/
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem; /* rounded-lg */
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--divider);
}
.card-body { padding: 1rem 1.25rem; }
.card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--divider);
  background: var(--surface);
  border-radius: 0 0 0.75rem 0.75rem;
}

/***** Buttons *****/
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  padding: 0.625rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn:focus-visible {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 3px var(--ring);
}
.btn:disabled, .btn[aria-busy="true"] {
  opacity: .65;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: rgba(0,0,0,0.04); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: transparent;
}
.btn-ghost:hover {
  background: rgba(0,0,0,0.04);
}

.spinner, .inline-spinner {
  width: 1rem; height: 1rem;
  border-radius: 9999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/***** Forms *****/
.input, .textarea, .select {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.625rem 0.75rem;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.textarea { min-height: 6rem; }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .textarea:focus, .select:focus {
  outline: 2px solid transparent;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] {
  border-color: var(--danger);
}
.helper-text { color: var(--text-muted); font-size: 0.875rem; }

/* Range slider (basic styling across browsers) */
.range { width: 100%; height: 0.25rem; background: var(--divider); border-radius: 9999px; }
.range:focus { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 1rem; height: 1rem; background: var(--primary); border-radius: 9999px; border: 2px solid var(--surface); box-shadow: var(--shadow-sm); }
.range::-moz-range-thumb { width: 1rem; height: 1rem; background: var(--primary); border: 2px solid var(--surface); border-radius: 9999px; }

/***** Tabs *****/
.tabs {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.25rem;
}
.tab {
  padding: 0.5rem 0.875rem;
  border-radius: 0.5rem;
  color: var(--text);
}
.tab[aria-selected="true"], .tab.active {
  background: var(--primary);
  color: var(--text-inverse);
}

/***** Dropzone *****/
.dropzone {
  border: 2px dashed var(--divider);
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.02);
  padding: 1.25rem;
  text-align: center;
  transition: border-color .15s ease, background-color .15s ease;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--primary); background: rgba(37,99,235,0.05); }
.dropzone.dragover { border-color: var(--primary); background: rgba(37,99,235,0.08); }

/***** Toasts *****/
.toast-container {
  position: fixed;
  top: 1rem; right: 1rem;
  display: flex; flex-direction: column; gap: 0.5rem;
  z-index: 50;
}
.toast {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-md);
}
.toast.success { border-color: rgba(22,163,74,0.4); }
.toast.error   { border-color: rgba(220,38,38,0.4); }

/***** Utility *****/
.hr { height: 1px; background: var(--divider); border: 0; }
.mute { color: var(--text-muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
