/* =====================================================================
   FOOTER MANAGER — ADMIN UI STYLES (lightweight, no framework)
   Served only on /footer admin pages. Kept off the public site.
   Modern dark SaaS look. English UI.
   ===================================================================== */

:root {
  --bg: #0b1220;
  --bg-soft: #0f1a30;
  --card: #131f38;
  --card-2: #16223d;
  --border: #24344f;
  --border-soft: #1c2a44;
  --text: #e8eef7;
  --text-dim: #9fb0c9;
  --text-faint: #6c7f9c;
  --brand: #fe2c55;
  --brand-2: #ff5b7a;
  --accent: #38bdf8;
  --ok: #22c55e;
  --ok-bg: rgba(34, 197, 94, .12);
  --err: #f87171;
  --err-bg: rgba(248, 113, 113, .12);
  --warn: #fbbf24;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(254, 44, 85, .10), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(56, 189, 248, .10), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--accent); }
.container { max-width: 1000px; margin: 0 auto; padding: 28px 20px 64px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 400px;
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 34px 30px;
}
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-logo .dot, .topbar .dot {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; font-weight: 800; color: #fff;
  box-shadow: 0 6px 16px rgba(254, 44, 85, .35);
}
.login-logo h1 { font-size: 18px; margin: 0; letter-spacing: .2px; }
.login-sub { color: var(--text-dim); font-size: 13px; margin: -8px 0 22px; }

/* ---------- Header ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar .brand { display: flex; align-items: center; gap: 12px; }
.topbar .dot { width: 40px; height: 40px; border-radius: 11px; }
.topbar h1 { font-size: 20px; margin: 0; }
.topbar p { margin: 2px 0 0; color: var(--text-dim); font-size: 13px; }

/* ---------- Stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat .n { font-size: 26px; font-weight: 800; }
.stat .l { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.stat.ok .n { color: var(--ok); }
.stat.off .n { color: var(--warn); }

/* ---------- Cards ---------- */
/* overflow stays visible so the action tooltips are not clipped */
.card { background: var(--card); border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 22px; overflow: visible; }
.card-head { padding: 18px 20px 6px; }
.card-head h2 { font-size: 15px; margin: 0; letter-spacing: .3px; }
.card-head .hint { color: var(--text-faint); font-size: 12.5px; margin-top: 4px; }
.card-body { padding: 16px 20px 20px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 12.5px; color: var(--text-dim); margin: 0 0 6px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=url], input[type=password], input[type=number], textarea, select {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 13px; font-size: 14px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease; font-family: inherit;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 189, 248, .18); }
textarea { resize: vertical; min-height: 46px; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: transparent; border: 0; color: var(--text-faint); cursor: pointer; padding: 8px; font-size: 13px; border-radius: 8px; }
.pw-toggle:hover { color: var(--text); background: rgba(255,255,255,.04); }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 44px; height: 25px; border-radius: 999px; background: #33425f; position: relative; transition: background .18s ease; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: transform .18s ease; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.switch input:checked + .track { background: linear-gradient(135deg, var(--ok), #16a34a); }
.switch input:checked + .track::after { transform: translateX(19px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(56,189,248,.35); }
.switch .txt { font-size: 13px; color: var(--text-dim); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer; transition: transform .05s ease, background .15s ease, border-color .15s ease, opacity .15s; text-decoration: none; font-family: inherit; line-height: 1; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-full { width: 100%; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: rgba(255,255,255,.04); }
.btn-sm { padding: 7px 11px; font-size: 12.5px; }
.btn-danger { background: var(--err-bg); border-color: rgba(248,113,113,.4); color: #fecaca; }
.btn-danger:hover { background: rgba(248,113,113,.2); }
.btn-icon { padding: 7px 9px; font-size: 13px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; flex-wrap: wrap; }

/* ---------- Inline SVG icons ---------- */
.ic {
  width: 18px; height: 18px; flex: none; display: block;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform .2s cubic-bezier(.34, 1.4, .64, 1);
}
.btn .ic { width: 16px; height: 16px; }
.btn-sm .ic { width: 15px; height: 15px; }

/* ---------- Icon action buttons (Edit / Disable / Delete / Move) ---------- */
.icon-btn {
  width: 38px; height: 38px; padding: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--bg-soft); color: var(--text-dim); cursor: pointer;
  position: relative; font-family: inherit;
  transition: color .2s ease, background .2s ease, border-color .2s ease,
              transform .2s ease, box-shadow .2s ease;
}
.icon-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, .32); }
.icon-btn:active { transform: translateY(0) scale(.94); box-shadow: none; }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(56, 189, 248, .45); }
.icon-btn:disabled { opacity: .3; cursor: not-allowed; transform: none; box-shadow: none; }
.icon-btn:disabled:hover { background: var(--bg-soft); border-color: var(--border); color: var(--text-dim); }

