/**
 * Jalpi Support Center — module stylesheet.
 *
 * Self-contained: every rule is scoped under .jalpi-support so this file cannot
 * affect the editor, the frontend or any other admin screen. It is enqueued only
 * on the Support page (see Jalpi_Support_Center::enqueue_admin_assets()).
 *
 * No imports, no shared variables — the module owns everything it needs.
 */

.jalpi-support {
  --jsp-border: #dcdcde;
  --jsp-bg: #fff;
  --jsp-muted: #646970;
  --jsp-accent: #2271b1;
  --jsp-pass: #00a32a;
  --jsp-warn: #dba617;
  --jsp-fail: #d63638;
}

.jalpi-support__title {
  margin-bottom: 4px;
}

.jalpi-support__lead {
  color: var(--jsp-muted);
  margin: 0 0 20px;
  font-size: 14px;
}

/* ── Tabs ───────────────────────────────────────────────────────────────── */

.jalpi-support__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  border-bottom: 1px solid var(--jsp-border);
  margin-bottom: 0;
}

.jalpi-support__tab {
  padding: 10px 16px;
  text-decoration: none;
  color: var(--jsp-muted);
  font-weight: 500;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  margin-bottom: -1px;
  background: transparent;
}

.jalpi-support__tab:hover,
.jalpi-support__tab:focus {
  color: var(--jsp-accent);
}

.jalpi-support__tab.is-active {
  background: var(--jsp-bg);
  border-color: var(--jsp-border);
  color: #1d2327;
}

/* Keyboard users must be able to see which tab has focus. */
.jalpi-support__tab:focus-visible {
  outline: 2px solid var(--jsp-accent);
  outline-offset: -2px;
}

/* ── Panel ──────────────────────────────────────────────────────────────── */

.jalpi-support__panel {
  background: var(--jsp-bg);
  border: 1px solid var(--jsp-border);
  border-top: none;
  padding: 24px;
}

.jalpi-support__panel h2 {
  margin-top: 0;
}

.jalpi-support__hint {
  color: var(--jsp-muted);
  max-width: 70ch;
}

/* ── System info table ──────────────────────────────────────────────────── */

.jalpi-support__table {
  border-collapse: collapse;
  width: 100%;
  max-width: 720px;
  margin: 16px 0;
}

.jalpi-support__table th,
.jalpi-support__table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f1;
  vertical-align: top;
}

.jalpi-support__table th {
  width: 200px;
  font-weight: 600;
  color: #1d2327;
}

.jalpi-support__table td {
  color: var(--jsp-muted);
  word-break: break-word;
}

.jalpi-support__report {
  display: block;
  width: 100%;
  max-width: 720px;
  min-height: 200px;
  margin-top: 12px;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
}

.jalpi-support__copied {
  margin-left: 10px;
  color: var(--jsp-pass);
  font-weight: 500;
}

/* ── Diagnostics ────────────────────────────────────────────────────────── */

.jalpi-support__results {
  margin-top: 18px;
  max-width: 820px;
}

.jalpi-support__check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--jsp-border);
  border-radius: 4px;
  margin-bottom: 8px;
  background: #fff;
}

.jalpi-support__badge {
  flex: 0 0 auto;
  min-width: 54px;
  text-align: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: #fff;
  line-height: 1.8;
}

.jalpi-support__badge--pass { background: var(--jsp-pass); }
.jalpi-support__badge--warn { background: var(--jsp-warn); }
.jalpi-support__badge--fail { background: var(--jsp-fail); }

.jalpi-support__check-label {
  font-weight: 600;
  color: #1d2327;
}

.jalpi-support__check-detail {
  color: var(--jsp-muted);
  font-size: 13px;
  margin-top: 2px;
}

.jalpi-support__spinner {
  color: var(--jsp-muted);
  font-style: italic;
}

/* ── Cards (docs + contact) ─────────────────────────────────────────────── */

.jalpi-support__cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.jalpi-support__card {
  border: 1px solid var(--jsp-border);
  border-radius: 4px;
  padding: 16px 18px;
  background: #fff;
}

.jalpi-support__card h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.jalpi-support__card p {
  margin: 0;
  color: var(--jsp-muted);
  font-size: 13px;
}

.jalpi-support__list {
  margin: 0;
  padding-left: 18px;
  color: var(--jsp-muted);
  font-size: 13px;
}

.jalpi-support__list li {
  margin-bottom: 4px;
}

/* Narrow screens: the fixed label column would squeeze values too far. */
@media screen and (max-width: 782px) {
  .jalpi-support__table th {
    width: auto;
  }

  .jalpi-support__table th,
  .jalpi-support__table td {
    display: block;
  }

  .jalpi-support__table td {
    padding-top: 0;
  }
}

/* ────────────────────────────────────────────────────────────────────────
   CONTACT TAB — direct-contact card + help request form
   Layout mirrors the Authyo CF7 support module; class names are namespaced
   to this plugin so the two can coexist on the same install.
   ──────────────────────────────────────────────────────────────────────── */

.jalpi-support-container {
  display: flex;
  flex-direction: column;
  max-width: 680px;
}

.jalpi-support-card {
  background: #fff;
  border: 1px solid var(--jsp-border);
  border-radius: 6px;
  margin: 0 0 24px;
  overflow: hidden;
}

.jalpi-support-card__header {
  padding: 16px 24px 12px;
}

.jalpi-support-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: #1d2327;
}

