:root {
  --admin-page-bg: linear-gradient(180deg, #dbe4ef 0%, #d4dfeb 100%);
  --admin-surface: rgba(255, 255, 255, 0.94);
  --admin-surface-soft: #f8fbff;
  --admin-border-soft: rgba(34, 51, 76, 0.1);
  --admin-border-strong: rgba(34, 51, 76, 0.16);
  --admin-shadow-strong: 0 24px 70px rgba(15, 23, 42, 0.13);
  --admin-text-strong: #142033;
  --admin-text-body: #58677e;
  --admin-text-muted: #8693a8;
  --admin-navy: #1e293b;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(
      circle at top right,
      rgba(255, 255, 255, 0.5),
      transparent 30%
    ),
    radial-gradient(
      circle at bottom left,
      rgba(179, 205, 232, 0.4),
      transparent 28%
    ),
    var(--admin-page-bg);
  color: var(--admin-text-strong);
}

.add-article-panel {
  flex: 1;
  min-width: 0;
  padding: clamp(1.5rem, 4vw, 3rem);
}

.add-article-content {
  max-width: 1040px;
}

.editor-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.editor-header__lead {
  display: grid;
  gap: 0.7rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--admin-text-body);
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover,
.back-link:focus-visible {
  text-decoration: none;
  color: #334155;
}

.back-link__icon {
  display: inline-grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  color: currentColor;
}

.back-link__icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.editor-header h1 {
  font-size: clamp(2.15rem, 4vw, 3.35rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
  color: #111c2d;
}

.editor-header p {
  max-width: 42rem;
  color: var(--admin-text-body);
  font-size: 1.02rem;
  line-height: 1.7;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem;
}

.ghost-btn,
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.75rem 1.35rem;
  border-radius: 0.8rem;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.96);
  color: #1c2839;
  border-color: rgba(20, 32, 51, 0.08);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.primary-btn {
  background: var(--admin-navy);
  color: #ffffff;
  box-shadow: 0 16px 28px rgba(30, 41, 59, 0.18);
}

.ghost-btn:hover,
.ghost-btn:focus-visible,
.primary-btn:hover,
.primary-btn:focus-visible {
  transform: translateY(-1px);
}

.ghost-btn:hover,
.ghost-btn:focus-visible {
  background: #f8fbff;
}

.primary-btn:hover,
.primary-btn:focus-visible {
  background: #111c2d;
}

.article-form {
  display: grid;
  gap: 1.5rem;
}

.editor-card {
  padding: 1.4rem 1.5rem 1.55rem;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 1.9rem;
  background: var(--admin-surface);
  box-shadow: var(--admin-shadow-strong);
}

.editor-card__header {
  margin-bottom: 1.3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(20, 32, 51, 0.08);
}

.editor-card__header--stacked p {
  margin-top: 0.45rem;
  color: var(--admin-text-body);
  line-height: 1.6;
}

.editor-card__header h2 {
  font-size: 1.2rem;
  color: #111c2d;
}

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

.field {
  display: grid;
  gap: 0.6rem;
}

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

.field label {
  color: #0f172a;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--admin-border-soft);
  border-radius: 0.9rem;
  background: var(--admin-surface-strong, #ffffff);
  color: var(--admin-text-strong);
  font: inherit;
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.field input,
.field select {
  min-height: 3.45rem;
  padding: 0.9rem 1rem;
}

.field textarea {
  min-height: 7.5rem;
  padding: 1rem;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--admin-text-muted);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(11, 143, 142, 0.42);
  box-shadow: 0 0 0 4px rgba(14, 165, 164, 0.12);
}

.select-field {
  position: relative;
}

.select-field::after {
  content: "";
  position: absolute;
  right: 1rem;
  bottom: 1.35rem;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid #7f8ba0;
  border-bottom: 2px solid #7f8ba0;
  transform: rotate(45deg) translateY(-15%);
  pointer-events: none;
}

.select-field select {
  appearance: none;
  padding-right: 2.4rem;
}

.upload-dropzone {
  display: grid;
  place-items: center;
  min-height: 12rem;
  padding: 1.5rem;
  border: 1.5px dashed rgba(20, 32, 51, 0.14);
  border-radius: 1.25rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(247, 251, 255, 0.88)),
    #ffffff;
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    transform 0.18s ease;
}

