/* SAPPORO ONE Interactive Interior Design Tool CSS */

/* --- CSS Variables & Design Tokens --- */
:root {
  --bg-primary: #0A0D10;
  --bg-secondary: #13171C;
  --bg-tertiary: #1B2129;
  --bg-glass: rgba(19, 23, 28, 0.75);
  
  --border-light: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(213, 167, 108, 0.35);
  
  --text-primary: #F0F3F5;
  --text-secondary: #9DA8B3;
  --text-muted: #64707D;
  
  --accent-gold: #D5A76C;
  --accent-gold-hover: #E3BC8B;
  --accent-blue: #00D2FF;
  --accent-danger: #FF5A79;
  --accent-danger-hover: #FF7B94;
  --accent-success: #3CD070;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 15px rgba(213, 167, 108, 0.15);

  --font-family: 'Outfit', 'Noto Sans JP', sans-serif;
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Global Resets & Body --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) var(--bg-primary);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* --- App Container Grid --- */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* --- Header Styling --- */
.app-header {
  height: 65px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.logo-area {
  display: flex;
  flex-direction: column;
}
.logo-accent {
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--accent-gold);
  font-size: 14px;
  line-height: 1.2;
}
.app-header h1 {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-header .subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 300;
}

/* Header Presets */
.header-presets {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-primary);
  padding: 6px 14px;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-light);
}
.preset-label {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.preset-label i {
  width: 14px;
  height: 14px;
  color: var(--accent-gold);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- Buttons --- */
.btn {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--border-radius-md);
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
  color: var(--text-primary);
}

.btn-icon i {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background-color: var(--accent-gold);
  color: #1A130B;
}
.btn-primary:hover {
  background-color: var(--accent-gold-hover);
  box-shadow: 0 0 10px rgba(213, 167, 108, 0.3);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  border-color: var(--border-light);
}
.btn-secondary:hover {
  background-color: #262E3A;
  border-color: var(--text-muted);
}

.btn-danger {
  background-color: rgba(255, 90, 121, 0.15);
  color: var(--accent-danger);
  border-color: rgba(255, 90, 121, 0.3);
}
.btn-danger:hover {
  background-color: var(--accent-danger);
  color: white;
}

.btn-preset {
  background-color: transparent;
  border-color: transparent;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 4px 12px;
  text-align: left;
}
.btn-preset .preset-name {
  font-size: 13px;
  font-weight: 600;
}
.btn-preset .preset-desc {
  font-size: 10px;
  color: var(--text-muted);
}
.btn-preset:hover {
  background-color: rgba(255,255,255,0.03);
}
.btn-preset.active {
  background-color: rgba(213, 167, 108, 0.1);
  border-color: var(--accent-gold);
}
.btn-preset.active .preset-name {
  color: var(--accent-gold);
}
.btn-preset.active .preset-desc {
  color: var(--text-secondary);
}

.btn-toggle {
  background-color: var(--bg-primary);
  border-color: var(--border-light);
  color: var(--text-secondary);
}
.btn-toggle:hover {
  color: var(--text-primary);
}
.btn-toggle.active {
  background-color: var(--accent-gold);
  color: #1A130B;
  border-color: var(--accent-gold);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 11px;
}
.btn-block {
  width: 100%;
}

/* --- Main Layout Grid --- */
.app-main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* --- Sidebar (Left Panel) --- */
.app-sidebar {
  width: 290px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
}
.sidebar-header h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tag {
  font-size: 9px;
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: var(--border-radius-sm);
  text-transform: uppercase;
}

/* Catalog Tabs Navigation */
.catalog-tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-light);
  background-color: rgba(0,0,0,0.15);
}
.tab-btn {
  flex: 1;
  padding: 12px 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
  border-bottom: 2px solid transparent;
  min-width: 58px;
}
.tab-btn i {
  width: 16px;
  height: 16px;
}
.tab-btn:hover {
  color: var(--text-secondary);
}
.tab-btn.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
  background-color: rgba(255,255,255,0.01);
}

/* Catalog List */
.catalog-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* Catalog Furniture Card */
.catalog-card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 12px;
  cursor: grab;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}
.catalog-card:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.catalog-card:active {
  cursor: grabbing;
}
.card-icon-container {
  width: 38px;
  height: 38px;
  border-radius: var(--border-radius-sm);
  background-color: rgba(213, 167, 108, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(213, 167, 108, 0.15);
}
.card-icon-container i {
  width: 20px;
  height: 20px;
  color: var(--accent-gold);
}
.card-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.card-dimensions {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-light);
  background-color: rgba(0,0,0,0.1);
}
.tip-card {
  display: flex;
  gap: 8px;
}
.tip-icon {
  width: 16px;
  height: 16px;
  color: var(--accent-gold);
  flex-shrink: 0;
  margin-top: 2px;
}
.tip-text {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* --- Viewport (Central Area) --- */
.viewport-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  position: relative;
}

/* Viewport Toolbar */
.viewport-toolbar {
  height: 50px;
  border-bottom: 1px solid var(--border-light);
  background-color: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 5;
}
.view-mode-selector {
  display: flex;
  gap: 4px;
}
.contextual-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.contextual-controls.hidden {
  display: none;
}
.divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-light);
  margin: 0 8px;
}

