* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0f1115;
  --panel: #181c24;
  --panel-2: #202633;
  --border: rgba(255,255,255,0.08);
  --text: #f2f4f8;
  --muted: #a7b0be;
  --primary: #c79a63;
  --primary-2: #e9c59b;
  --shadow: 0 20px 60px rgba(0,0,0,0.35);
}

html,
body {
  min-height: 100%;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #0d0f13 0%, #131722 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: rgba(13, 16, 23, 0.96);
  padding: 24px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-badge {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111;
  font-weight: bold;
  font-size: 20px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.brand h1 {
  font-size: 24px;
  margin-bottom: 4px;
}

.brand p {
  color: var(--muted);
  font-size: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 16px;
}

.panel h2 {
  font-size: 16px;
  margin-bottom: 14px;
  color: var(--primary-2);
}

.room-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.room-btn,
.primary-btn,
.secondary-btn {
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: 0.2s ease;
  font-weight: bold;
}

.room-btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.room-btn:hover,
.secondary-btn:hover,
.primary-btn:hover {
  transform: translateY(-1px);
}

.room-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #111;
}

.primary-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #111;
}

.secondary-btn {
  width: 100%;
  margin-top: 12px;
  background: #2a3140;
  color: var(--text);
  border: 1px solid var(--border);
}

.field-label {
  display: block;
  margin: 12px 0 8px;
  color: var(--muted);
  font-size: 14px;
}

input[type="text"],
select,
input[type="range"] {
  width: 100%;
}

input[type="text"],
select {
  background: #11151d;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

input[type="text"]::placeholder {
  color: #8d97a8;
}

input[type="range"] {
  accent-color: var(--primary);
}

.main-content {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 20px;
  padding: 20px;
}

.viewer-section,
.catalog-section {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 18px;
  backdrop-filter: blur(10px);
}

.viewer-topbar,
.catalog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}

.viewer-topbar h2,
.catalog-header h2 {
  font-size: 22px;
}

.viewer-topbar p,
#catalogCount {
  color: var(--muted);
  font-size: 14px;
}

.selected-info {
  background: #1b2130;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--primary-2);
  min-width: 220px;
  text-align: right;
  line-height: 1.5;
}

.scene-wrapper {
  position: relative;
  width: 100%;
  min-height: 640px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.08), transparent 35%),
    linear-gradient(180deg, #cdd6df 0%, #9faab7 45%, #7c8796 100%);
  border: 1px solid rgba(255,255,255,0.1);
}

.room {
  position: relative;
  width: 100%;
  height: 640px;
  display: none;
  overflow: hidden;
}

.room.active {
  display: block;
}

.wall {
  position: absolute;
}

.wall-back {
  top: 0;
  left: 16%;
  width: 68%;
  height: 48%;
  background: linear-gradient(180deg, #eef2f6, #d6dde5);
  border-left: 1px solid rgba(0,0,0,0.08);
  border-right: 1px solid rgba(0,0,0,0.08);
}

.wall-left {
  top: 0;
  left: 0;
  width: 18%;
  height: 64%;
  background: linear-gradient(180deg, #d7dee6, #bcc6d1);
  transform: skewY(18deg);
  transform-origin: top right;
}

.wall-right {
  top: 0;
  right: 0;
  width: 18%;
  height: 64%;
  background: linear-gradient(180deg, #d7dee6, #bcc6d1);
  transform: skewY(-18deg);
  transform-origin: top left;
}

.varanda-sky {
  background:
    linear-gradient(180deg, rgba(150,210,255,0.95), rgba(230,245,255,0.75)),
    linear-gradient(180deg, #eef2f6, #d6dde5);
}

.floor {
  position: absolute;
  left: 8%;
  bottom: -14%;
  width: 84%;
  height: 54%;
  transform: perspective(900px) rotateX(65deg);
  transform-origin: center center;
  border-radius: 18px;
  box-shadow: inset 0 8px 40px rgba(0,0,0,0.18);
  background-color: #c7b299;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,0.08) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.08) 75%, rgba(255,255,255,0.08)),
    linear-gradient(45deg, rgba(0,0,0,0.04) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.04) 75%, rgba(0,0,0,0.04));
  background-size: 140px 140px;
  background-position: 0 0, 70px 70px;
  filter: brightness(1);
  z-index: 1;
}

.furniture {
  position: absolute;
  z-index: 3;
}

.bed {
  width: 220px;
  height: 90px;
  left: 20%;
  top: 45%;
  border-radius: 20px;
  background: linear-gradient(180deg, #c8b7aa, #9f8c7c);
  box-shadow: 0 12px 20px rgba(0,0,0,0.2);
}

.rug {
  width: 220px;
  height: 70px;
  left: 50%;
  top: 58%;
  border-radius: 50px;
  background: rgba(255,255,255,0.55);
  filter: blur(1px);
}

.sofa {
  width: 230px;
  height: 100px;
  left: 18%;
  top: 44%;
  border-radius: 24px;
  background: linear-gradient(180deg, #aab4bf, #7d8998);
  box-shadow: 0 12px 20px rgba(0,0,0,0.22);
}

.table {
  width: 120px;
  height: 120px;
  left: 56%;
  top: 50%;
  border-radius: 50%;
  background: radial-gradient(circle, #8a6847, #5c4632);
  box-shadow: 0 14px 18px rgba(0,0,0,0.18);
}

.plant {
  width: 90px;
  height: 150px;
  left: 20%;
  top: 38%;
  border-radius: 30px 30px 18px 18px;
  background: linear-gradient(180deg, #5b8d5d 0%, #285f37 70%, #7a5b42 71%, #7a5b42 100%);
}

.chair {
  width: 100px;
  height: 110px;
  right: 18%;
  top: 50%;
  border-radius: 18px;
  background: linear-gradient(180deg, #d8d0c8, #a49a91);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  max-height: 760px;
  overflow-y: auto;
  padding-right: 4px;
}

.product-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  transition: 0.2s ease;
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: rgba(231, 197, 154, 0.35);
}

.product-card.active {
  outline: 2px solid var(--primary);
}

.product-thumb {
  height: 130px;
  border-bottom: 1px solid var(--border);
  background-size: cover;
  background-position: center;
  background-color: #2b3240;
}

.product-body {
  padding: 12px;
}

.product-brand {
  color: var(--primary-2);
  font-size: 12px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.product-name {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 6px;
}

.product-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.empty-state {
  grid-column: 1 / -1;
  background: #1a1f29;
  padding: 24px;
  border-radius: 18px;
  border: 1px dashed rgba(255,255,255,0.12);
  text-align: center;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .scene-wrapper {
    min-height: 520px;
  }

  .room {
    height: 520px;
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .viewer-topbar,
  .catalog-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .selected-info {
    min-width: 100%;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .sidebar,
  .main-content {
    padding: 14px;
  }

  .panel,
  .viewer-section,
  .catalog-section {
    padding: 14px;
  }

  .room-buttons {
    grid-template-columns: 1fr;
  }

  .catalog-grid {
    grid-template-columns: 1fr;
  }

  .scene-wrapper {
    min-height: 420px;
  }

  .room {
    height: 420px;
  }

  .bed {
    width: 150px;
    height: 70px;
  }

  .rug {
    width: 160px;
    height: 56px;
  }

  .sofa {
    width: 160px;
    height: 80px;
  }

  .table {
    width: 90px;
    height: 90px;
  }

  .plant {
    width: 70px;
    height: 120px;
  }

  .chair {
    width: 76px;
    height: 90px;
  }
}