/* ================== BASE ================== */
:root {
  --accent: #4b5563;
  --accent-strong: #1f2937;
  --accent-soft: rgba(75, 85, 99, 0.14);
  --accent-muted: #e5e7eb;
  --header-bg: linear-gradient(135deg, #111827, #4b5563);
  --panel-bg: #f4f5f7;
}

body[data-profile="1"] {
  --accent: #0f7a55;
  --accent-strong: #07553a;
  --accent-soft: rgba(15, 122, 85, 0.16);
  --accent-muted: #d8efe6;
  --header-bg: linear-gradient(135deg, #064e3b, #10b981);
  --panel-bg: #f0f8f4;
}

body[data-profile="2"] {
  --accent: #2563eb;
  --accent-strong: #1e3a8a;
  --accent-soft: rgba(37, 99, 235, 0.15);
  --accent-muted: #dbeafe;
  --header-bg: linear-gradient(135deg, #1e3a8a, #38bdf8);
  --panel-bg: #f1f7ff;
}

body[data-profile="3"] {
  --accent: #c2410c;
  --accent-strong: #7f1d1d;
  --accent-soft: rgba(194, 65, 12, 0.17);
  --accent-muted: #f7d8c8;
  --header-bg: linear-gradient(135deg, #7f1d1d, #f97316);
  --panel-bg: #fff3ed;
}

body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  overflow: hidden;
  min-width: 1000px;
  background: #eceff1;
  transition: background 0.25s ease;
}

/* ================== HEADER ================== */
.header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;

  height: 55px;
  background: var(--header-bg);

  display: grid;
  grid-template-columns: minmax(0, auto) minmax(280px, 1fr) minmax(0, auto);
  align-items: center;
  gap: 18px;

  padding: 0 20px;
  box-sizing: border-box;

  color: white;
  z-index: 20;
}

.logo {
  font-weight: bold;
  font-size: 16px;
  white-space: nowrap;
}

.header-left,
.header-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.suggestion-controls {
  --suggestion-control-gap: 8px;
  --suggestion-send-width: 140px;
  --suggestion-exit-width: 132px;
  --suggestion-total-width: calc(
    var(--suggestion-send-width) + var(--suggestion-exit-width) +
      var(--suggestion-control-gap)
  );
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  justify-self: center;
}

.suggestion-mode-btn {
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  color: white;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  box-sizing: border-box;
  width: var(--suggestion-total-width);
  min-width: var(--suggestion-total-width);
  padding: 8px 12px;
  transition: 0.2s;
  white-space: nowrap;
}

.suggestion-mode-btn:hover {
  background: white;
  color: var(--accent-strong);
}

.suggestion-mode-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.suggestion-active-controls {
  display: flex;
  align-items: center;
  gap: var(--suggestion-control-gap);
  width: var(--suggestion-total-width);
}

.suggestion-active-controls button {
  border: none;
  border-radius: 8px;
  box-sizing: border-box;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  transition: 0.2s;
  white-space: nowrap;
}

.suggestion-send-btn {
  background: #facc15;
  color: #1f2937;
  width: var(--suggestion-send-width);
}

.suggestion-send-btn:hover {
  background: #fde047;
}

.suggestion-exit-btn {
  background: rgba(255, 255, 255, 0.18);
  color: white;
  width: var(--suggestion-exit-width);
}

.suggestion-exit-btn:hover {
  background: white;
  color: var(--accent-strong);
}

@media (max-width: 1023px) {
  .header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .suggestion-controls {
    display: none;
  }
}

/* ================== SWITCHES ================== */
.profile-switch,
.gender-switch,
.side-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.switch {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.switch input {
  display: none;
}

.switch span {
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.2);
  transition: 0.2s;
}

.switch input:checked + span {
  background: white;
  color: var(--accent-strong);
  font-weight: 600;
}

/* ================== LEFT ================== */
.left {
  position: absolute;
  left: 0;
  top: 55px;
  bottom: 0;

  width: 50%;
  overflow-y: auto;
  padding: 15px;
  background: var(--panel-bg);

  box-sizing: border-box;
  transition:
    background 0.25s ease,
    opacity 0.18s ease,
    transform 0.18s ease;
}

.left.menu-transition-out {
  opacity: 0;
  transform: translateX(-14px);
}

.left.menu-transition-in {
  opacity: 1;
  transform: translateX(0);
}

/* ================== RESIZER ================== */
#resizer {
  position: absolute;
  top: 55px;
  width: 8px;
  height: calc(100% - 55px);
  cursor: col-resize;
  background: transparent;
  z-index: 10;
}

#resizer::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  background: #cfcfcf;
}