.upload-dropzone:hover,
.upload-dropzone:focus-within {
  border-color: rgba(11, 143, 142, 0.28);
  transform: translateY(-1px);
}

.upload-dropzone.is-dragging {
  border-color: rgba(11, 143, 142, 0.4);
  background:
    linear-gradient(180deg, rgba(236, 253, 245, 0.92), rgba(240, 253, 250, 0.92)),
    #ffffff;
}

.upload-dropzone.has-file {
  border-style: solid;
}

.upload-dropzone__preview {
  width: 100%;
  min-height: 9rem;
  border-radius: 1rem;
  background-position: center;
  background-size: cover;
  margin-bottom: 1rem;
}

.upload-dropzone__content {
  display: grid;
  gap: 0.45rem;
  justify-items: center;
}

.upload-dropzone__content strong {
  font-size: 1.05rem;
}

.upload-dropzone__content p {
  color: var(--admin-text-body);
}

.upload-icon {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  color: var(--admin-text-muted);
}

.upload-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.editor-surface {
  overflow: hidden;
  border: 1px solid var(--admin-border-soft);
  border-radius: 1rem;
  background: #ffffff;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid rgba(20, 32, 51, 0.08);
}

.editor-toolbar button {
  display: inline-grid;
  place-items: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.35rem;
  border-radius: 0.55rem;
  background: transparent;
  color: var(--admin-text-body);
  font: inherit;
  font-weight: 700;
}

.editor-toolbar button:hover,
.editor-toolbar button:focus-visible,
.editor-toolbar button.is-active {
  background: rgba(30, 41, 59, 0.08);
  color: #111c2d;
}

.toolbar-divider {
  width: 1px;
  height: 1.5rem;
  margin-inline: 0.35rem;
  background: rgba(20, 32, 51, 0.1);
}

.content-editor {
  min-height: 11.5rem;
  width: 100%;
  border: none;
  padding: 1rem;
  resize: vertical;
  background: transparent;
  color: var(--admin-text-strong);
  font: inherit;
  outline: none;
}

.content-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--admin-text-muted);
  pointer-events: none;
}

/* ── Submit row ──────────────────────────────────────────────────────────── */

.form-submit-row {
  display: flex;
  justify-content: flex-end;
}

.submit-btn {
  gap: 0.6rem;
  min-width: 11rem;
  cursor: pointer;
}

.submit-btn.is-loading {
  pointer-events: none;
  opacity: 0.7;
}

.submit-btn.is-loading .submit-btn__label::before {
  content: "\f110";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 0.5rem;
  animation: fa-spin 1s linear infinite;
}

@keyframes fa-spin {
  to { transform: rotate(360deg); }
}

/* ── Inline field errors ─────────────────────────────────────────────────── */

.field--error input,
.field--error select,
.field--error textarea,
.field--error .content-editor,
.field--error .upload-dropzone {
  border-color: #dc2626;
}

.field--error input:focus,
.field--error select:focus,
.field--error textarea:focus,
.field--error .content-editor:focus {
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
}

.field-error {
  color: #dc2626;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ── Form feedback messages ──────────────────────────────────────────────── */

.form-message {
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.form-message--success {
  background: rgba(5, 150, 105, 0.08);
  color: #065f46;
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.form-message--error {
  background: rgba(220, 38, 38, 0.06);
  color: #991b1b;
  border: 1px solid rgba(220, 38, 38, 0.16);
}

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .field--full {
    grid-column: auto;
  }
}

@media (max-width: 836px) {
  .add-article-panel {
    padding: 5.5rem 1rem 1.25rem;
  }
}

@media (max-width: 720px) {
  .editor-card {
    padding: 1.1rem;
    border-radius: 1.55rem;
  }

  .editor-actions {
    width: 100%;
  }

  .ghost-btn,
  .primary-btn {
    flex: 1 1 12rem;
  }
}