.act-edit:hover   { color: #7dd3fc; border-color: rgba(56, 189, 248, .55); background: rgba(56, 189, 248, .14); }
.act-edit:hover .ic { transform: rotate(-8deg); }
.act-hide:hover   { color: #fcd34d; border-color: rgba(251, 191, 36, .55); background: rgba(251, 191, 36, .14); }
.act-show:hover   { color: #86efac; border-color: rgba(34, 197, 94, .55);  background: rgba(34, 197, 94, .14); }
.act-delete:hover { color: #fca5a5; border-color: rgba(248, 113, 113, .55); background: rgba(248, 113, 113, .14); }
.act-delete:hover .ic { transform: translateY(-1px) rotate(6deg); }
.act-move:hover   { color: var(--text); border-color: var(--accent); background: rgba(56, 189, 248, .12); }
.act-move:hover .ic { transform: scale(1.15); }

/* Edit toggles between a pencil and an X while the form is open */
.act-edit .ic-close { display: none; }
.act-edit.is-open { color: #7dd3fc; border-color: rgba(56, 189, 248, .55); background: rgba(56, 189, 248, .14); }
.act-edit.is-open .ic-edit { display: none; }
.act-edit.is-open .ic-close { display: block; }
.act-edit.is-open:hover .ic { transform: rotate(90deg); }

/* Tooltip */
.icon-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translate(-50%, 5px);
  background: #060a14; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 9px; font-size: 11.5px; font-weight: 600; line-height: 1;
  white-space: nowrap; pointer-events: none; opacity: 0; z-index: 20;
  box-shadow: var(--shadow-sm);
  transition: opacity .18s ease, transform .18s ease;
}
.icon-btn[data-tip]:hover::after,
.icon-btn[data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.icon-btn:disabled::after { display: none; }

/* ============ STYLE CONTROLS (color / bold / italic / size) ============ */
.style-block {
  background: var(--card-2); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 18px; margin: 18px 0 0;
}
.style-block .sb-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border-soft);
}
.style-block .sb-title { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .7px; font-weight: 700; }
.style-block .sb-note { font-size: 11.5px; color: var(--text-faint); }
.style-block .sb-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 8px; line-height: 1.5; }

/* live preview chip */
.color-preview {
  display: flex; align-items: center; gap: 12px;
  background: #0a0f1c; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 16px; margin-bottom: 18px; min-height: 52px;
}
.color-preview .cp-dot { width: 24px; height: 24px; border-radius: 7px; border: 1px solid rgba(255,255,255,.25); flex: none; }
.color-preview .cp-sample {
  font-weight: 600; font-size: 15px; line-height: 1.3;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.color-preview .cp-hex {
  color: var(--text-faint); font-size: 12px; font-variant-numeric: tabular-nums;
  margin-left: auto; padding-left: 10px; flex: none; text-transform: lowercase;
}

/* presets | custom — two clearly separated columns */
.color-area {
  display: grid; grid-template-columns: minmax(0, 1fr) 250px;
  gap: 22px; align-items: start;
}
.color-area > div { min-width: 0; }
.color-area .ca-custom {
  padding-left: 22px; border-left: 1px solid var(--border-soft);
}

.swatches { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.swatch {
  width: 34px; height: 34px; min-width: 34px; min-height: 34px;
  border-radius: 9px; cursor: pointer; padding: 0;
  border: 2px solid rgba(255,255,255,.18); position: relative;
  transition: transform .1s ease, border-color .1s ease; outline: none;
}
.swatch:hover { transform: scale(1.1); }
.swatch:focus-visible { box-shadow: 0 0 0 3px rgba(56,189,248,.5); }
.swatch.selected { border-color: #fff; transform: scale(1.08); box-shadow: 0 0 0 3px var(--accent); }
.swatch.selected::after {
  content: "✓"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 16px; font-weight: 900; color: #000;
  text-shadow: 0 0 3px rgba(255,255,255,.95), 0 0 6px rgba(255,255,255,.7);
}
.swatch.light.selected::after { color: #000; }
.swatch.dark.selected::after { color: #fff; text-shadow: 0 0 3px rgba(0,0,0,.9); }

.custom-row { display: flex; align-items: center; gap: 10px; }
.custom-row input[type=color] {
  width: 46px; height: 42px; min-width: 46px; padding: 3px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-soft); cursor: pointer; flex: none;
}
.custom-row input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.custom-row input[type=color]::-webkit-color-swatch { border: 0; border-radius: 6px; }
.custom-row input[type=color]::-moz-color-swatch { border: 0; border-radius: 6px; }
.custom-row .hexbox { flex: 1; min-width: 0; text-transform: lowercase; font-variant-numeric: tabular-nums; }
.hexbox.invalid { border-color: var(--err); box-shadow: 0 0 0 3px rgba(248,113,113,.18); }

.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border-soft); }
.style-toggle-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toggle-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 15px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-soft); cursor: pointer; font-size: 13.5px; color: var(--text-dim); user-select: none;
  transition: border-color .12s, background .12s, color .12s;
}
.toggle-chip input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.toggle-chip.on { border-color: var(--accent); color: var(--text); background: rgba(56,189,248,.12); }
.size-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.size-row input[type=number] { width: 74px; text-align: center; -moz-appearance: textfield; }
.size-row input[type=number]::-webkit-outer-spin-button,
.size-row input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.size-row .step {
  width: 34px; height: 42px; flex: none; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text);
  font-size: 16px; line-height: 1; cursor: pointer; font-family: inherit;
  transition: background .12s, border-color .12s;
}
.size-row .step:hover { background: rgba(255,255,255,.06); border-color: var(--accent); }
.size-row .tag { white-space: nowrap; }

/* footer row of a form: Active switch on the left, buttons on the right */
.edit-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.edit-foot .form-actions { margin-top: 0; }

/* ---------- Layout settings ---------- */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { background: var(--bg-soft); color: var(--text-dim); border: 0; padding: 10px 18px; cursor: pointer; font-size: 13px; font-family: inherit; transition: background .12s, color .12s; }
.seg button:hover { background: rgba(255,255,255,.04); }
.seg button.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type=range] { flex: 1; accent-color: var(--accent); }
.range-val { min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* ---------- Links list ---------- */
.links { display: flex; flex-direction: column; gap: 10px; }
.link-row { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 12px; background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 12px 14px; transition: border-color .15s ease, background .15s ease; }
.link-row.dragging { opacity: .5; }
.link-row.drag-over { border-color: var(--accent); }
.link-row.editing { border-color: var(--border); background: var(--card-2); align-items: start; }
.link-row.editing .grip, .link-row.editing .link-actions { padding-top: 2px; }
.grip { cursor: grab; color: var(--text-faint); display: flex; align-items: center; justify-content: center; user-select: none; border-radius: 8px; padding: 6px 0; transition: color .18s ease, background .18s ease; }
.grip:hover { color: var(--text); background: rgba(255,255,255,.06); }
.grip:active { cursor: grabbing; }
.link-main { min-width: 0; }
.link-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.link-swatch { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(255,255,255,.3); display: inline-block; flex: none; }
.link-url { color: var(--text-faint); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; letter-spacing: .3px; }
.badge.on { background: var(--ok-bg); color: #86efac; }
.badge.off { background: rgba(251,191,36,.14); color: #fde68a; }
.tag { font-size: 10.5px; padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.06); color: var(--text-faint); }
.link-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pos-btns { display: inline-flex; flex-direction: column; gap: 4px; margin-right: 4px; }
.pos-btns .act-move { width: 30px; height: 26px; border-radius: 8px; }
.pos-btns .act-move .ic { width: 15px; height: 15px; }
.pos-btns .act-move[data-tip]::after { bottom: auto; top: 50%; left: auto; right: calc(100% + 8px); transform: translate(5px, -50%); }
.pos-btns .act-move[data-tip]:hover::after { transform: translate(0, -50%); }
.grip .ic { width: 18px; height: 18px; margin: 0 auto; stroke-width: 2.6; }

.edit-form { display: none; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
.edit-form.open { display: block; }
.edit-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; }
.edit-grid .field { margin-bottom: 0; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 34px 20px; color: var(--text-dim); }
.empty .big { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }

/* ---------- Preview ---------- */
.preview { background: #0a0f1c; border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 20px; }
.preview .pv-copy { color: var(--text-dim); font-size: 13px; text-align: center; }
.preview .pv-links { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; column-gap: 12px; row-gap: 6px; line-height: 1.8; }
.preview .pv-links a { text-decoration: none; }
.preview .pv-sep { opacity: .4; }
.preview .pv-break { flex-basis: 100%; height: 0; }
.preview .pv-empty { color: var(--text-faint); font-size: 13px; margin-top: 8px; text-align: center; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 240px; max-width: 360px; padding: 13px 15px; border-radius: var(--radius-sm); font-size: 13.5px; box-shadow: var(--shadow); border: 1px solid var(--border); background: var(--card); display: flex; align-items: flex-start; gap: 10px; animation: toast-in .25s ease; }
.toast.success { border-color: rgba(34,197,94,.4); background: linear-gradient(180deg, var(--ok-bg), var(--card)); }
.toast.error { border-color: rgba(248,113,113,.4); background: linear-gradient(180deg, var(--err-bg), var(--card)); }
.toast .ic { font-weight: 800; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Alerts ---------- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent; }
.alert.error { background: var(--err-bg); border-color: rgba(248,113,113,.35); color: #fecaca; }
.alert.warn { background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.35); color: #fde68a; }
.foot-note { color: var(--text-faint); font-size: 12px; text-align: center; margin-top: 26px; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(4, 8, 18, .66); display: none; align-items: center; justify-content: center; z-index: 70; padding: 20px; backdrop-filter: blur(2px); }
.modal-back.open { display: flex; }
.modal { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 24px; }
.modal h3 { margin: 0 0 8px; font-size: 16px; }
.modal p { margin: 0 0 20px; color: var(--text-dim); font-size: 13.5px; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .color-area { grid-template-columns: 1fr; gap: 18px; }
  .color-area .ca-custom {
    border-left: 0; padding-left: 0; padding-top: 18px;
    border-top: 1px solid var(--border-soft);
  }
  .custom-row .hexbox { max-width: 240px; }
}
@media (max-width: 720px) {
  .container { padding: 20px 14px 56px; }
  .stats { grid-template-columns: 1fr; }
  .link-row { grid-template-columns: 22px 1fr; }
  .link-actions { grid-column: 1 / -1; justify-content: flex-start; margin-top: 6px; }
  .edit-grid, .style-grid, .settings-grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; }
  .style-block { padding: 14px; }
  .edit-foot { align-items: flex-start; }
  .custom-row .hexbox { max-width: none; }
}
