/* =====================================================================
   style.css — конструктор мебели «Эко-Дизайн»
   Цвета: #302e2b (интерфейс), #2b5a5b (акцент), #aca49e (площадка)
   ===================================================================== */

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

:root {
  --bg: #302e2b;
  --bg-panel: #37342f;
  --bg-block: #3f3b35;
  --bg-input: #272522;
  --border: #4d4842;
  --border-soft: #43403a;
  --text: #f1eee9;
  --text-dim: #a9a29a;
  --accent: #2b5a5b;
  --accent-hover: #36716f;
  --stage: #aca49e;
  --danger: #8d423c;
  --danger-hover: #a44e47;
  --radius: 8px;
  --site-h: 90px;
  --header-h: 58px;
  --panel-w: 330px;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding-top: var(--site-h);
  -webkit-tap-highlight-color: transparent;
}

/* ================= ШАПКА САЙТА ================= */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--site-h);
  z-index: 100;
  display: flex;
  align-items: center;
  background: rgba(30, 30, 30, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.site-header .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 18px;
  gap: 16px;
}

.site-header .logo img {
  height: 60px;
  width: auto;
  display: block;
}

.site-header nav {
  display: flex;
  align-items: center;
}

.site-header nav a {
  color: #fff;
  text-decoration: none;
  margin-left: 18px;
  font-family: "Times New Roman", Georgia, serif;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
  transition: color 0.3s;
}

.site-header nav a:hover {
  color: #c4b7a6;
}

.site-header nav a.nav-constructor {
  color: #c4b7a6;
  border-bottom: 2px solid #2b5a5b;
  padding-bottom: 3px;
}

.site-header nav a.order-btn {
  background: #c4b7a6;
  color: #1a2a32;
  padding: 8px 18px;
  border-radius: 50px;
  font-family: Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.site-header nav a.order-btn:hover {
  background: #d6c9b8;
  color: #1a2a32;
}

.site-header .burger-menu {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 21px;
  cursor: pointer;
  flex: 0 0 auto;
}

.site-header .burger-menu span {
  display: block;
  height: 3px;
  width: 100%;
  background: #fff;
  border-radius: 3px;
  transition: all 0.3s ease;
}

.site-header .burger-menu.active span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.site-header .burger-menu.active span:nth-child(2) {
  opacity: 0;
}

.site-header .burger-menu.active span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

@media (max-width: 1200px) {
  .site-header nav a {
    font-size: 13px;
    margin-left: 11px;
    letter-spacing: 0.4px;
  }

  .site-header nav a.order-btn {
    font-size: 13px;
    padding: 7px 14px;
  }
}

.hidden {
  display: none !important;
}

/* ================= ШАПКА ================= */
.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 14px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  height: 42px;
  width: auto;
  display: block;
  background: #ffffff;
  border-radius: 999px;
  padding: 2px 8px;
  flex: 0 0 auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ================= КНОПКИ ================= */
.btn {
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 15px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background: #4a453e;
  border-color: #5b554d;
}

.btn:active {
  transform: translateY(1px);
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.btn-accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: #d5918c;
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger-hover);
}

.btn-sm {
  padding: 7px 11px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
  padding: 13px;
  font-size: 15px;
}

.btn-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.modal-card-wide {
  max-width: 760px;
}

.info-body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

.info-body h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #6fb3ae;
  margin: 16px 0 6px;
}

.info-body h4:first-child {
  margin-top: 0;
}

.info-body p {
  color: var(--text-dim);
  margin-bottom: 6px;
}

.info-body ul {
  margin: 4px 0 8px 18px;
  color: var(--text-dim);
}

.info-body li {
  margin-bottom: 4px;
}

.info-body b {
  color: var(--text);
}

/* ================= КАРКАС ================= */
.app-main {
  display: grid;
  grid-template-columns: var(--panel-w) 1fr;
  flex: 1 1 auto;
  min-height: 0;
}

/* ================= ПАНЕЛЬ ================= */
.panel {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}

.panel::-webkit-scrollbar {
  width: 8px;
}

.panel::-webkit-scrollbar-thumb {
  background: #55504a;
  border-radius: 4px;
}

.group {
  background: var(--bg-block);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}

.group-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.row:last-child {
  margin-bottom: 0;
}

