/* ===== CSS VARIABLES ===== */
:root {
  --bg: #F0E6D3;
  --main-bg: #FFFDF9;
  --sidebar-bg: #3B2A1A;
  --gold: #D4A96A;
  --gold-dark: #C49558;
  --text: #2c2c2c;
  --text-light: #9C7A4A;
  --bubble-ai: #FBF5EC;
  --bubble-border: #E8D5B0;
  --input-bg: #FBF5EC;
  --chip-color: #7A5C35;
  --shadow: rgba(0,0,0,0.12);
}

[data-theme="dark"] {
  --bg: #1A1208;
  --main-bg: #221A0F;
  --sidebar-bg: #0F0A04;
  --gold: #D4A96A;
  --gold-dark: #C49558;
  --text: #F5ECD8;
  --text-light: #A88B5E;
  --bubble-ai: #2A1F12;
  --bubble-border: #3D2E1A;
  --input-bg: #2A1F12;
  --chip-color: #D4A96A;
  --shadow: rgba(0,0,0,0.4);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  transition: background 0.3s ease;
}

/* ===== APP LAYOUT ===== */
.app {
  display: flex;
  width: 960px;
  height: 92vh;
  max-height: 720px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px var(--shadow);
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 1.2rem;
  gap: 6px;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  font-size: 18px;
  font-weight: 700;
  padding: 8px 4px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-label {
  font-size: 9px;
  color: rgba(255,255,255,0.3);
  padding: 10px 4px 5px;
  letter-spacing: 1.5px;
  font-weight: 500;
}

.selector {
  width: 100%;
  background: rgba(212,169,106,0.1);
  border: 1px solid rgba(212,169,106,0.3);
  color: var(--gold);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  outline: none;
}

.selector option {
  background: #3B2A1A;
  color: #D4A96A;
}

.theme-toggle {
  width: 100%;
  background: rgba(212,169,106,0.1);
  border: 1px solid rgba(212,169,106,0.3);
  color: var(--gold);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  font-family: 'DM Sans', sans-serif;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.theme-toggle:hover {
  background: rgba(212,169,106,0.2);
}

.new-chat-btn {
  background: rgba(212,169,106,0.15);
  border: 1px solid rgba(212,169,106,0.4);
  color: var(--gold);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  font-family: 'DM Sans', sans-serif;
  margin-top: 8px;
  transition: background 0.2s;
}

.new-chat-btn:hover { background: rgba(212,169,106,0.25); }

.history-item {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.2s;
}

.history-item:hover { background: rgba(212,169,106,0.1); color: var(--gold); }
.history-item.active { background: rgba(212,169,106,0.15); color: var(--gold); }

/* ===== MAIN ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--main-bg);
  transition: background 0.3s ease;
}

/* ===== TOPBAR ===== */
.topbar {
  padding: 14px 20px;
  border-bottom: 1px solid var(--bubble-border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--main-bg);
  transition: background 0.3s;
}

.topbar-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  color: var(--sidebar-bg);
  font-weight: 700;
  flex-shrink: 0;
}

.topbar-title {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.topbar-sub {
  font-size: 11px;
  color: var(--text-light);
}

.topbar-badges {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.badge {
  background: rgba(212,169,106,0.12);
  border: 1px solid rgba(212,169,106,0.3);
  color: var(--gold);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ===== MESSAGES ===== */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}

.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { background: var(--bubble-border); border-radius: 4px; }

.msg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: fadeInUp 0.3s ease;
}

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

.msg.user { flex-direction: row-reverse; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  font-family: 'Playfair Display', serif;
}

.avatar.ai { background: var(--gold); color: var(--sidebar-bg); }
.avatar.user {
  background: var(--bubble-ai);
  color: var(--text-light);
  border: 1px solid var(--bubble-border);
}

.bubble { max-width: 78%; font-size: 14px; line-height: 1.7; }
.msg.user .bubble { text-align: right; }

.bubble-inner {
  padding: 12px 16px;
  border-radius: 16px;
  display: inline-block;
  text-align: left;
  color: var(--text);
  transition: background 0.3s;
}

.msg.ai .bubble-inner {
  background: var(--bubble-ai);
  border: 1px solid var(--bubble-border);
}

.msg.user .bubble-inner {
  background: var(--sidebar-bg);
  color: #F5ECD8;
}

/* ===== CHIPS ===== */
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.chip {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--chip-color);
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}

.chip:hover { background: var(--bubble-ai); color: var(--gold); }

/* ===== PRO TIP ===== */
.pro-tip {
  background: var(--bubble-ai);
  border-left: 3px solid var(--gold);
  padding: 10px 14px;
  border-radius: 0 10px 10px 0;
  font-size: 13px;
  color: var(--text-light);
  margin-top: 10px;
}

/* ===== TYPING ===== */
.typing .bubble-inner {
  color: var(--text-light) !important;
  font-style: italic;
}

/* ===== SPEAK BUTTON ===== */
.speak-btn {
  background: none;
  border: 1px solid var(--bubble-border);
  color: var(--text-light);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.speak-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* ===== IMAGE FEATURES ===== */
.upload-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bubble-ai);
  border: 1px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.upload-btn:hover { background: var(--bubble-border); }

.msg img.room-photo {
  max-width: 200px;
  border-radius: 10px;
  margin-bottom: 8px;
  display: block;
  border: 1px solid var(--gold);
}

/* ===== FURNITURE IMAGES ===== */
.furniture-images-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.furniture-img-card {
  flex: 1;
  min-width: 120px;
  max-width: 160px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--bubble-border);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.furniture-img-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px var(--shadow);
}

.furniture-img-card img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}

.furniture-img-label {
  font-size: 10px;
  color: var(--text-light);
  padding: 5px 8px;
  background: var(--bubble-ai);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== AI MESSAGE FORMATTING ===== */
.bubble-inner strong { color: var(--gold-dark); font-weight: 600; }
.msg.ai .bubble-inner p { margin-bottom: 6px; }
.msg.ai .bubble-inner ul { padding-left: 0; margin: 6px 0; list-style: none; }
.msg.ai .bubble-inner li { padding: 4px 0; border-bottom: 1px solid var(--bubble-border); font-size: 14px; line-height: 1.6; }

/* ===== INPUT BAR ===== */
.inputbar {
  padding: 14px 20px;
  border-top: 1px solid var(--bubble-border);
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--main-bg);
  transition: background 0.3s;
}

.inputbar input {
  flex: 1;
  border: 1px solid var(--bubble-border);
  border-radius: 25px;
  padding: 11px 18px;
  font-size: 14px;
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.3s;
}

.inputbar input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,169,106,0.1); }
.inputbar input::placeholder { color: var(--text-light); }

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gold);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
}
.brand-tag {
  background: var(--gold);
  color: var(--sidebar-bg);
  font-size: 10px;
  font-weight: bold;
  padding: 3px 8px;
  text-align: center;
  font-family: 'DM Sans', sans-serif;
  letter-spacing: 0.5px;
}
.send-btn:hover { background: var(--gold-dark); transform: scale(1.05); }
.send-btn:active { transform: scale(0.95); }