/* ================================================
   PREMIK LOOK AI VISUALIZER – Design System
   Inspired by MEBLE-2
   Motyw: Dark Luxury with Gold Accents
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@200;300;400;600;700;900&family=Inter:wght@300;400;500;600&display=swap');

/* -- Tokeny kolorów -- */
:root {
  --bg-primary:    #090b10;
  --bg-secondary:  #0f1219;
  --bg-card:       #131822;
  --bg-card-hover: #181f2e;
  --border:        rgba(255,255,255,0.07);
  --border-active: rgba(212,175,55,0.5);

  --acc-gold:      #d4af37;
  --acc-gold-dim:  #a8892a;
  --acc-blue:      #3d6ce8;
  --acc-green:     #22c55e;
  --acc-red:       #ef4444;

  --text-primary:  #f0f2f7;
  --text-secondary:#9ba3b5;
  --text-muted:    #5a6278;

  --gradient-gold: linear-gradient(135deg, #d4af37, #f5d77e, #d4af37);
  --gradient-dark: linear-gradient(180deg, #090b10 0%, #0c1020 100%);
  --gradient-card: linear-gradient(145deg, rgba(255,255,255,0.04), rgba(255,255,255,0));

  --shadow-card:   0 4px 24px rgba(0,0,0,0.5);
  --shadow-glow:   0 0 40px rgba(212,175,55,0.15);
  --radius-sm:     8px;
  --radius-md:     14px;
  --radius-lg:     22px;
  --transition:    0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* -- Reset & Base -- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(61,108,232,0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(212,175,55,0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* -- Typography -- */
h1, h2, h3, h4 { font-family: 'Outfit', sans-serif; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }

/* ================================================
   LAYOUT
   ================================================ */
.app-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* -- Header -- */
.app-header {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
  background: rgba(9,11,16,0.85);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.brand-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: var(--gradient-gold);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-icon svg { width: 24px; height: 24px; }

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.brand-tagline {
  font-size: 0.72rem;
  color: var(--acc-gold);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 400;
}

/* -- AI Status Badge -- */
.ai-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 30px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.03);
}

.ai-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: pulse 2s infinite;
}

.ai-badge.active   .dot { background: var(--acc-green); }
.ai-badge.active       { border-color: rgba(34,197,94,0.3); color: var(--acc-green); }
.ai-badge.error    .dot { background: var(--acc-red); animation: none; }
.ai-badge.loading  .dot { background: var(--acc-gold); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(1.3); }
}

/* ================================================
   STEPPER PROGRESS BAR
   ================================================ */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 40px 24px 0;
  max-width: 600px;
  margin: 0 auto;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  position: relative;
}

.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 20px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border);
  transition: background var(--transition);
}

.step-item.done:not(:last-child)::after,
.step-item.active:not(:last-child)::after {
  background: linear-gradient(90deg, var(--acc-gold), var(--border));
}

.step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  color: var(--text-muted);
  background: var(--bg-secondary);
  transition: all var(--transition);
  position: relative;
  z-index: 2;
}

.step-item.done .step-circle {
  background: var(--acc-gold);
  border-color: var(--acc-gold);
  color: #000;
}

.step-item.active .step-circle {
  border-color: var(--acc-gold);
  color: var(--acc-gold);
  box-shadow: 0 0 20px rgba(212,175,55,0.3);
  background: rgba(212,175,55,0.1);
}

.step-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color var(--transition);
}

.step-item.active .step-label { color: var(--acc-gold); }
.step-item.done  .step-label  { color: var(--text-secondary); }

/* ================================================
   SECTION TITLES
   ================================================ */
.section-header {
  text-align: center;
  padding: 50px 0 40px;
}

.section-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--acc-gold);
  margin-bottom: 12px;
  font-weight: 500;
}

.section-title { color: var(--text-primary); margin-bottom: 10px; }

.section-sub {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 480px;
  margin: 0 auto;
}

/* ================================================
   UPLOAD BOX
   ================================================ */
.upload-box {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.upload-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-card);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.upload-box:hover {
  border-color: var(--acc-gold-dim);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-glow);
}

.upload-box:hover::before { opacity: 1; }

.upload-box.dragging {
  border-color: var(--acc-gold);
  background: rgba(212,175,55,0.05);
  box-shadow: 0 0 60px rgba(212,175,55,0.2);
}

.upload-icon {
  width: 60px;
  height: 60px;
  background: rgba(212,175,55,0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  transition: transform var(--transition);
}

.upload-box:hover .upload-icon { transform: scale(1.1); }

.upload-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

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

.upload-box-preview {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-box-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius-lg);
  background: #000;
}

.preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}

.upload-box:hover .preview-overlay { opacity: 1; }

.preview-change-btn {
  background: rgba(212,175,55,0.9);
  color: #000;
  border: none;
  padding: 10px 24px;
  border-radius: 30px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

/* Boks bez kliknięcia na całość — tylko przyciski wewnątrz są klikalne */
.upload-box--no-click {
  cursor: default;
}

/* -- Textarea / Inputs -- */
.form-group {
    margin-top: 24px;
    text-align: left;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    color: var(--acc-gold);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.form-control {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: all var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--acc-gold);
    box-shadow: 0 0 15px rgba(212,175,55,0.1);
}

/* ================================================
   FURNITURE GRID / CATALOG
   ================================================ */
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 30px;
  justify-content: center;
}

.filter-tab {
  padding: 7px 18px;
  border-radius: 30px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.82rem;
  font-family: 'Inter', sans-serif;
  transition: all var(--transition);
  letter-spacing: 0.3px;
}

.filter-tab:hover {
  border-color: var(--acc-gold-dim);
  color: var(--text-primary);
}

.filter-tab.active {
  background: var(--acc-gold);
  border-color: var(--acc-gold);
  color: #000;
  font-weight: 600;
}

.furniture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.furniture-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.furniture-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card), 0 0 30px rgba(212,175,55,0.1);
  background: var(--bg-card-hover);
}

.furniture-card.selected {
  background: var(--bg-card-hover);
  box-shadow: 0 0 0 2px var(--acc-gold), var(--shadow-glow);
}

.furniture-card-img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.furniture-card:hover .furniture-card-img { transform: scale(1.05); }

.furniture-card-body {
  padding: 12px;
}

.furniture-card-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  text-align: center;
}

.selected-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  background: var(--acc-gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: all var(--transition);
  z-index: 2;
}

.furniture-card.selected .selected-check {
  opacity: 1;
  transform: scale(1);
}

/* ================================================
   BUTTONS
   ================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  letter-spacing: 0.3px;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--acc-gold);
  color: #000;
}

.btn-primary:hover:not(:disabled) {
  background: #e8c84a;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(212,175,55,0.35);
}

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--acc-gold);
  border: 1px solid var(--acc-gold);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(212,175,55,0.1);
  transform: translateY(-2px);
}

.btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 40px;
}

/* ================================================
   AI LOADER
   ================================================ */
.ai-loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9,11,16,0.92);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-loader-box {
  text-align: center;
  max-width: 400px;
  padding: 50px 40px;
}

.ai-loader-ring {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  position: relative;
}

.ai-loader-ring::before,
.ai-loader-ring::after {
  content: '';
  position: absolute;
  border-radius: 50%;
}

.ai-loader-ring::before {
  inset: 0;
  border: 3px solid rgba(212,175,55,0.15);
}

.ai-loader-ring::after {
  inset: 0;
  border: 3px solid transparent;
  border-top-color: var(--acc-gold);
  border-right-color: rgba(212,175,55,0.4);
  animation: spin 1.2s linear infinite;
}

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

.ai-loader-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  animation: breathe 2s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50%       { transform: scale(1.15); opacity: 1; }
}

.ai-loader-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.ai-loader-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ================================================
   RESULT VIEW
   ================================================ */
.result-section {
  padding-bottom: 80px;
}

.result-image-wrapper {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  position: relative;
  max-width: 800px;
  margin: 0 auto;
}

.result-image-wrapper img {
  width: 100%;
  display: block;
  max-height: 70vh;
  object-fit: contain;
}

.result-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* -- Toast -- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  font-size: 0.85rem;
  box-shadow: var(--shadow-card);
  animation: slideIn 0.3s ease-out;
}

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

@keyframes cameraPulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(231,76,60,0.6); }
  50%       { opacity: 0.7; transform: scale(1.3); box-shadow: 0 0 0 6px rgba(231,76,60,0); }
}

.toast.error { border-left: 4px solid var(--acc-red); }
.toast.success { border-left: 4px solid var(--acc-green); }

/* -- Footer -- */
.app-footer {
  padding: 40px 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* -- Mobile Optimization -- */
@media (max-width: 768px) {
    .container { padding: 0 20px; }
    .header-inner { flex-direction: column; text-align: center; }
    .brand-logo { justify-content: center; }
    .ai-badge { display: none; }
    .stepper { padding: 24px 10px 0; }
    .step-label { font-size: 0.65rem; }
    .section-header { padding: 30px 0; }
    .upload-box { padding: 40px 20px; min-height: 200px; }
    .btn-group { flex-direction: column; }
    .btn { width: 100%; }
}