.row > span {
  color: var(--text-dim);
  font-size: 13px;
  flex: 1 1 auto;
}

.row-check span {
  color: var(--text);
}

.row-readonly input {
  color: var(--text-dim);
}

/* ================= ПОЛЯ ================= */
input[type="text"],
input[type="number"],
input[type="tel"],
input[type="email"],
select,
textarea {
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 9px;
  width: 132px;
  flex: 0 0 auto;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-hover);
}

select {
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 14px) 15px, calc(100% - 9px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 24px;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-hover);
  cursor: pointer;
  flex: 0 0 auto;
}

input[type="color"] {
  width: 48px;
  height: 32px;
  padding: 2px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  flex: 0 0 auto;
}

input[type="range"] {
  width: 132px;
  accent-color: var(--accent-hover);
  cursor: pointer;
  flex: 0 0 auto;
}

.hint {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-dim);
  margin-top: 8px;
}

.panel-send {
  display: none;
  padding: 4px 0 8px;
}

/* ================= СЦЕНА ================= */
.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--stage);
}

.stage-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.tab {
  font-family: inherit;
  font-size: 13px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 9px 20px;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--text);
  background: var(--bg-block);
  border-color: var(--border);
  font-weight: 600;
}

.stage-view {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#canvas2d {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#canvas3d {
  width: 100%;
  height: 100%;
}

#canvas3d canvas {
  display: block;
  touch-action: none;
}

