/* NSK form modal — shared style for Add/Edit dialogs (company, credit, users, etc.) */
/* Include: <link rel="stylesheet" href="{% static 'css/nsk_form_modal.css' %}" /> */
/* Markup pattern: .modal > .modal-dialog > .modal-content > header/body/footer */

.nsk-form-modal {
  --fm-bg: #faf6ef;
  --fm-surface: #ffffff;
  --fm-surface-2: #f6f1e7;
  --fm-line: #e8dfcf;
  --fm-ink: #2a2118;
  --fm-ink-2: #5a4e40;
  --fm-muted: #8a7d6c;
  --fm-leaf: #148a58;
  --fm-leaf-soft: #e2f4ea;
  --fm-mango-soft: #fff1d9;
  --fm-berry: #d92d5a;
  --fm-req: #d92d5a;
  color-scheme: light;
}

[data-theme="dark"] .nsk-form-modal {
  --fm-bg: #15120e;
  --fm-surface: #201b15;
  --fm-surface-2: #2a231b;
  --fm-line: #3d342a;
  --fm-ink: #f7efe2;
  --fm-ink-2: #d7cab7;
  --fm-muted: #a3957f;
  --fm-leaf: #2fc386;
  --fm-leaf-soft: #143327;
  --fm-mango-soft: #3a2b12;
  --fm-berry: #ff6b8a;
  --fm-req: #ff6b8a;
  color-scheme: dark;
}

.nsk-form-modal .modal-content {
  border: 0;
  border-radius: 16px;
  overflow: hidden;
  background: var(--fm-surface);
  color: var(--fm-ink);
  box-shadow: 0 20px 50px rgb(0 0 0 / 18%);
}

[data-theme="dark"] .nsk-form-modal .modal-content {
  box-shadow: 0 20px 50px rgb(0 0 0 / 50%);
}

.nsk-form-modal .modal-header {
  background: linear-gradient(135deg, var(--fm-leaf-soft), var(--fm-mango-soft));
  border-bottom: 1px solid var(--fm-line);
  padding: 14px 18px;
}

.nsk-form-modal .modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--fm-ink);
}

.nsk-form-modal .modal-title .modal-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--fm-surface);
  border: 1px solid var(--fm-line);
  color: var(--fm-leaf);
  font-size: 1.15rem;
  flex-shrink: 0;
}

[data-theme="dark"] .nsk-form-modal .modal-title .modal-title-icon {
  background: var(--fm-surface-2);
}

.nsk-form-modal .modal-header .btn-close {
  filter: none;
  opacity: 0.65;
}

[data-theme="dark"] .nsk-form-modal .modal-header .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
  opacity: 0.85;
}

.nsk-form-modal .modal-body {
  padding: 18px 20px;
  background: var(--fm-surface);
}

.nsk-form-modal .modal-footer {
  border-top: 1px solid var(--fm-line);
  background: var(--fm-surface-2);
  padding: 12px 18px;
}

/* ---- Form grid ---- */
.nsk-form-modal .fm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.nsk-form-modal .fm-grid .fm-wide {
  grid-column: 1 / -1;
}

@media (max-width: 576px) {
  .nsk-form-modal .fm-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Fields ---- */
.nsk-form-modal .fm-field label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--fm-ink-2);
  margin-bottom: 6px;
}

.nsk-form-modal .fm-field label .req {
  color: var(--fm-req);
  font-weight: 800;
}

.nsk-form-modal .fm-field .fm-hint {
  display: block;
  font-size: 11.5px;
  color: var(--fm-muted);
  margin-top: 5px;
  line-height: 1.35;
}

.nsk-form-modal .fm-field input,
.nsk-form-modal .fm-field select,
.nsk-form-modal .fm-field textarea {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 8px 12px;
  border: 1.5px solid var(--fm-line);
  border-radius: 10px;
  background: var(--fm-surface);
  color: var(--fm-ink);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

[data-theme="dark"] .nsk-form-modal .fm-field input,
[data-theme="dark"] .nsk-form-modal .fm-field select,
[data-theme="dark"] .nsk-form-modal .fm-field textarea {
  background: var(--fm-surface-2);
  color-scheme: dark;
}

.nsk-form-modal .fm-field textarea {
  height: auto;
  min-height: 80px;
  resize: vertical;
}

.nsk-form-modal .fm-field input:focus,
.nsk-form-modal .fm-field select:focus,
.nsk-form-modal .fm-field textarea:focus {
  outline: none;
  border-color: var(--fm-leaf);
  box-shadow: 0 0 0 4px rgb(20 138 88 / 18%);
}

[data-theme="dark"] .nsk-form-modal .fm-field input:focus,
[data-theme="dark"] .nsk-form-modal .fm-field select:focus,
[data-theme="dark"] .nsk-form-modal .fm-field textarea:focus {
  box-shadow: 0 0 0 4px rgb(47 195 134 / 20%);
}

.nsk-form-modal .fm-field input::placeholder,
.nsk-form-modal .fm-field textarea::placeholder {
  color: var(--fm-muted);
}

/* ---- Divider / section inside modal ---- */
.nsk-form-modal .fm-section {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fm-muted);
  margin: 2px 0 -2px;
}

.nsk-form-modal .fm-section::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--fm-line);
}

.nsk-form-modal .fm-section iconify-icon {
  font-size: 14px;
  color: var(--fm-leaf);
}

/* ---- Buttons (match sp-btn look) ---- */
.nsk-form-modal .fm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  width: 100%;
}

.nsk-form-modal .fm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.nsk-form-modal .fm-btn-primary {
  background: var(--fm-leaf);
  border-color: var(--fm-leaf);
  color: #fff;
}

.nsk-form-modal .fm-btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow: 0 4px 14px rgb(20 138 88 / 30%);
}

[data-theme="dark"] .nsk-form-modal .fm-btn-primary {
  color: #0b1a12;
}

.nsk-form-modal .fm-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nsk-form-modal .fm-btn-ghost {
  background: var(--fm-surface);
  color: var(--fm-ink-2);
  border-color: var(--fm-line);
}

.nsk-form-modal .fm-btn-ghost:hover {
  background: var(--fm-mango-soft);
  color: var(--fm-ink);
}

@media (max-width: 576px) {
  .nsk-form-modal .modal-body {
    padding: 14px 14px;
  }
  .nsk-form-modal .modal-footer {
    padding: 10px 14px;
  }
  .nsk-form-modal .fm-actions {
    flex-direction: column-reverse;
  }
  .nsk-form-modal .fm-btn {
    width: 100%;
  }
}
