﻿:root {
  --bg: #f4f6eb;
  --panel: #ffffff;
  --ink: #1b1c1d;
  --accent: #1e6e54;
  --accent-2: #f2a03d;
  --border: #d6dbc9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 10%, #fff5de 0%, transparent 32%),
    radial-gradient(circle at 90% 20%, #d7f5dd 0%, transparent 30%),
    var(--bg);
}

.layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 28px rgba(25, 30, 25, 0.06);
}

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

.history-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: #f9faf7;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 12px;
}

.history-icon {
  font-size: 15px;
}

.panel-settings {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  position: sticky;
  top: 24px;
}

.settings-scroll {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
  overflow: auto;
  padding-right: 6px;
}

.settings-scroll > label {
  margin: 0;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 40px;
  gap: 8px;
  align-items: center;
}

.reset-param {
  min-height: 40px;
  width: 40px;
  padding: 0;
  border-radius: 10px;
  font-size: 18px;
  line-height: 1;
  background: #f2f6ee;
  color: #294236;
  border: 1px solid var(--border);
}

.reset-inline {
  margin-left: auto;
}

.settings-actions {
  margin-top: 12px;
  padding-top: 12px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, #ffffff 30%);
  backdrop-filter: blur(2px);
}

.config-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.config-actions button {
  min-height: 42px;
  font-size: 14px;
}

.config-actions-single {
  grid-template-columns: 1fr;
}

h1,
h2 {
  margin: 0;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.tab-btn {
  border: 1px solid var(--border);
  background: #f9faf7;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
}

.tab-btn.active {
  border-color: transparent;
  background: linear-gradient(120deg, var(--accent), #2b8e6c);
  color: #ffffff;
}

.tab-content {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fcfdf9;
}

.preview-wrap {
  margin-top: 16px;
}

.preview-wrap h2 {
  margin-bottom: 10px;
  font-size: 18px;
}

.preview-box {
  min-height: 280px;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background-image:
    linear-gradient(45deg, #f3f3f3 25%, transparent 25%),
    linear-gradient(-45deg, #f3f3f3 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f3f3f3 75%),
    linear-gradient(-45deg, transparent 75%, #f3f3f3 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

.preview-box img {
  max-width: 100%;
  max-height: 400px;
  display: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.full {
  grid-column: 1 / -1;
}

.input-hint {
  grid-column: 1 / -1;
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
}

.input-hint.error {
  color: #b23737;
}

.input-hint.info {
  color: #246244;
}

.input-error {
  border-color: #d04646 !important;
  box-shadow: 0 0 0 2px rgba(208, 70, 70, 0.16);
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

input,
select,
textarea,
button {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.checkbox-row {
  flex-direction: row;
  align-items: center;
}

button {
  margin-top: 0;
  background: linear-gradient(120deg, var(--accent), #2b8e6c);
  color: #fff;
  border: none;
  font-weight: 700;
  cursor: pointer;
}

#generateBtn {
  width: 100%;
  min-height: 50px;
}

button:hover {
  filter: brightness(1.05);
}

button,
.tab-btn,
select,
input[type='checkbox'],
input[type='color'] {
  cursor: pointer;
}

.status {
  margin-top: 10px;
  min-height: 22px;
  color: #37483f;
}

.seo-content {
  max-width: 1240px;
  margin: 0 auto 24px;
  padding: 0 24px 24px;
}

.seo-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 28px rgba(25, 30, 25, 0.04);
}

.seo-box h2,
.seo-box h3 {
  margin: 0 0 8px;
}

.seo-box p {
  margin: 0 0 14px;
  color: #353835;
  line-height: 1.55;
}

.seo-box p:last-child {
  margin-bottom: 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 18, 19, 0.52);
}

.modal-card {
  position: relative;
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  margin: 12px auto;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 12px 30px rgba(20, 20, 20, 0.24);
}

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

#historyCloseBtn {
  width: 40px;
  min-height: 40px;
  border-radius: 999px;
  padding: 0;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafcf8;
  padding: 10px;
}

.history-item p {
  margin: 0 0 8px;
  color: #3c3f3b;
}

.history-meta {
  font-size: 13px;
  color: #5b5f59;
}

.history-item button {
  min-height: 38px;
  padding: 8px 10px;
}

@media (max-width: 940px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 14px;
    border-radius: 12px;
  }

  .panel-settings {
    max-height: none;
    position: static;
    top: auto;
  }

  .settings-scroll {
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
    padding-right: 0;
  }

  .settings-actions {
    position: static;
    background: transparent;
    backdrop-filter: none;
    margin-top: 10px;
    padding-top: 8px;
  }

  .tabs {
    gap: 8px;
  }

  .panel-head {
    flex-wrap: wrap;
  }

  .history-btn {
    width: 100%;
    justify-content: center;
  }

  .tab-btn {
    width: calc(50% - 4px);
    text-align: center;
    padding: 10px 8px;
  }

  .preview-box {
    min-height: 220px;
  }

  .seo-content {
    padding: 0 14px 14px;
    margin-bottom: 12px;
  }

  .seo-box {
    padding: 14px;
    border-radius: 12px;
  }

  .config-actions {
    grid-template-columns: 1fr;
  }

  .modal-card {
    margin: 8px;
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 12px;
    padding: 10px;
  }
}
