/* LumenLaboratory — Global Styles */

:root {
  --bg-primary: #0a0a0f;
  --bg-surface: #12121a;
  --bg-card: #1a1a26;
  --bg-card-hover: #20202f;
  --border: #2a2a3d;
  --border-glow: #4a3f7a;

  --text-primary: #f0f0ff;
  --text-secondary: #9090b0;
  --text-muted: #5a5a7a;

  --accent-cyan: #00d4ff;
  --accent-violet: #8b5cf6;
  --accent-amber: #f59e0b;
  --accent-glow: rgba(0, 212, 255, 0.15);

  --gradient-brand: linear-gradient(135deg, #00d4ff, #8b5cf6, #f59e0b);
  --gradient-btn: linear-gradient(135deg, #6d28d9, #4f46e5);
  --gradient-btn-hover: linear-gradient(135deg, #7c3aed, #6366f1);

  --radius: 12px;
  --radius-lg: 20px;
  --radius-sm: 8px;

  --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.2);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Typography ---- */
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: 1.125rem; }

.gradient-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-btn);
  color: #fff;
  box-shadow: 0 4px 15px rgba(109, 40, 217, 0.4);
}
.btn-primary:hover:not(:disabled) {
  background: var(--gradient-btn-hover);
  box-shadow: 0 4px 20px rgba(109, 40, 217, 0.6);
  transform: translateY(-1px);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--border-glow);
  background: rgba(74, 63, 122, 0.15);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
  font-size: 0.875rem;
}
.btn-ghost:hover { color: var(--text-primary); }

.btn-large {
  padding: 16px 40px;
  font-size: 1.0625rem;
  border-radius: 14px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ---- Card ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--border-glow); }

/* ---- Form ---- */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input:focus {
  border-color: var(--accent-violet);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.form-input::placeholder { color: var(--text-muted); }

.form-error {
  font-size: 0.8125rem;
  color: #f87171;
  margin-top: 6px;
  display: none;
}
.form-error.visible { display: block; }

/* ---- Toast ---- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 280px;
  max-width: 400px;
  animation: slideIn 0.3s ease;
  box-shadow: var(--shadow-card);
}
.toast-success { background: #064e3b; border: 1px solid #10b981; color: #a7f3d0; }
.toast-error   { background: #450a0a; border: 1px solid #ef4444; color: #fca5a5; }
.toast-info    { background: #1e1b4b; border: 1px solid #6366f1; color: #c7d2fe; }

@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ---- Spinner ---- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Nav ---- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(10, 10, 15, 0.85);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.125rem;
  text-decoration: none;
  color: var(--text-primary);
}
.nav-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--gradient-brand);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-user {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ---- Upload Zone ---- */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-surface);
  position: relative;
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent-violet);
  background: rgba(139, 92, 246, 0.05);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}
.upload-zone.has-file {
  border-color: var(--accent-cyan);
  border-style: solid;
}
.upload-zone-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.6;
}
.upload-zone-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.upload-zone-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* -- Preview -- */
.upload-preview {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.upload-preview.visible { display: flex; }
.upload-preview img {
  max-width: 120px;
  max-height: 120px;
  object-fit: contain;
  border-radius: var(--radius);
  background: repeating-conic-gradient(#2a2a3d 0% 25%, transparent 0% 50%) 0 0 / 12px 12px;
}
.upload-preview-name {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ---- Result Panel ---- */
.result-panel {
  display: none;
  text-align: center;
}
.result-panel.visible { display: block; }
.result-image-wrap {
  display: inline-block;
  background: repeating-conic-gradient(#1a1a26 0% 25%, #12121a 0% 50%) 0 0 / 20px 20px;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.result-image-wrap img {
  max-width: 300px;
  max-height: 300px;
  object-fit: contain;
  display: block;
  border-radius: var(--radius);
}
.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---- History ---- */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}
.history-item {
  aspect-ratio: 1;
  background: repeating-conic-gradient(#1a1a26 0% 25%, #12121a 0% 50%) 0 0 / 12px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
}
.history-item:hover {
  border-color: var(--border-glow);
  transform: scale(1.04);
}
.history-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.history-item-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  background: rgba(0,0,0,0.7);
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Landing page specifics ---- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(139, 92, 246, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(0, 212, 255, 0.06), transparent),
    var(--bg-primary);
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 999px;
  font-size: 0.8125rem;
  color: var(--accent-violet);
  margin-bottom: 24px;
  font-weight: 500;
}
.hero p {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 560px;
  margin: 20px auto 40px;
}
.hero-cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.features {
  padding: 80px 0;
  background: var(--bg-surface);
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 48px;
}
.feature-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}
.feature h3 { margin-bottom: 8px; }
.feature p { color: var(--text-secondary); font-size: 0.9375rem; }

footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ---- App layout ---- */
.app-layout {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0;
}
.app-main {
  padding: 40px 32px 40px 40px;
  border-right: 1px solid var(--border);
}
.app-sidebar {
  padding: 40px 24px;
  overflow-y: auto;
}

.generate-form { max-width: 600px; }

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
  .app-main {
    padding: 24px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .app-sidebar { padding: 24px; }
}

@media (max-width: 600px) {
  .result-actions { flex-direction: column; align-items: center; }
  .hero-cta { flex-direction: column; align-items: center; }
}
