/* ========================================
   EDITOR FORM - Shared scaffolding for admin
   sectioned editors (IP blocks, BGP sessions,
   notices, etc.). All styles scoped under
   .editor-form. Themes layer color via a
   sibling class like .ip-block-theme,
   .bgp-theme, .notice-theme.
   ======================================== */

/* Main container */
.editor-form {
  max-width: 900px;
}

/* Gradient header banner */
.editor-form .editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--arp-space-6);
  padding: var(--arp-space-5) var(--arp-space-6);
  background: linear-gradient(135deg, var(--arp-gray-600) 0%, var(--arp-gray-700) 100%);
  border-radius: var(--arp-radius-md);
  margin-bottom: var(--arp-space-6);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .editor-form .editor-header {
  box-shadow: var(--arp-shadow-xl);
}

.editor-form .editor-header h1 {
  color: white;
  font-size: var(--arp-space-6);
  font-weight: 600;
  margin: 0;
}

.editor-form .editor-subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  margin-top: var(--arp-space-1);
}

.editor-form .editor-subtitle code {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.15rem var(--arp-space-2);
  border-radius: var(--arp-radius-xs);
  font-size: 0.9rem;
}

.editor-form .editor-subtitle-secondary {
  opacity: 0.85;
}

.editor-form .editor-header .buttons {
  margin-bottom: 0;
  flex-shrink: 0;
}

.editor-form .editor-header .buttons .button {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: white;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.editor-form .editor-header .buttons .button:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Header stats cluster */
.editor-form .editor-header-stats {
  display: flex;
  gap: var(--arp-space-8);
}

.editor-form .header-stat {
  text-align: center;
}

.editor-form .header-stat-value {
  display: block;
  font-size: var(--arp-space-5);
  font-weight: 700;
  color: white;
}

.editor-form .header-stat-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 0.15rem;
}

/* Section cards */
.editor-form .editor-section {
  background: var(--bulma-scheme-main);
  border: 1px solid var(--bulma-border);
  border-radius: var(--arp-radius-md);
  padding: var(--arp-space-6);
  margin-bottom: var(--arp-space-6);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.editor-form .editor-section.raised {
  background: var(--arp-surface-raised);
  border: 1px solid var(--arp-border);
  border-color: var(--arp-gray-300);
}

[data-theme="dark"] .editor-form .editor-section.raised {
  border-color: var(--arp-gray-800);
}

.editor-form .editor-section:focus-within {
  border-color: var(--bulma-link);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

[data-theme="dark"] .editor-form .editor-section:focus-within {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.editor-form .editor-section-header {
  display: flex;
  align-items: center;
  gap: var(--arp-space-3);
  margin-bottom: var(--arp-space-5);
  padding-bottom: var(--arp-space-3);
  border-bottom: 1px solid var(--bulma-border);
}

.editor-form .editor-section-header .icon {
  color: var(--bulma-link);
  font-size: 1.1rem;
}

.editor-form .editor-section-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--bulma-text-weak);
  margin: 0;
}

/* Optional right-aligned action button inside section header */
.editor-form .editor-section-header .section-header-action {
  margin-left: auto;
}

/* Grid layouts */
.editor-form .editor-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--arp-space-6);
}

.editor-form .editor-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--arp-space-6);
}

/* Status toggle: base styles live in admin_forms.css.
   These expand single toggles to fill grid cells. */
.editor-form .editor-grid-2 .status-toggle-single,
.editor-form .editor-grid-3 .status-toggle-single {
  width: 100%;
}

.editor-form .editor-grid-2 .status-toggle-single .status-toggle,
.editor-form .editor-grid-3 .status-toggle-single .status-toggle {
  flex: 1;
}

/* Action footer */
.editor-form .editor-actions {
  background: var(--bulma-scheme-main);
  border: 1px solid var(--bulma-border);
  border-radius: var(--arp-radius-md);
  padding: var(--arp-space-5) var(--arp-space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--arp-space-4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .editor-form .editor-actions {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.editor-form .editor-actions .buttons {
  margin-bottom: 0;
}

/* Delete button sits outside .buttons wrapper, so it needs explicit specificity */
.editor-form .editor-actions .button.is-danger {
  background-color: transparent;
  border-color: var(--bulma-danger, #f14668);
  color: var(--bulma-danger, #f14668);
}

.editor-form .editor-actions .button.is-danger:hover {
  background-color: var(--bulma-danger, #f14668);
  color: white;
}

/* Responsive */
@media screen and (max-width: 1024px) {
  .editor-form .editor-grid-3 {
    grid-template-columns: 1fr 1fr;
  }

  .editor-form .editor-grid-3 > :last-child {
    grid-column: span 2;
  }
}

@media screen and (max-width: 768px) {
  .editor-form .editor-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--arp-space-4);
  }

  .editor-form .editor-header-stats {
    width: 100%;
    justify-content: flex-start;
  }

  .editor-form .editor-header .buttons {
    width: 100%;
    justify-content: flex-start;
  }

  .editor-form .editor-grid-2,
  .editor-form .editor-grid-3 {
    grid-template-columns: 1fr;
  }

  .editor-form .editor-grid-3 > :last-child {
    grid-column: span 1;
  }

  .editor-form .editor-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .editor-form .editor-actions .buttons {
    justify-content: center;
  }

  .editor-form .editor-actions .button.is-danger {
    align-self: center;
  }
}
