/* ==========================================================================
   SEO Fury — SEO fields on the add / edit term screens (class-term-meta.php)
   Base rules keep the WordPress form look; body.sf-tm-alpha (new design on)
   restyles the same markup as a card. Term screens are core WordPress
   screens and always light, so the palette is fixed here.
   ========================================================================== */

.sf-tm{
  --sft-text:#0f172a; --sft-text-2:#475569; --sft-muted:#64748b; --sft-faint:#94a3b8;
  --sft-line:#e6e8f0; --sft-line-2:#d5d9e4; --sft-line-soft:#eff1f6; --sft-soft:#f5f6fa;
  --sft-accent:#4f46e5; --sft-accent-bg:#eef0ff; --sft-ring:0 0 0 3px rgba(79,70,229,.16);
  --sft-good:#059669; --sft-ok:#b45309; --sft-ok-fill:#d97706; --sft-bad:#dc2626;
}

/* Edit screen: our block sits in one full-width row of the core table and
   carries its own form table, so labels line up with the core rows. */
.form-table tr.sf-tm-row > td{ padding:0; }
.sf-tm .sf-tm-table{ margin-top:0; }

/* Heading */
.sf-tm-head{ display:flex; align-items:flex-start; gap:10px; margin:24px 0 4px; padding-top:20px; border-top:1px solid #dcdcde; }
.sf-tm--add .sf-tm-head{ margin-top:8px; }
.sf-tm-head-icon.dashicons{ flex:0 0 auto; margin-top:2px; color:var(--sft-accent); }
.sf-tm-head h2{ margin:0 0 4px; padding:0; font-size:1.3em; }
.sf-tm-head p{ margin:0; color:#646970; }
.sf-tm-label{ display:block; font-weight:600; }
.form-table .sf-tm-label{ font-weight:600; }
.sf-tm-fields > .form-field{ margin:0 0 16px; }
.sf-tm-fields > .form-field > label,
.sf-tm-fields > .form-field > .sf-tm-label{ display:block; margin-bottom:4px; }

/* Same width as the core inputs (95%) */
.sf-tm .sf-tm-len,
.sf-tm .sf-tm-serp,
.sf-tm .sf-tm-image{ width:95%; }
.sf-tm .sf-tm-image-controls input[type="url"]{ width:100%; }

/* Length meter */
.sf-tm-len{ display:flex; flex-wrap:wrap; align-items:center; gap:4px 8px; max-width:600px; margin-top:6px; font-size:12px; }
.sf-tm-len-bar{ flex:1 1 120px; height:4px; border-radius:99px; background:var(--sft-line-soft); overflow:hidden; }
.sf-tm-len-bar i{ display:block; width:0; height:100%; border-radius:inherit; background:var(--sft-faint); transition:width .2s, background .2s; }
.sf-tm-len-text{ flex:0 0 auto; font-weight:600; color:var(--sft-muted); }
.sf-tm-len-count{ flex:0 0 auto; color:var(--sft-muted); font-variant-numeric:tabular-nums; }
.sf-tm-len.is-good .sf-tm-len-bar i{ background:var(--sft-good); }
.sf-tm-len.is-good .sf-tm-len-text{ color:var(--sft-good); }
.sf-tm-len.is-ok .sf-tm-len-bar i{ background:var(--sft-ok-fill); }
.sf-tm-len.is-ok .sf-tm-len-text{ color:var(--sft-ok); }
.sf-tm-len.is-bad .sf-tm-len-bar i{ background:var(--sft-bad); }
.sf-tm-len.is-bad .sf-tm-len-text{ color:var(--sft-bad); }

/* Search preview */
.sf-tm-serp{
  box-sizing:border-box; max-width:600px; padding:12px 14px; border:1px solid #dcdcde; border-radius:8px; background:#fff;
  font-family:Arial, "Helvetica Neue", Helvetica, sans-serif; text-align:start;
}
.sf-tm-serp-site{ display:flex; align-items:center; gap:10px; min-width:0; margin-bottom:6px; }
.sf-tm-serp-fav{
  display:inline-flex; align-items:center; justify-content:center; flex:0 0 26px; width:26px; height:26px; box-sizing:border-box;
  border:1px solid #dadce0; border-radius:50%; background:#f1f3f4; color:#4d5156; font-size:12px; font-weight:700; overflow:hidden;
}
.sf-tm-serp-fav.has-img{ padding:4px; background:#fff; }
.sf-tm-serp-fav img{ display:block; width:100%; height:100%; object-fit:contain; }
.sf-tm-serp-meta{ display:flex; flex-direction:column; min-width:0; line-height:1.3; }
.sf-tm-serp-name{ overflow:hidden; font-size:13px; color:#202124; text-overflow:ellipsis; white-space:nowrap; }
.sf-tm-serp-url{ overflow:hidden; font-size:11.5px; color:#4d5156; text-overflow:ellipsis; white-space:nowrap; }
.sf-tm-serp-title{
  display:-webkit-box; overflow:hidden; margin:0 0 3px; font-size:18px; line-height:1.3; color:#1a0dab;
  -webkit-line-clamp:1; -webkit-box-orient:vertical; word-break:break-word;
}
.sf-tm-serp-desc{
  display:-webkit-box; overflow:hidden; font-size:13px; line-height:1.55; color:#4d5156;
  -webkit-line-clamp:2; -webkit-box-orient:vertical; word-break:break-word;
}
.sf-tm-serp-desc.is-empty{ font-style:italic; color:#8c8f94; }

/* Robots */
.sf-tm-robots{ display:flex; flex-direction:column; gap:6px; margin:0; padding:0; border:0; }
.sf-tm-check{ display:inline-flex; align-items:center; gap:6px; }
.sf-tm-fields .sf-tm-check input[type="checkbox"]{ width:auto; margin:0; }

/* Social image */
.sf-tm-image{ display:flex; align-items:flex-start; gap:12px; max-width:600px; }
.sf-tm-image-preview{ display:none; flex:0 0 120px; width:120px; height:63px; overflow:hidden; border:1px solid #dcdcde; border-radius:4px; background:#f6f7f7; }
.sf-tm-image.has-image .sf-tm-image-preview{ display:block; }
.sf-tm-image-preview img{ display:block; width:100%; height:100%; object-fit:cover; }
.sf-tm-image-controls{ flex:1 1 auto; min-width:0; }
.sf-tm-image-buttons{ display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-top:6px; }
.sf-tm-image-remove{ color:#b32d2e; }
.sf-tm-image:not(.has-image) .sf-tm-image-remove{ display:none; }

@media (max-width:782px){
  .sf-tm-image{ flex-direction:column; }
  .sf-tm-image-controls{ width:100%; }
}

/* ==========================================================================
   New design
   ========================================================================== */
.sf-tm-alpha .sf-tm{
  box-sizing:border-box; margin:24px 0 8px; padding:18px 22px 6px; border:1px solid var(--sft-line); border-radius:14px;
  background:#fff; box-shadow:0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.05); color:var(--sft-text);
}
.sf-tm-alpha .form-table tr.sf-tm-row > td{ padding:8px 0 0; }
.sf-tm-alpha .sf-tm--add{ margin:16px 0; padding:16px 18px 2px; }
.sf-tm-alpha .sf-tm-head{ align-items:center; gap:12px; margin:0 0 6px; padding:0 0 14px; border-top:0; border-bottom:1px solid var(--sft-line-soft); }
.sf-tm-alpha .sf-tm-head-icon.dashicons{
  width:34px; height:34px; margin:0; border-radius:10px; background:var(--sft-accent-bg); color:var(--sft-accent);
  font-size:18px; line-height:34px; text-align:center;
}
.sf-tm-alpha .sf-tm-head h2{ margin:0 0 2px; font-size:15px; font-weight:650; line-height:1.3; color:var(--sft-text); }
.sf-tm-alpha .sf-tm-head p{ font-size:12.5px; color:var(--sft-muted); }

.sf-tm-alpha .sf-tm .form-table th{ padding:18px 0 16px; padding-inline-end:10px; width:180px; font-size:12.5px; font-weight:600; color:var(--sft-text); }
.sf-tm-alpha .sf-tm .form-table td{ padding:14px 0; padding-inline-start:10px; }
.sf-tm-alpha .sf-tm .form-table tr + tr > th,
.sf-tm-alpha .sf-tm .form-table tr + tr > td{ border-top:1px solid var(--sft-line-soft); }
.sf-tm-alpha .sf-tm .sf-tm-label,
.sf-tm-alpha .sf-tm-fields > .form-field > label{ font-size:12.5px; font-weight:600; color:var(--sft-text); }
.sf-tm-alpha .sf-tm-fields > .form-field{ margin:0; padding:12px 0; border-top:1px solid var(--sft-line-soft); }
.sf-tm-alpha .sf-tm-fields > .form-field:first-child{ border-top:0; }
.sf-tm-alpha .sf-tm p.description{ margin-top:6px; font-size:12px; color:var(--sft-muted); }

.sf-tm-alpha .sf-tm input[type="text"],
.sf-tm-alpha .sf-tm input[type="url"],
.sf-tm-alpha .sf-tm textarea{
  box-sizing:border-box; width:100%; max-width:600px; min-height:36px; padding:7px 11px; border:1px solid var(--sft-line-2); border-radius:9px;
  background-color:#fff; box-shadow:none; font-size:13px; line-height:1.4; color:var(--sft-text); transition:border-color .15s, box-shadow .15s;
}
.sf-tm-alpha .sf-tm textarea{ min-height:72px; }
.sf-tm-alpha .sf-tm input:focus,
.sf-tm-alpha .sf-tm textarea:focus{ border-color:var(--sft-accent); box-shadow:var(--sft-ring); outline:none; }
.sf-tm-alpha .sf-tm ::placeholder{ color:var(--sft-faint); }

.sf-tm-alpha .sf-tm .sf-tm-len,
.sf-tm-alpha .sf-tm .sf-tm-serp,
.sf-tm-alpha .sf-tm .sf-tm-image{ width:100%; }
.sf-tm-alpha .sf-tm-serp{ border-color:var(--sft-line); border-radius:12px; }
.sf-tm-alpha .sf-tm-image-preview{ border-color:var(--sft-line); border-radius:9px; background:var(--sft-soft); }
.sf-tm-alpha .sf-tm .button{ min-height:32px; border-radius:8px; }
.sf-tm-alpha .sf-tm .button:not(.button-primary){ color:#4338ca; border-color:#c7d2fe; background:#fff; }
.sf-tm-alpha .sf-tm .button:not(.button-primary):hover{ color:#3730a3; border-color:#4f46e5; background:#eef2ff; }
.sf-tm-alpha .sf-tm-image-remove{ color:var(--sft-bad); }

/* Robots checkboxes as switches, like the post SEO box */
.sf-tm-alpha .sf-tm-robots{ gap:8px; }
.sf-tm-alpha .sf-tm-check{ gap:8px; font-size:13px; color:var(--sft-text-2); cursor:pointer; }
.sf-tm-alpha .sf-tm .sf-tm-check input[type="checkbox"]{
  -webkit-appearance:none; appearance:none; position:relative; flex:0 0 auto; width:32px; height:18px; min-width:32px; margin:0; padding:0;
  border:0; border-radius:99px; background:#cbd2e0; box-shadow:none; cursor:pointer; transition:background .15s;
}
.sf-tm-alpha .sf-tm .sf-tm-check input[type="checkbox"]::before{
  content:""; position:absolute; top:2px; inset-inline-start:2px; width:14px; height:14px; margin:0; border-radius:50%;
  background:#fff; box-shadow:0 1px 2px rgba(16,24,40,.25); transition:transform .15s;
}
.sf-tm-alpha .sf-tm .sf-tm-check input[type="checkbox"]:checked{ background:var(--sft-accent); }
.sf-tm-alpha .sf-tm .sf-tm-check input[type="checkbox"]:checked::before{ transform:translateX(14px); }
[dir="rtl"] .sf-tm-alpha .sf-tm .sf-tm-check input[type="checkbox"]:checked::before{ transform:translateX(-14px); }
.sf-tm-alpha .sf-tm .sf-tm-check input[type="checkbox"]:focus-visible{ box-shadow:var(--sft-ring); outline:none; }

@media (max-width:782px){
  .sf-tm-alpha .sf-tm{ padding:14px 14px 4px; }
  .sf-tm-alpha .sf-tm .form-table th,
  .sf-tm-alpha .sf-tm .form-table td{ width:auto; padding-inline-start:0; padding-inline-end:0; }
  .sf-tm-alpha .sf-tm .form-table tr + tr > td{ border-top:0; }
}

/* URL field and "Select image" / "Remove" on one line (same as the snippet editor). */
.sf-tm-image-controls{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.sf-tm-image-controls input[type="url"]{ flex:1 1 220px; width:auto; min-width:0; }
.sf-tm .sf-tm-image-controls input[type="url"]{ width:auto; }
.sf-tm-image-buttons{ flex:0 0 auto; margin-top:0; gap:8px; }
.sf-tm-image-pick.button{ min-height:36px; height:36px; line-height:34px; padding-top:0; padding-bottom:0; }