/* Toggle Switch Control */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.toggle-switch input {
  display: none;
}
.toggle-switch .slider {
  width: 32px;
  height: 16px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  position: relative;
  transition: all var(--transition-fast);
  margin-right: 8px;
}
.toggle-switch .slider::after {
  content: '';
  width: 10px;
  height: 10px;
  background-color: var(--text-muted);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: all var(--transition-fast);
}
.toggle-switch input:checked + .slider {
  background-color: var(--accent-gold);
}
.toggle-switch input:checked + .slider::after {
  left: 18px;
  background-color: #1A130B;
}
.toggle-label {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Canvas Viewports Canvas */
.canvas-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.view-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  background-color: #0d1014;
}
.view-wrapper.active {
  opacity: 1;
  pointer-events: auto;
}

/* 2D Canvas Style */
#canvas_2d {
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
}
.canvas-instructions {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(19, 23, 28, 0.85);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  padding: 6px 14px;
  font-size: 10px;
  color: var(--text-secondary);
  pointer-events: none;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 6px;
}
.canvas-instructions i {
  width: 12px;
  height: 12px;
  color: var(--accent-gold);
}

/* 3D Container */
#container_3d {
  width: 100%;
  height: 100%;
  background-color: #0A0D10;
}
.walkthrough-overlay {
  position: absolute;
  bottom: 20px;
  left: 20px;
  pointer-events: none;
  z-index: 8;
  max-width: 280px;
}
.walkthrough-overlay.hidden {
  display: none;
}
.walk-card {
  background-color: rgba(19, 23, 28, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--accent-gold);
  border-radius: var(--border-radius-md);
  padding: 14px;
  box-shadow: var(--shadow-lg);
}
.walk-card h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-gold);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.walk-card h3 i {
  width: 14px;
  height: 14px;
}
.walk-card ul {
  list-style: none;
}
.walk-card li {
  font-size: 10px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.key {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-primary);
}

/* --- Inspector Sidebar (Right Panel) --- */
.app-inspector {
  width: 320px;
  background-color: var(--bg-secondary);
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.inspector-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
}
.inspector-header h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inspector-section {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.inspector-section.hidden {
  display: none;
}

/* Active Item Card */
.selected-item-card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-glow);
  border-radius: var(--border-radius-md);
  padding: 12px;
  box-shadow: var(--shadow-glow);
}
.item-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.card-icon {
  width: 22px;
  height: 22px;
  color: var(--accent-gold);
}
.selected-item-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.item-cat-badge {
  font-size: 9px;
  color: var(--text-secondary);
  background-color: rgba(255, 255, 255, 0.05);
  padding: 1px 6px;
  border-radius: 3px;
  display: inline-block;
  margin-top: 4px;
}

/* Inspector Controls Layout */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 16px;
}
.group-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.slider-row label {
  font-size: 11px;
  color: var(--text-secondary);
}
.num-val {
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-family);
}
.slider-row input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-tertiary);
  outline: none;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-gold);
  cursor: pointer;
  transition: transform 0.1s ease;
}
.slider-row input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.pos-fields {
  display: flex;
  gap: 12px;
}
.field-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field-col label {
  font-size: 10px;
  color: var(--text-muted);
}
.field-col input[type="number"] {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  padding: 6px;
  font-size: 12px;
  outline: none;
  font-family: var(--font-family);
}
.field-col input[type="number"]:focus {
  border-color: var(--accent-gold);
}

/* Material Color Swatches */
.material-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: all var(--transition-fast);
}
.swatch.active {
  border-color: var(--text-primary);
  transform: scale(1.15);
  box-shadow: 0 0 8px var(--accent-gold);
}
.swatch::after {
  content: attr(title);
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--bg-primary);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}
.swatch:hover::after {
  opacity: 1;
}
.material-name {
  font-size: 10px;
  color: var(--text-muted);
}

.inspector-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* --- Global Settings UI (No Selection) --- */
.property-info-card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.property-info-card h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-gold);
}
.prop-stat {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.prop-stat i {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}
.designer-badge {
  font-size: 9px;
  font-weight: 600;
  color: #1A130B;
  background-color: var(--accent-gold);
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
}

.dropdown-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dropdown-row label {
  font-size: 11px;
  color: var(--text-secondary);
}
.select-field {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 12px;
  outline: none;
  font-family: var(--font-family);
  cursor: pointer;
  width: 100%;
}
.select-field:focus {
  border-color: var(--accent-gold);
}

/* Budget Calculator Panel */
.budget-panel {
  background-color: rgba(0,0,0,0.15);
  border-radius: var(--border-radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--border-light);
}
.budget-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.budget-summary .lbl {
  font-size: 11px;
  color: var(--text-secondary);
}
.budget-summary .val {
  font-size: 13px;
  font-weight: 700;
}
.budget-summary .val-cost {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-success);
}

.placed-items-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}
.empty-list-msg {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 0;
}
.placed-item-row {
  background-color: rgba(255,255,255,0.02);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  transition: all var(--transition-fast);
  cursor: pointer;
}
.placed-item-row:hover {
  background-color: rgba(213, 167, 108, 0.05);
  border-color: var(--accent-gold);
}
.placed-item-info {
  display: flex;
  flex-direction: column;
}
.placed-item-row .name {
  font-weight: 600;
  color: var(--text-primary);
}
.placed-item-row .cost {
  color: var(--text-secondary);
}
.placed-item-del-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
}
.placed-item-del-btn:hover {
  color: var(--accent-danger);
  background-color: rgba(255,90,121,0.1);
}
.placed-item-del-btn i {
  width: 12px;
  height: 12px;
}
