/* SHINHA Form Tools — Color Tools */

/* Theme color presets */
.theme-tools__title {
  font-size: 13px;
  font-weight: 700;
  color: #1a4b8c;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.theme-tools__hint {
  font-size: 12px;
  color: #5a6270;
  margin: 0 0 12px;
  line-height: 1.4;
}

.theme-tools__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.theme-tools__preset {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 2px solid #eef0f4;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #333;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.theme-tools__preset:hover {
  border-color: #ccd2da;
  background: #f8f9fb;
}

.theme-tools__preset.is-active {
  border-color: #1a4b8c;
  background: #f0f6ff;
}

.theme-tools__swatch {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-tools__swatch-row {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.theme-tools__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.theme-tools__name {
  line-height: 1.3;
}

.color-tools__hint {
  font-size: 12px;
  color: #5a6270;
  margin: 0 0 12px;
  line-height: 1.4;
}

.color-tools__item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid #eef0f4;
}

.color-tools__item:last-child {
  border-bottom: none;
}

.color-tools__label {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

.color-tools__inputs {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.color-tools__picker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #5a6270;
  cursor: pointer;
}

.color-tools__picker input[type="color"] {
  width: 36px;
  height: 28px;
  padding: 0;
  border: 1px solid #ccd2da;
  border-radius: 4px;
  cursor: pointer;
  background: none;
}

.color-tools__picker input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.color-tools__picker input[type="color"]::-webkit-color-swatch {
  border-radius: 2px;
  border: none;
}

.color-tools__reset {
  font-size: 11px;
  padding: 4px 10px;
  border: 1px solid #ccd2da;
  border-radius: 4px;
  background: #fff;
  color: #5a6270;
  cursor: pointer;
  font-family: inherit;
}

.color-tools__reset:hover {
  background: #f0f2f5;
}

/* ── Appearance drawer ── */
body.drawer-open,
body.modal-open {
  overflow: hidden;
}

.appearance-drawer {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  justify-content: flex-end;
}

.appearance-drawer[hidden] {
  display: none !important;
}

.appearance-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 26, 64, 0.45);
  cursor: pointer;
}

.appearance-drawer__panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
  animation: drawerSlideIn 0.25s ease;
}

@keyframes drawerSlideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.appearance-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eef0f4;
  flex-shrink: 0;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}

.appearance-drawer__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #1a4b8c;
}

.appearance-drawer__close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #f0f2f5;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #333;
}

.appearance-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 24px;
  -webkit-overflow-scrolling: touch;
}

.appearance-drawer__desc {
  font-size: 13px;
  color: #5a6270;
  margin: 0 0 10px;
  line-height: 1.5;
}

.appearance-drawer__beta-note {
  font-size: 11px;
  color: #888;
  margin: 0 0 14px;
  line-height: 1.4;
  padding: 8px 10px;
  background: #f8f9fb;
  border-radius: 6px;
  border-left: 3px solid #e8ecf1;
}

.appearance-drawer__remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 16px;
  cursor: pointer;
}

.appearance-drawer__remember input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.appearance-drawer__section {
  margin-bottom: 20px;
}

.appearance-drawer__footer {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #eef0f4;
  background: #fff;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.appearance-drawer__footer .btn {
  flex: 1;
  min-height: 44px;
}

.appearance-section__title {
  font-size: 13px;
  font-weight: 700;
  color: #1a4b8c;
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.appearance-section__locked {
  font-size: 12px;
  color: #888;
}

.appearance-field {
  padding: 12px 0;
  border-bottom: 1px solid #eef0f4;
}

.appearance-field:last-child {
  border-bottom: none;
}

.appearance-field__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.appearance-field__label {
  font-size: 13px;
  font-weight: 700;
  color: #333;
}

.appearance-field__controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.appearance-field__select-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #5a6270;
}

.appearance-field__select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid #ccd2da;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.theme-tools__custom {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #eef0f4;
}

/* ── Tool modal (sample data) ── */
.tool-modal {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.tool-modal[hidden] {
  display: none !important;
}

.tool-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 26, 64, 0.5);
  cursor: pointer;
}

.tool-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

.tool-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #f0f2f5;
  font-size: 20px;
  cursor: pointer;
}

.tool-modal__title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: #1a4b8c;
  padding-right: 32px;
}

