:root{
  --brown-dark:#3b2a1a;
  --brown-main:#6f4e37;
  --brown-light:#c4a484;
  --panel-border:#8a5a3c;
}

/* =========================
   STATIC BUTTON STYLE
   ========================= */
.btn-static,
.btn-static:hover,
.btn-static:focus,
.btn-static:active,
.btn-static.active,
.btn-static[aria-expanded="true"]{
  background-color: transparent !important;
  color: #6c757d !important;
  border-color: #ced4da !important;
  box-shadow: none !important;
}

/* =========================
   COLOR SWATCHES (deduped)
   ========================= */
.color-swatch-wrap{
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  width: 100px;
  text-align: center;
  margin: 5px;
}

.color-swatch{
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #ccc;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  margin: 0 auto;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.color-swatch:hover{
  transform: translateY(-2px);
  box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.color-swatch.selected{
  border: 3px solid #0d6efd;
  box-shadow: 0 0 0 3px rgba(13,110,253,.35);
}

.color-swatch-label{
  font-size: 11px;
  margin-top: 4px;
  word-break: break-word;
}

/* =========================
   VIEWER LAYOUT (FIXED, no height conflict)
   - wrapper does NOT force 70vh (that caused tall gray area)
   - model height is controlled by #mesh_viewer
   ========================= */
.viewer-wrapper{
  position: relative;
  width: 100%;
  background: #f0f0f0;
  overflow: visible; /* allows mobile toolbar below model */
}

/* model-viewer sizing (single source of truth) */
#mesh_viewer{
  display: block;
  width: 100%;
  height: 800px;          /* desktop */
  background: #f0f0f0;
}

/* mobile model height (set your final value here) */
@media (max-width: 1200px){
  #mesh_viewer{
    height: 400px;        /* <-- choose: 350 / 400 / 500 etc. */
  }

  .saved-models-row .saved-setup-card{
    flex: 0 0 180px;
  }
}

/* If you ever target the tag directly */
.viewer-wrapper model-viewer{
  width: 100%;
  display: block;
}

/* =========================
   TOP VIEW BUTTONS (deduped)
   ========================= */
.viewer-controls-top{
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  gap: 8px;
}

.viewer-controls-top .view-btn{
  background: rgba(255,255,255,0.85);
  border: 1px solid #ccc;
  padding: 4px 10px;
  font-size: 13px;
  border-radius: 5px;
  cursor: pointer;
  backdrop-filter: blur(5px);
}

.viewer-controls-top .view-btn:hover{
  background: #f0f0f0;
}

/* =========================
   RIGHT TOOL BUTTONS (desktop overlay)
   ========================= */
.viewer-tools-right{
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tool-icon-btn{
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(255,255,255,0.85);
  border: 1px solid #ccc;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
  backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.tool-icon-btn:hover{ background: #f0f0f0; }

.tool-icon{
  font-size: 20px;
  line-height: 1;
  color: var(--brown-main);
}

.tool-label{
  font-size: 10px;
  margin-top: 4px;
  letter-spacing: .3px;
  font-weight: 700;
  color: var(--brown-dark);
}

/* =========================
   MOBILE TOOLBAR (below model)
   Use: <div class="mobile-toolbar d-lg-none">...</div>
   ========================= */
.mobile-toolbar{
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-top: 1px solid rgba(0,0,0,.08);
  padding: .25rem;
}

@media (max-width: 420px){
  .mobile-toolbar .btn{
    padding-left: .35rem;
    padding-right: .35rem;
  }
}

/* =========================
   PANELS (side-panel)
   ========================= */
.side-panel{
  position: fixed;
  top: 1.5vh;
  bottom: 1.5vh;

  width: calc(100% - 24px);
  right: calc(-1 * (100% - 24px));

  background: #fff;
  color: #111;

  border: 2px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: -10px 0 24px rgba(0,0,0,.25);

  transition: right .35s ease-in-out;

  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000001;
}

.side-panel.active{ right: 12px; }

@media (min-width: 992px){
  .side-panel{
    width: 475px;
    right: -475px;
  }
  .side-panel.active{ right: 18px; }
}

.panel-header{
  background: linear-gradient(90deg, var(--brown-main), var(--brown-dark));
  color: #fff;
  padding: 14px 16px;
  font-weight: 800;
  letter-spacing: .2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-body{
  padding: 16px;
  flex: 1;
  overflow-y: auto;
}

.panel-footer{
  padding: 14px 16px;
  border-top: 1px solid #eee;
  background: #fff;
}

.panel-close-top{
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,.55);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.panel-close-top:hover{ background: rgba(255,255,255,.12); }

.panel-close-bottom{
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 2px solid var(--brown-main);
  color: var(--brown-dark);
  font-weight: 700;
  cursor: pointer;
}

.panel-close-bottom:hover{
  background: var(--brown-light);
  border-color: var(--brown-dark);
  color: #2b1c12;
}

/* =========================
   OPTION CARDS (generic)
   ========================= */
.option-card{
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.option-card:hover{
  transform: translateY(-1px);
  box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,.1);
}

.option-card.selected{
  outline: 2px solid #0d6efd;
  box-shadow: 0 0 0 0.25rem rgba(13,110,253,.25);
}

.option-card img{
  max-height: 100px;
  object-fit: contain;
}

/* =========================
   SIDE OPTIONS GRID
   ========================= */
.side-option-wrap{
  width: 16.66%;
  padding: 4px;
}

@media (max-width: 768px){
  .side-option-wrap{
    width: 33.33%;
  }
}

.side-option-card{
  height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.side-option-card .side-option-img{
  max-height: none !important;
  width: 100%;
  height: 90px;
  padding: 6px;
  object-fit: contain;
}

/* Side additions */
.side-addition-toggle,
.side-addition-card{
  height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.side-addition-toggle .card-body,
.side-addition-card .card-body{
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.side-addition-card small,
.side-addition-toggle small{ font-size: 0.9rem; }

.side-addition-toggle span{
  font-size: 2rem;
  line-height: 1;
}

.viewer-bottom-panel{
  background: #f0f0f0;
  border-top: 1px solid rgba(0,0,0,0.08);
}

/* =========================
   FURNITURE
   ========================= */
.furniture-card{
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 150px;
  overflow: hidden;
}

.furniture-img-wrapper{
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
}

.furniture-img{
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.furniture-label{
  padding: 6px 0 4px;
  text-align: center;
}