/* ===============================
   PORTAL — BUILD SPECIFICATION TOOL
   Page-specific styles for the logged-in Portal spec-sheet tool
   (partials/portal.php). Layout is adapted from the Spec Sheet
   prototype but restyled onto the site's existing theme variables
   and card/button visual language instead of its own palette.
   =============================== */

.spec-tool {
  margin-top: 24px;
}

.spec-view {
  display: none;
}

.spec-view.active {
  display: block;
}

/* --- Shared: toolbars, status text --- */

.spec-toolbar,
.spec-detail-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.spec-toolbar h3 {
  margin: 0;
}

.spec-detail-status {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.spec-detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* --- Buttons --- */

.spec-ghost-btn {
  border: 1px solid var(--border-card);
  background: var(--bg-details);
  color: var(--text-body);
  padding: 9px 14px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s ease, border-color 0.2s ease;
}

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

.spec-danger {
  color: var(--accent-secondary);
  border-color: var(--accent-secondary);
}

.spec-danger:hover {
  background: var(--accent-secondary);
  color: #fff;
}

/* --- Build list / cards --- */

.spec-empty {
  color: var(--text-muted);
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--border-card);
  border-radius: 4px;
}

.spec-build-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.spec-build-card {
  background: var(--bg-details);
  border: 1px solid var(--border-card);
  border-radius: 4px;
  padding: 16px 18px;
  box-shadow: 0px 3px 3px -3px var(--shadow-card);
}

.spec-build-card h4 {
  margin: 0 0 6px;
  color: var(--text-body);
}

.spec-build-meta {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.spec-build-card-actions {
  display: flex;
  gap: 8px;
}

/* --- Build header (title / date) --- */

.spec-build-header {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 4px;
  border: 1px solid var(--border-card);
  background: var(--bg-details);
}

.spec-title-block {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spec-field-label {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* --- Tabs --- */

.spec-tab-row {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-page);
  padding: 4px;
  border-radius: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--border-card);
}

.spec-tab {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 3px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease;
}

.spec-tab.active {
  background: var(--accent);
  color: var(--accent-text);
}

.spec-tab-panel {
  display: none;
}

.spec-tab-panel.active {
  display: block;
}

.spec-panel-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.spec-panel-toolbar h4 {
  margin: 0 0 4px;
}

.spec-panel-toolbar p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.spec-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* --- Table --- */

.spec-table-wrap {
  overflow-x: auto;
  border-radius: 4px;
  border: 1px solid var(--border-card);
  background: var(--bg-main);
}

.spec-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
}

.spec-table-wrap thead {
  background: var(--bg-page);
}

.spec-table-wrap th,
.spec-table-wrap td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-card);
  vertical-align: top;
}

.spec-table-wrap th {
  text-align: left;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.spec-table-wrap tr:hover td {
  background: var(--bg-page);
}

.spec-tool input[type="text"],
.spec-tool input[type="date"],
.spec-tool input[type="url"],
.spec-tool select {
  width: 100%;
  border: 1px solid var(--border-card);
  background: var(--bg-main);
  color: var(--text-body);
  border-radius: 3px;
  padding: 8px 10px;
  font: inherit;
}

.spec-tool input:focus,
.spec-tool select:focus {
  outline: none;
  border-color: var(--accent);
}

.spec-link-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 260px;
}

.spec-link-item {
  border: 1px solid var(--border-card);
  border-radius: 3px;
  padding: 6px 8px;
  background: var(--bg-main);
}

.spec-link-summary {
  display: flex;
  align-items: center;
  gap: 6px;
}

.spec-link-type {
  flex: 1 1 auto;
  min-width: 120px;
}

.spec-link-icon-btn,
.spec-link-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 3px;
  background: var(--bg-list-item);
  color: #9b9b9b;
  font-size: 15px;
  transition: background 0.2s ease, color 0.2s ease;
}

.spec-link-icon-btn:hover,
.spec-link-icon-btn:focus,
.spec-link-toggle:hover,
.spec-link-toggle:focus {
  background: var(--accent);
  color: #fff;
}

.spec-link-icon-btn.is-empty {
  opacity: 0.5;
}

.spec-link-item-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spec-link-remove,
.spec-link-add {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
  padding: 2px 6px;
}

.spec-link-remove:hover {
  color: var(--accent-secondary);
}

.spec-link-add:hover {
  color: var(--accent);
}

.spec-link-url-row {
  margin-top: 6px;
}

.spec-link-url-row[hidden] {
  display: none;
}

.spec-row-delete {
  border: 0;
  background: transparent;
  color: var(--accent-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 8px;
}

.spec-row-delete:hover {
  color: var(--accent);
}

/* --- Login error message --- */

.login100-error {
  background: rgba(255, 118, 134, 0.12);
  border: 1px solid var(--accent-secondary);
  color: var(--accent-secondary);
  padding: 10px 14px;
  border-radius: 3px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

/* ===============================
   MEDIA QUERIES
   =============================== */

@media (max-width: 860px) {
  .spec-detail-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}