#resizer:hover::after {
  background: #888;
}

/* ================== RIGHT ================== */
.right {
  position: absolute;
  top: 55px;
  bottom: 0;

  display: flex;
  flex-direction: column;

  padding: 12px;
  background: #1e1e1e;
  box-sizing: border-box;
}

/* ================== OUTPUT ================== */
#output {
  flex: 1;
  width: 100%;

  background: #111;
  color: #e8f5e9;

  padding: 14px;
  border-radius: 10px;

  font-family: monospace;
  line-height: 1.6;

  overflow-y: auto;
  white-space: pre-wrap;

  border: 1px solid #2a2a2a;
  box-sizing: border-box;
}

.suggestion-mode #output {
  border-color: #facc15;
  cursor: text;
}

.suggestion-block {
  position: relative;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: rgba(75, 85, 99, 0.1);
  box-shadow: inset 3px 0 0 var(--accent);
  padding: 10px 42px 10px 12px;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.suggestion-block + .suggestion-block {
  margin-top: 16px;
}

.suggestion-block:hover {
  background: var(--accent-soft);
}

.suggestion-block-text {
  min-height: 24px;
}

.output-remove-btn {
  position: absolute;
  top: 50%;
  right: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #e8f5e9;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transform: translateY(-50%);
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
  user-select: none;
}

.output-remove-btn:hover {
  border-color: var(--accent-muted);
  background: var(--accent);
  color: white;
}

.suggestion-mode .suggestion-block:hover {
  background: rgba(250, 204, 21, 0.08);
  border-color: rgba(250, 204, 21, 0.35);
}

.suggestion-mode .suggestion-block {
  border-color: #facc15;
  background: rgba(250, 204, 21, 0.06);
  box-shadow: inset 3px 0 0 #facc15;
}

.suggestion-mode .output-remove-btn {
  border-color: rgba(250, 204, 21, 0.45);
  color: #fef3c7;
}

.suggestion-mode .output-remove-btn:hover {
  background: #facc15;
  color: #1f2937;
}

.suggestion-block.suggestion-focus {
  border-color: #facc15;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.18);
}

/* ================== BUTTONS ================== */
.buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.buttons button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  transition: 0.2s;
}

#copyBtn {
  background: var(--accent);
  color: white;
}

#copyBtn:hover {
  background: var(--accent-strong);
}

#clearBtn {
  background: #ff5c5c;
  color: white;
}

#clearBtn:hover {
  background: #d94444;
}

/* ================== SUGGESTIONS ================== */
.suggestion-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.62);
  box-sizing: border-box;
}

.suggestion-dialog {
  width: min(620px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 8px;
  background: #f8fafc;
  color: #111827;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.suggestion-dialog form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}

.suggestion-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.suggestion-dialog h2 {
  margin: 0;
  font-size: 20px;
}

.suggestion-dialog p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 13px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: #e2e8f0;
  color: #0f172a;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.icon-button:hover {
  background: #cbd5e1;
}

.suggestion-dialog label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}

.optional-label {
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
}

.suggestion-dialog input,
.suggestion-dialog textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-sizing: border-box;
  color: #0f172a;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  padding: 10px 12px;
  resize: vertical;
}

.suggestion-dialog input[readonly],
.suggestion-dialog textarea[readonly] {
  background: #e2e8f0;
  color: #334155;
}

.suggestion-dialog input:focus,
.suggestion-dialog textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.suggestion-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.suggestion-actions button {
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  padding: 10px 14px;
}

#suggestionCancel {
  background: #e2e8f0;
  color: #0f172a;
}

