/* ======= Base ======= */
:root{
  --bg:#f4f6fb;
  --ink:#0f172a;
  --muted:#64748b;
  --primary:#2154c3;
  --primary-600:#1a4299;
  --danger:#dc3545;
  --radius:12px;
  --shadow:0 8px 22px rgba(16,24,40,.08);
}
*{box-sizing:border-box}

/* Keep a stable vertical scrollbar to prevent layout shift/bounce */
html,body{height:100%;overflow-y:scroll;scrollbar-gutter:stable}
body{
  margin:0;
  font-family:Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background:var(--bg);
  color:var(--ink);
}

/* ======= Layout ======= */
.container{max-width:1200px;margin:24px auto;padding:0 16px}
.layout{display:grid;grid-template-columns:260px 1fr;gap:20px}

/* Sidebar */
.sidebar{
  background:#0b1220;color:#e6eaf2;border-radius:16px;
  box-shadow:var(--shadow);padding:18px;position:sticky;top:16px;
  height:calc(100vh - 56px)
}
.side-title{font-weight:800;color:#fff;margin:2px 0 14px}
.side-group{margin:16px 0}
.caption{font-size:12px;color:#97a6ba;text-transform:uppercase;letter-spacing:.12em;margin-bottom:8px}
.side-link{
  display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:10px;
  color:#e6eaf2;text-decoration:none;border:1px solid rgba(255,255,255,.06);
  transition:background .18s ease, transform .18s ease, border-color .18s ease;
}
.side-link:hover{background:rgba(255,255,255,.06);transform:translateX(2px)}
#hrefDeployAll.side-link{background:var(--danger);border-color:var(--danger);color:#fff}

/* ======= Main ======= */
main{display:grid;gap:10px;overscroll-behavior:contain} /* stop page bounce at panel edges */
.panel{background:#fff;border-radius:16px;box-shadow:var(--shadow);padding:18px}
.panel h2{margin:0 0 6px;font-size:20px}
.muted{color:var(--muted);font-size:14px}

/* Filter panel: remove excess bottom space */
.panel.filters{padding-bottom:8px !important;}
.panel.filters .form{gap:8px !important;margin:0 !important;}
.panel.filters .row{gap:8px !important;margin:0 !important;}
.panel.filters .actions{margin-top:0 !important;}

/* Keep the Filter Websites card a fixed height */
.panel.filters {
  max-height: 240px;         /* adjust as needed */
  overflow: hidden;          /* prevent it from stretching with content */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* Compact filter panel */
.panel.filters {
  display: inline-block;
  width: 100%;
  max-height: none;
  padding-bottom: 12px !important;
  margin-bottom: 8px !important;
}

/* Remove excessive grid spacing between panels */
main {
  display: flex;
  flex-direction: column;
  gap: 12px; /* tighten spacing */
}

/* Optional — better visual alignment */
.panel.filters form {
  margin-bottom: 0;
}


/* ======= Forms ======= */
.form{display:grid;gap:16px}
.row{display:grid;gap:12px;grid-template-columns:1fr 1fr}
.input, select{
  width:100%;padding:12px 14px;border:1px solid #e5e7eb;border-radius:10px;font-size:15px
}
.input:focus, select:focus{outline:none;border-color:var(--primary);box-shadow:0 0 0 4px rgba(33,84,195,.12)}
.radio-col{display:flex;flex-direction:column;gap:8px}

/* ======= Color pickers (cards) ======= */
.color-row{display:grid;gap:12px;grid-template-columns:repeat(4,1fr)}
.color-card{
  background:#f9fafb;border:1px solid #e5e7eb;border-radius:12px;padding:10px;
  box-shadow:0 2px 6px rgba(0,0,0,.04);text-align:center;
  transition:transform .2s ease, box-shadow .2s ease;
}
.color-card:hover{transform:translateY(-2px);box-shadow:0 4px 12px rgba(0,0,0,.08)}
.color-card label{display:block;font-size:13px;color:#334155;margin-bottom:6px;font-weight:600}
input[type="color"].swatch{width:100%;height:50px;border:none;border-radius:8px;cursor:pointer;padding:0}

/* ======= Buttons ======= */
.actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

/* Base button */
.btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:12px 16px;
  border-radius:10px;
  border:1px solid transparent;
  background:var(--primary);
  color:#fff;
  font-weight:700;
  text-decoration:none;
  cursor:pointer;
  font-size:15px;
  transition:background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

/* Make sure anchor buttons look the same */
.btn,
a.btn{
  font-size:15px;
}

/* Primary hover */
.btn:hover{
  background:var(--primary-600);
  transform:translateY(-1px);
  box-shadow:0 4px 10px rgba(15,23,42,0.18);
}

/* Secondary / alt buttons (e.g. "Manage Inner Sections") */
.btn.alt{
  background:#eef2ff;
  color:#1f2a72;
  border-color:#d9dfff;
}

/* Alt hover */
.btn.alt:hover{
  background:#e0e7ff;
  transform:translateY(-1px);
  box-shadow:0 4px 10px rgba(15,23,42,0.12);
}

.mt-sm{
  margin-top:6px;
  display:inline-block;
}



/* ======= URL List / List Page ======= */
.url-list{
  position:relative;
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:12px;
  box-shadow:0 2px 6px rgba(16,24,40,.05);
  padding:0;                          /* rows/header handle padding */
  max-height:60vh;                    /* makes list scroll inside the card */
  overflow:auto;                      /* key: list is the scroll container */
  overscroll-behavior:contain;        /* stop scroll chaining/bounce */
  -webkit-overflow-scrolling:touch;   /* smooth on iOS */
}
.url-item{
  display:flex;align-items:center;justify-content:space-between;
  gap:12px;padding:10px 14px;border-bottom:1px solid #f1f5f9;background:#fff;
}
.url-item:last-child{border-bottom:none}

/* Sticky header that fully covers rows and stays on top */
.url-item--header{
  position:sticky;top:0;z-index:20;background:#fff;padding:10px 14px;
  border-bottom:1px solid #e5e7eb;box-shadow:0 1px 0 rgba(0,0,0,.02);
}

/* Keep URL text + external link on one line; no weird wrapping */
.url-label{
  display:flex;align-items:center;gap:6px;margin:0;line-height:1.4;min-width:0;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.url-item .left{display:flex;align-items:center;gap:8px;flex:1;min-width:0}
.url-item .left a{color:var(--primary);text-decoration:none}
.url-item .left a:hover{text-decoration:underline}

/* Keep the Edit action on the same row */
.url-item .right{white-space:nowrap;margin-left:12px}
.url-item .right .mini-link{
  display:inline-block;
  font-weight:700;font-size:13px;color:var(--primary);text-decoration:none;border:1px solid #dbe3ff;
  padding:6px 10px;border-radius:8px;background:#eef2ff;
}
.url-item .right .mini-link:hover{background:#e0e7ff}

/* Deploy button (consistent with .btn primary style) */
.deploy-btn {
  display: inline-block;
  width: 100%;
  text-align: center;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.deploy-btn:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
}

.deploy-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Disable state for deploy button */
.deploy-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px; /* 👈 adds space above button area */
}

/* ======= Responsive ======= */
@media (max-width:980px){
  .layout{grid-template-columns:1fr}
  .sidebar{position:relative;height:auto}
  .row{grid-template-columns:1fr}
  .color-row{grid-template-columns:1fr 1fr}
}


.ftp-path-wrapper {
  position: relative;
  width: 100%;
}
.ftp-placeholder {
  position: absolute;
  top: 8px;
  left: 12px;
  color: #888;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.ftp-path-wrapper input:focus + .ftp-placeholder,
.ftp-path-wrapper input:not(:placeholder-shown) + .ftp-placeholder {
  opacity: 0;
}

/* Danger variant to match 'Deploy All' */
.btn.danger{background:var(--danger);color:#fff;border-color:var(--danger)}
.btn.danger:hover{background:#b02a37}

/* Ensure anchor buttons inherit sizing/decoration */
a.btn, a.btn.alt{ text-decoration:none; }


/* Vanilla modal (no Bootstrap) */
.vmodal{position:fixed;inset:0;align-items:center;justify-content:center;z-index:1000}
.vmodal[aria-hidden="true"]{display:none}
.vmodal[aria-hidden="false"]{display:flex}
.vmodal-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.55)}
.vmodal-card{
  position:relative;background:#fff;border-radius:16px;box-shadow:var(--shadow);
  width:min(1000px,92vw);max-height:90vh;overflow:auto;padding:16px;
}
.vmodal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.vmodal-close{display:inline-flex;align-items:center;gap:6px;padding:8px 12px;border-radius:8px;
  background:#eef2ff;color:#1f2a72;border:1px solid #d9dfff;cursor:pointer}
.vmodal-body textarea{width:100%}


/* ---------- Utilities (pages without sidebar) ---------- */
.center-wrap{max-width:900px;margin:48px auto;padding:0 16px}

/* ---------- Status badge ---------- */
.status-badge{
  display:inline-block;font-weight:700;font-size:12px;
  padding:4px 8px;border-radius:999px;background:#eef2ff;color:#1f2a72
}

/* ---------- Progress card ---------- */
.progress-card{
  background:#f9fafb;border:1px solid #e5e7eb;border-radius:12px;padding:14px
}
.bar{height:14px;background:#e6eaf2;border-radius:999px;overflow:hidden}
.bar > .fill{height:100%;width:0%;background:var(--primary);transition:width .25s ease}
.bar-label{display:flex;justify-content:space-between;margin-top:8px;font-size:13px;color:var(--muted)}

/* ---------- Activity log ---------- */
.log{margin-top:16px;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden}
.log-header{background:#f1f5f9;padding:10px 12px;font-weight:700}
.log-body{max-height:360px;overflow:auto;background:#fff}
.log-row{padding:10px 12px;border-top:1px solid #f1f5f9;display:flex;gap:8px;align-items:center}
.log-row:first-child{border-top:none}
.chip{font-size:12px;border-radius:999px;padding:2px 8px}
.chip.ok{background:rgba(23,128,61,.12);color:#17803d}
.chip.fail{background:rgba(220,53,69,.12);color:var(--danger)}
.chip.pending{background:#eef2ff;color:#1f2a72}
.chip.stopped{background:#fff7e6;color:#8a5a14;border:1px solid #ffe3b3}

/* ---------- Danger button variant (matches dashboard) ---------- */
.btn.danger{background:var(--danger);border-color:var(--danger);color:#fff}
.btn.danger:hover{background:#b52a36}


.loid-chip {
  display: inline-block;
  width: 58px;            /* 🔥 fixed width for perfect alignment */
  text-align: center;     /* center the numbers */
  padding: 3px 0;
  font-size: 11px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-right: 10px;
  white-space: nowrap;
}


/* ---------- Add Custom Section Page ---------- */

.page-centered {
  display: flex;
  justify-content: center;
  padding: 40px 16px;
}

.card-simple {
  width: 100%;
  max-width: 700px;
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-simple h2 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
}

.card-simple .muted {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 16px;
}

.form-row {
  margin-bottom: 18px;
}

label {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

input[type="text"],
input[type="file"] {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 15px;
}

input[type="text"]:focus,
input[type="file"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(33,84,195,.12);
}

.btn-primary {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
}

.btn-primary:hover {
  background: var(--primary-600);
}


/* Add Custom Section – preview panel */
.preview-card{
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:10px;
  background:#f9fafb;
}

.preview-header{
  margin-bottom:8px;
}

.preview-frame-wrap{
  border-radius:10px;
  overflow:hidden;
  border:1px solid #e5e7eb;
  background:#fff;
}

.preview-frame{
  width:100%;
  min-height:260px;
  border:none;
}

/* ----- Add Custom Section layout tweaks ----- */
.helper-text{
  margin-top:4px;
}

/* Wrapper for the large preview card */
.full-preview-wrap{
  max-width:1200px;
  margin:24px auto 48px;
  padding:0 16px;
}

/* Preview card styling */
.preview-card{
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:10px;
  background:#f9fafb;
}

.preview-header{
  margin-bottom:8px;
}

.preview-frame-wrap{
  border-radius:10px;
  overflow:hidden;
  border:1px solid #e5e7eb;
  background:#fff;
}

/* Make the preview tall enough to see full sections */
.preview-frame{
  width:100%;
  min-height:600px; /* adjust if you want taller/shorter */
  border:none;
}

/* Ensure the Actions column aligns with the first button ("Up") */
.inner-sections th.actions-col {
  text-align: left;
  padding-left: 22px; /* matches the button group */
}

.inner-sections td.actions-col {
  padding-left: 22px;
}


/* Make all inner-sections rows the same height */
.inner-sections td,
.inner-sections th {
  height: 52px;          /* consistent row height */
  vertical-align: middle;
}

/* Prevent action button stacks from increasing row height */
.inner-sections .action-buttons {
  height: 32px;          /* fixed container height */
  align-items: center;   /* center vertically */
}


/* ---------- Keap Contacts Status Dashboard ---------- */

.contacts-header {
  margin-bottom: 12px;
}

.contacts-header h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
}

.contacts-header .muted {
  margin: 0;
}

/* Toolbar: Refresh + auto-refresh */
.contacts-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 12px 0 16px;
}

.contacts-toolbar-left,
.contacts-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.contacts-autorefresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.contacts-autorefresh input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Top stats row */
.contacts-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.contacts-stat-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: center;
}

.contacts-stat-card h3 {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.contacts-stat-card .value {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}

/* Loading state */
.contacts-loading {
  text-align: center;
  padding: 24px 8px;
}

/* Error state */
.contacts-error {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(220, 53, 69, 0.08);
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 14px;
}

/* Contacts grid/cards */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.contact-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  border: 1px solid #e5e7eb;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}

.contact-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
}

/* Card header */
.contact-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.contact-id {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}

/* Status badge variants (reuses .status-badge base) */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-badge i {
  font-size: 12px;
}

.status-new {
  background: #eef2ff;
  color: #1f2a72;
}

.status-ready {
  background: #fff7e6;
  color: #8a5a14;
}

.status-inprogress {
  background: #f3e8ff;
  color: #6b21a8;
}

.status-completed {
  background: rgba(23, 128, 61, 0.12);
  color: #17803d;
}

/* Progress strip */
.progress-section {
  margin-top: 8px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.progress-bar-container {
  width: 100%;
  height: 10px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 10px;
  font-weight: 700;
  color: #ffffff;
}

/* Card stats row */
.contact-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.contact-stat {
  text-align: center;
  background: #f9fafb;
  border-radius: 8px;
  padding: 8px;
}

.contact-stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.contact-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

/* Updated-at footer */
.contact-updated-at {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.contact-updated-at-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

/* Empty state */
.contacts-empty {
  text-align: center;
  padding: 32px 8px;
  color: var(--muted);
}

.contacts-empty i {
  font-size: 40px;
  margin-bottom: 8px;
  opacity: 0.7;
}

/* Responsive tweaks */
@media (max-width: 768px) {
  .contacts-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