.stage-info {
  flex: 0 0 auto;
  padding: 9px 14px;
  font-size: 13px;
  color: #3b3835;
  background: #9c948d;
  border-top: 1px solid #8d857e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================= КНОПКА ПАНЕЛИ (моб.) ================= */
.btn-sheet {
  display: none;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(64px + env(safe-area-inset-bottom));
  z-index: 60;
  padding: 13px 26px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

.sheet-handle {
  display: none;
}

/* ================= МОДАЛЬНОЕ ОКНО ================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 19, 18, 0.72);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
}

.modal-title {
  font-size: 19px;
  margin-bottom: 6px;
}

.modal-sub {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.45;
  margin-bottom: 16px;
}

.send-form .field {
  display: block;
  margin-bottom: 12px;
}

.send-form .field > span {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 5px;
}

.send-form input[type="text"],
.send-form input[type="tel"],
.send-form input[type="email"],
.send-form textarea {
  width: 100%;
  padding: 11px 12px;
  font-size: 14px;
}

.send-form textarea {
  resize: vertical;
  min-height: 66px;
}

/* капча (файл captcha.php приходит со своими inline-стилями) */
.captcha-wrap .captcha-block {
  background: #f6f4f1 !important;
  border: 1px solid #cfc8c0 !important;
  color: #2b2926 !important;
  border-radius: 10px !important;
}

.captcha-wrap .captcha-block label {
  color: #2b2926 !important;
  font-size: 13px !important;
}

.captcha-wrap .captcha-block input {
  color: #2b2926;
  background: #ffffff;
  border: 1px solid #bdb6ad;
  border-radius: 6px;
  padding: 10px;
  font-size: 16px;
}

.captcha-wrap .captcha-block button {
  background: #ffffff !important;
  border: 1px solid #bdb6ad !important;
  color: #2b2926 !important;
  border-radius: 6px !important;
  padding: 9px 14px !important;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.modal-actions .btn {
  padding: 12px 18px;
  font-size: 14px;
}

.send-result {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.45;
}

.send-result.ok {
  color: #8fd0a8;
}

.send-result.err {
  color: #e5a09a;
}

/* ================= МОБИЛЬНАЯ ВЕРСТКА ================= */
@media (max-width: 1150px) {
  .site-header .burger-menu {
    display: flex;
  }

  .site-header nav {
    position: fixed;
    top: var(--site-h);
    left: 0;
    width: 100%;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    background: rgba(20, 20, 20, 0.97);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateY(-110%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 150;
  }

  .site-header nav.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .site-header nav a {
    margin: 10px 0;
    font-family: Arial, sans-serif;
    font-size: 16px;
    text-transform: none;
    letter-spacing: 0;
  }

  .site-header nav a.order-btn {
    margin: 8px 0;
    padding: 9px 22px;
    font-size: 15px;
  }
}

@media (max-width: 900px) {
  :root {
    --site-h: 60px;
  }

  html,
  body {
    overflow: hidden;
  }

  .site-header .logo img {
    height: 34px;
  }

  .site-header .burger-menu {
    display: flex;
  }

  .site-header nav {
    position: fixed;
    top: var(--site-h);
    left: 0;
    width: 100%;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    background: rgba(20, 20, 20, 0.97);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateY(-110%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 150;
  }

  .site-header nav.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .site-header nav a {
    margin: 10px 0;
    font-family: Arial, sans-serif;
    font-size: 16px;
    text-transform: none;
    letter-spacing: 0;
  }

  .site-header nav a.order-btn {
    margin: 8px 0;
    padding: 9px 22px;
    font-size: 15px;
  }

  .app-header {
    height: auto;
    min-height: 54px;
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 8px;
  }

  .brand-logo {
    height: 32px;
  }

  .brand-title {
    font-size: 13px;
  }

  .brand-sub {
    font-size: 10px;
  }

  .toolbar {
    gap: 6px;
  }

  .toolbar .btn {
    padding: 8px 10px;
    font-size: 12px;
  }

  /* только ключевые кнопки в шапке */
  .toolbar #btnSave,
  .toolbar #btnOpen,
  .toolbar #btnReset {
    display: none;
  }

  .app-main {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
  }

  .stage {
    height: 100%;
  }

  .stage-info {
    padding: 7px 10px;
    font-size: 11.5px;
  }

  .btn-sheet {
    display: block;
  }

  /* панель превращается в нижний лист */
  .panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    max-height: 76dvh;
    padding: 6px 12px calc(18px + env(safe-area-inset-bottom));
    border-right: none;
    border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.45);
    transform: translateY(102%);
    transition: transform 0.28s ease;
    overscroll-behavior: contain;
  }

  body.sheet-open .panel {
    transform: translateY(0);
  }

  body.sheet-open .btn-sheet {
    display: none;
  }

  .sheet-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 24px;
    cursor: grab;
    touch-action: none;
  }

  .sheet-handle span {
    display: block;
    width: 52px;
    height: 5px;
    border-radius: 3px;
    background: #6d675f;
  }

  .panel-send {
    display: block;
  }

  .row > span {
    font-size: 12.5px;
  }

  input[type="text"],
  input[type="number"],
  select,
  input[type="range"] {
    width: 118px;
  }

  input[type="tel"],
  input[type="email"],
  textarea {
    width: 118px;
  }

  .modal-card {
    max-width: none;
    border-radius: 16px 16px 0 0;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 94dvh;
  }

  .modal {
    align-items: flex-end;
    padding: 0;
  }
}

/* ---------- Окно «Заказ отправлен» ---------- */
.send-success {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(20, 18, 16, 0.55);
  opacity: 0;
  transition: opacity .35s ease;
}
.send-success.show { opacity: 1; }
.send-success-card {
  width: 100%;
  max-width: 420px;
  padding: 26px 32px 24px;
  text-align: center;
  color: #f1eee9;
  background: #302e2b;
  border: 1px solid #4d4842;
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
  transform: translateY(12px) scale(.97);
  transition: transform .35s ease;
}
.send-success.show .send-success-card { transform: translateY(0) scale(1); }
.send-success-check {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #2b5a5b;
  color: #fff;
  font-size: 30px;
  line-height: 56px;
}
.send-success-title {
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 600;
}
.send-success-text {
  font-size: 14px;
  line-height: 1.55;
  color: #d8d2c9;
}
.send-success-text b { color: #fff; }
@media (max-width: 520px) {
  .send-success-card { padding: 22px 20px; }
}

/* ---------- Вкладки материала ---------- */
.material-tabs {
  display: flex;
  gap: 6px;
}
.material-tab {
  flex: 1;
  padding: 9px 6px;
  font-size: 12px;
  color: #d8d2c9;
  background: #35322e;
  border: 1px solid #4d4842;
  border-radius: 7px;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.material-tab:hover { background: #3d3934; }
.material-tab.active {
  background: #2b5a5b;
  border-color: #3c7d7e;
  color: #fff;
  font-weight: 600;
}
