/**
 * File: /web/public/assets/css/project-context.css
 * Purpose:
 *   Стили страницы Project Context.
 */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #f5f7fb;
  color: #18212f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
textarea {
  font: inherit;
}

.pc-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.pc-topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px;
  border-bottom: 1px solid #dde5f0;
  background: #ffffff;
}

.pc-topbar h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.2;
}

.pc-subtitle {
  color: #5f6e82;
  max-width: 900px;
}

.pc-topbar__right {
  min-width: 280px;
  font-size: 13px;
  color: #465468;
}

.pc-meta + .pc-meta {
  margin-top: 6px;
}

.pc-global-actions {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #dde5f0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.pc-layout {
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  min-height: 0;
  flex: 1;
}

.pc-sidebar,
.pc-main {
  min-height: 0;
}

.pc-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.pc-panel {
  background: #ffffff;
  border: 1px solid #dde5f0;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.pc-panel--fullheight {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 520px;
}

.pc-panel--memo,
.pc-panel--schema {
  display: flex;
  flex-direction: column;
}

.pc-panel__header {
  margin-bottom: 12px;
}

.pc-panel__header h2 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.2;
}

.pc-panel__note {
  color: #64748b;
  font-size: 13px;
}

.pc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.pc-btn {
  appearance: none;
  border: 1px solid #cfd8e6;
  background: #f8fafc;
  color: #18212f;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.pc-btn:hover {
  background: #eef3f9;
}

.pc-btn--primary {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #ffffff;
}

.pc-btn--primary:hover {
  background: #195dca;
}

.pc-tree-meta,
.pc-preview-meta,
.pc-db-meta,
.pc-parts-meta {
  font-size: 12px;
  color: #607086;
  margin-bottom: 10px;
}

.pc-tree {
  max-height: 420px;
  overflow: auto;
  border: 1px solid #e4ebf4;
  border-radius: 10px;
  padding: 8px;
  background: #fbfdff;
}

.pc-tree-node {
  margin: 2px 0;
}

.pc-tree-row {
  padding: 4px 6px;
  border-radius: 8px;
}

.pc-tree-row:hover {
  background: #eef4fb;
}

.pc-tree-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.pc-tree-checkbox {
  margin: 0;
}

.pc-tree-icon {
  width: 18px;
  text-align: center;
  opacity: 0.9;
}

.pc-tree-name {
  word-break: break-word;
}

.pc-tree-row.is-unchecked {
  opacity: 0.45;
}

.pc-db-tables {
  max-height: 240px;
  overflow: auto;
  border: 1px solid #e4ebf4;
  border-radius: 10px;
  padding: 8px;
  background: #fbfdff;
}

.pc-db-table-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px;
  border-radius: 8px;
  cursor: pointer;
}

.pc-db-table-row:hover {
  background: #eef4fb;
}

.pc-db-table-checkbox {
  margin: 0;
}

.pc-db-table-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.pc-task-input {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid #d9e2ef;
  border-radius: 10px;
  background: #fbfdff;
  color: #18212f;
  line-height: 1.5;
}

.pc-split-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.pc-inline-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pc-inline-field__label {
  font-size: 12px;
  color: #607086;
}

.pc-number-input {
  width: 120px;
  padding: 8px 10px;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  background: #fbfdff;
}

.pc-parts-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.pc-part-btn {
  appearance: none;
  border: 1px solid #cfd8e6;
  background: #f8fafc;
  color: #18212f;
  border-radius: 8px;
  padding: 7px 11px;
  cursor: pointer;
}

.pc-part-btn:hover {
  background: #eef3f9;
}

.pc-part-btn.is-active {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #ffffff;
}

.pc-preview {
  margin: 0;
  overflow: auto;
  border: 1px solid #e4ebf4;
  border-radius: 10px;
  padding: 14px;
  background: #fbfdff;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
}

.pc-preview--memo {
  max-height: 420px;
}

.pc-preview--schema {
  max-height: 420px;
}

.pc-preview--part {
  max-height: 460px;
}

.pc-panel--fullheight .pc-preview {
  flex: 1;
  min-height: 360px;
}

.pc-copy-status {
  font-size: 12px;
  color: #1d4ed8;
  align-self: center;
}

@media (max-width: 1200px) {
  .pc-layout {
    grid-template-columns: 1fr;
  }

  .pc-global-actions {
    position: static;
  }
}

@media (max-width: 720px) {
  .pc-topbar {
    flex-direction: column;
  }

  .pc-split-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .pc-number-input {
    width: 100%;
  }
}