#suggestionSubmit {
  background: var(--accent);
  color: white;
}

#suggestionSubmit:hover {
  background: var(--accent-strong);
}

.suggestion-status-backdrop {
  position: fixed;
  inset: 0;
  z-index: 118;
  background: rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.suggestion-status-backdrop.visible {
  opacity: 1;
}

.suggestion-status {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 120;
  width: min(520px, calc(100vw - 48px));
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, #0f172a, #334155);
  color: white;
  opacity: 0;
  overflow: hidden;
  padding: 16px 42px 20px 16px;
  pointer-events: auto;
  transform: translate(-50%, calc(-50% + 10px));
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.suggestion-status.visible {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.suggestion-status.error {
  background: linear-gradient(135deg, #7f1d1d, #b91c1c);
}

.suggestion-status-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.16);
  color: white;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.suggestion-status-close:hover {
  background: rgba(255, 255, 255, 0.26);
}

.suggestion-status-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.suggestion-status-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 11px;
  font-weight: 800;
}

.suggestion-status-text {
  line-height: 1.45;
  text-align: left;
}

.suggestion-status-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.75);
  animation: suggestion-status-progress var(--status-duration) linear forwards;
}

@keyframes suggestion-status-progress {
  from {
    width: 0;
  }

  to {
    width: 100%;
  }
}

/* ================== CATEGORY ================== */
.category {
  margin-bottom: 15px;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.category-title {
  padding: 12px;
  font-weight: bold;
  background: var(--header-bg);
  color: white;
  cursor: pointer;
}

.category-content {
  padding: 10px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding-bottom: 0;
  padding-top: 0;
  transition:
    max-height 0.24s ease,
    opacity 0.18s ease,
    padding 0.18s ease;
}

.category.open .category-content {
  opacity: 1;
  padding-bottom: 10px;
  padding-top: 10px;
}

/* ================== SUB ================== */
.sub-wrapper {
  margin-top: 10px;
  border-left: 2px solid #e3e7ef;
  padding-left: 8px;
}

.sub-title {
  display: flex;
  align-items: center;
  gap: 8px;

  font-weight: 600;
  color: #333;
  cursor: pointer;

  padding: 8px 10px;
  border-radius: 8px;
  transition: 0.2s;
}

.sub-title::before {
  content: "\25BE";
  font-size: 12px;
  transition: transform 0.2s ease;
  opacity: 0.7;
}

.sub-title.closed::before {
  transform: rotate(-90deg);
}

.sub-title:hover {
  background: var(--accent-soft);
}

/* ================== CARD ================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.card {
  padding: 12px;
  border-radius: 12px;
  background: white;
  border: 1px solid #e5e5e5;
  cursor: pointer;

  transition: all 0.2s ease;

  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-title {
  font-weight: bold;
  font-size: 14px;
  color: #222;
}

.card-text {
  font-size: 12px;
  color: #666;
  line-height: 1.4;
  max-height: 80px;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
  border-color: var(--accent);
}

.card.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.card.active .card-text {
  color: #dfefff;
}

/* ================== UTIL ================== */
.hidden {
  display: none;
}

/* ================== INLINE SELECT ================== */
.inline-select {
  background: var(--accent-muted);
  color: #17211d;

  border: none;
  border-radius: 6px;

  padding: 3px 6px;
  font-size: 12px;

  margin: 0 3px;
  cursor: pointer;
}

/* ================== SEARCH ================== */
.search-box {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-bottom: 12px;
  background: var(--panel-bg);
  transition: background 0.25s ease;
  padding-bottom: 8px;
}

#searchInput {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #d7dce5;
  border-radius: 10px;
  font-size: 13px;
  outline: none;
}

#searchInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.card.hidden-by-search,
.sub-wrapper.hidden-by-search,
.category.hidden-by-search {
  display: none !important;
}

/* ================== PLACEHOLDER ================== */
.placeholder-token {
  background: rgba(255, 193, 7, 0.18);
  color: #ffd54f;
  border: 1px dashed rgba(255, 213, 79, 0.7);
  border-radius: 5px;
  padding: 1px 4px;
}