.jalpi-support-card__title .dashicons {
  color: var(--jsp-accent);
  font-size: 18px;
  width: 18px;
  height: 18px;
}

.jalpi-support-card__subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--jsp-muted);
}

/* ── Direct contact row ───────────────────────────────────────────────── */

.jalpi-support-contact-card .jalpi-support-card__body {
  padding: 0;
}

.jalpi-support-email-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  background: linear-gradient(135deg, #f0f6fc 0%, #e8f0fe 100%);
}

.jalpi-support-email-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 20px;
  color: #fff;
  background: var(--jsp-accent);
  border-radius: 50%;
  flex-shrink: 0;
}

/* Dashicons set their own line-height; override so the glyph centres. */
.jalpi-support-email-icon.dashicons::before {
  line-height: 40px;
}

.jalpi-support-email-address {
  font-size: 17px;
  font-weight: 600;
  color: #1d2327;
  letter-spacing: .2px;
  /* Select the whole address in one click for users who prefer not to
     rely on the copy button. */
  user-select: all;
}

.jalpi-support-copy-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  padding: 6px 16px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  white-space: nowrap;
  border-radius: 4px !important;
  transition: all .2s ease;
}

.jalpi-support-copy-btn .dashicons {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  width: 15px;
  height: 15px;
  line-height: 1;
}

.jalpi-support-copy-btn.is-copied {
  color: var(--jsp-pass) !important;
  border-color: var(--jsp-pass) !important;
  background: #edfaef !important;
}

/* ── Help request form ────────────────────────────────────────────────── */

.jalpi-support-form-card .jalpi-support-card__body {
  padding: 24px;
  border-top: 1px solid #f0f0f1;
}

.jalpi-support-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.jalpi-support-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.jalpi-support-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.jalpi-support-field__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #1d2327;
}

.jalpi-support-field__label .dashicons {
  font-size: 15px;
  width: 15px;
  height: 15px;
  color: var(--jsp-accent);
}

.jalpi-support-field__input {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid #c3c4c7;
  border-radius: 6px;
  background: #fff;
  color: #1d2327;
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease;
}

select.jalpi-support-field__input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2350575e' d='M6 8.825L1.175 4 2.238 2.938 6 6.7l3.763-3.763L10.825 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 36px;
  cursor: pointer;
}

.jalpi-support-field__input:focus {
  border-color: var(--jsp-accent);
  box-shadow: 0 0 0 2px rgba(34, 113, 177, .15);
  outline: none;
}

textarea.jalpi-support-field__input {
  resize: vertical;
  min-height: 120px;
}

/* Mark a field the user needs to fix, without relying on colour alone —
   the status message below states what is wrong. */
.jalpi-support-field__input.has-error {
  border-color: var(--jsp-fail);
}

/* ── Disclosure notice ────────────────────────────────────────────────── */

.jalpi-support-notice {
  padding: 10px 14px;
  background: #f6f7f7;
  border: 1px solid var(--jsp-border);
  border-radius: 4px;
  font-size: 12px;
  color: #50575e;
  line-height: 1.5;
}

.jalpi-support-notice .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
  color: var(--jsp-accent);
  vertical-align: text-bottom;
  margin-right: 4px;
}

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

.jalpi-support-submit-row {
  padding-top: 6px;
}

.jalpi-support-submit-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  padding: 10px 28px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  border-radius: 6px !important;
  transition: all .15s ease;
}

.jalpi-support-submit-btn .dashicons {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  width: 16px;
  height: 16px;
  line-height: 1;
}

.jalpi-support-submit-btn:disabled {
  opacity: .65;
  cursor: not-allowed;
}

.jalpi-support-submit-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--jsp-muted);
}

/* ── Status message ───────────────────────────────────────────────────── */

.jalpi-support-status {
  padding: 14px 18px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 500;
}

.jalpi-support-status.is-success {
  background: #edfaef;
  border-left: 4px solid var(--jsp-pass);
  color: #1e4620;
}

.jalpi-support-status.is-error {
  background: #fcf0f1;
  border-left: 4px solid var(--jsp-fail);
  color: #8a1f22;
}

.jalpi-support-status.is-warning {
  background: #fff8e1;
  border-left: 4px solid var(--jsp-warn);
  color: #664d03;
}

/* Spinner for the submit button. Defined here so the module owns it. */
@keyframes jalpi-support-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.jalpi-support-spinning {
  animation: jalpi-support-spin 1s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .jalpi-support-spinning { animation: none; }
}

/* ── Responsive ───────────────────────────────────────────────────────── */

@media screen and (max-width: 782px) {
  .jalpi-support-container { max-width: 100%; }
  .jalpi-support-row-2col  { grid-template-columns: 1fr; }

  .jalpi-support-email-row {
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 20px;
  }

  .jalpi-support-email-address { font-size: 15px; }

  .jalpi-support-copy-btn {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .jalpi-support-form-card .jalpi-support-card__body { padding: 20px; }
}

@media screen and (max-width: 480px) {
  .jalpi-support-email-row { padding: 14px 16px; }

  .jalpi-support-email-icon {
    width: 34px;
    height: 34px;
    font-size: 17px;
  }

  .jalpi-support-email-icon.dashicons::before { line-height: 34px; }

  .jalpi-support-form-card .jalpi-support-card__body { padding: 16px; }

  .jalpi-support-submit-btn {
    width: 100%;
    justify-content: center;
  }
}