.tool-modal__desc {
  margin: 0 0 20px;
  font-size: 14px;
  color: #5a6270;
  line-height: 1.5;
}

.tool-modal__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tool-modal__actions .btn {
  flex: 1;
  min-width: 120px;
  min-height: 42px;
}

@media (max-width: 767px) {
  .appearance-drawer {
    align-items: flex-end;
  }

  .appearance-drawer__panel {
    max-width: none;
    height: 92vh;
    height: 92dvh;
    border-radius: 16px 16px 0 0;
    animation: sheetSlideUp 0.25s ease;
  }

  @keyframes sheetSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .appearance-field__controls {
    grid-template-columns: 1fr;
  }

  body.drawer-open .contact-widget {
    z-index: 10000;
  }

  .tool-modal__dialog {
    max-width: none;
    border-radius: 12px 12px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }
}

/* ── Mobile tool sheets (Stage 1.7) ── */
body.is-tool-sheet-open {
  overflow: hidden;
}

.tool-sheet {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.tool-sheet[hidden] {
  display: none !important;
}

.tool-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 26, 64, 0.5);
  cursor: pointer;
}

.tool-sheet__panel {
  position: relative;
  width: 100%;
  max-height: 92vh;
  max-height: 92dvh;
  background: #fff;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
  animation: sheetSlideUp 0.25s ease;
}

.tool-sheet__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid #eef0f4;
  flex-shrink: 0;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}

.tool-sheet__title {
  flex: 1;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #1a4b8c;
}

.tool-sheet__close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #f0f2f5;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #333;
  flex-shrink: 0;
}

.tool-sheet__back {
  border: none;
  background: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #1a4b8c;
  cursor: pointer;
  padding: 6px 0;
  flex-shrink: 0;
}

.tool-sheet__quick {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid #eef0f4;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.tool-sheet__quick .btn {
  flex: 1;
  min-width: calc(50% - 4px);
  min-height: 44px;
}

.tool-sheet__section-label {
  padding: 10px 16px 4px;
  font-size: 12px;
  font-weight: 700;
  color: #5a6270;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.tool-sheet__body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 16px;
  -webkit-overflow-scrolling: touch;
}

.tool-sheet__body--appearance {
  padding-top: 4px;
}

.tool-sheet__footer {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #eef0f4;
  background: #fff;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.tool-sheet__footer .btn {
  flex: 1;
  min-height: 44px;
}

/* #data-sheet only: neutralize sticky chrome + nested form scroll on mobile */
@media (max-width: 767px) {
  #data-sheet .tool-sheet__header {
    position: relative;
    top: auto;
  }

  #data-sheet .tool-sheet__footer {
    position: relative;
    bottom: auto;
    top: auto;
  }

  #data-sheet .tool-sheet__body > .form-panel__content,
  #data-sheet .tool-sheet__body > #form-panel-content {
    flex: none;
    overflow: visible;
    height: auto;
    max-height: none;
    min-height: 0;
  }
}

.appearance-sheet-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.appearance-sheet-menu__btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border: 2px solid #eef0f4;
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.appearance-sheet-menu__btn:active {
  border-color: #1a4b8c;
  background: #f0f6ff;
}

.appearance-sheet-menu__label {
  font-size: 15px;
  font-weight: 700;
  color: #1a4b8c;
}

.appearance-sheet-menu__hint {
  font-size: 12px;
  color: #5a6270;
  line-height: 1.4;
}

.appearance-sheet-view[hidden] {
  display: none !important;
}

.appearance-sheet__note {
  margin-top: 12px;
}

.appearance-sheet__remember {
  margin-top: 12px;
}

.appearance-accordion__item {
  border: 1px solid #eef0f4;
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.appearance-accordion__summary {
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  color: #333;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.appearance-accordion__summary::-webkit-details-marker {
  display: none;
}

.appearance-accordion__summary::after {
  content: "▾";
  font-size: 12px;
  color: #888;
  transition: transform 0.15s;
}

.appearance-accordion__item:not([open]) .appearance-accordion__summary::after {
  transform: rotate(-90deg);
}

.appearance-accordion__body {
  padding: 0 14px 14px;
  border-top: 1px solid #eef0f4;
}

.appearance-accordion__body .appearance-field__header {
  display: none;
}

@media (min-width: 768px) {
  .tool-sheet {
    display: none !important;
  }
}
