/* ==============================
   BASE RESET
   ============================== */

* {
  box-sizing: border-box;
}

:root {
  --control-height: 1.6rem;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0;
  padding: 0;
}

a {
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

main.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
}

.primary-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.intent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.intent-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.intent-header-left {
  flex: 0 0 auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* ==============================
   FORM ELEMENTS
   ============================== */

label {
  font-weight: 600;
  font-size: 0.9rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--control-height);
  padding: 0 0.75rem;
  box-sizing: border-box;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
}

input,
textarea,
select {
  width: 100%;
  font-size: 0.9rem;
  padding: 0.4rem;
  box-sizing: border-box;
  height: var(--control-height);
  border: 1px solid transparent;
  border-radius: 4px;
}

.intent-field input:focus,
.intent-field textarea:focus,
.intent-field select:focus {
  outline: none;
}

textarea {
  min-height: 6rem;
}

.help-tooltip {
  position: absolute;
  width: 320px;
  padding: 0.5rem 0.6rem;
  font-size: 0.75rem;
  line-height: 1.4;
  background: #1a1a1d;
  color: #e6e6eb;
  border: 1px solid #2a2a30;
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  z-index: 1000;
}

/* ==============================
   INTENT LABEL ROW (CRITICAL)
   ============================== */

.intent-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
  height: var(--control-height);
}

.intent-label-text {
  flex: 1 1 auto;
  min-width: 0;
}

.intent-help {
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  font-size: 0.7rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
}

/* ==============================
   LAYOUT HELPERS
   ============================== */

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row.three {
  grid-template-columns: repeat(3, 1fr);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.intent-field {
  width: 100%;
}

main.container article,
main.container ul {
  line-height: 1.6;
}

main.container article header,
main.container ul li div {
  font-size: 0.85rem;
}

main.container article a:hover,
main.container ul li > a:hover {
  text-decoration: underline;
}

/* ==============================
   ACTIONS
   ============================== */

.action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.actions-left {
  display: flex;
  flex-direction: column;
}

.inline-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.inline-controls input {
  flex: 1 1 auto;
}

.inline-controls button {
  flex: 0 0 auto;
}

/* ==============================
   RESPONSIVE
   ============================== */

@media (max-width: 768px) {
  .form-row,
  .form-row.three {
    grid-template-columns: 1fr;
  }
}

/* Fix Save Article filename width to match Save Intent */
#save-article .inline-controls input {
  flex: 0 0 auto;
  width: 16rem;
}
