/* =========================================================
   Frankly Media - SERP Snippet Simulator UI (Modern)
   Namespace: .fm-serp-sim
   ========================================================= */

/* ---- Theme tokens ---- */
.fm-serp-sim{
  --fm-bg: #f6f7fb;
  --fm-card: #ffffff;
  --fm-text: #111827;
  --fm-muted: #6b7280;
  --fm-border: #e5e7eb;
  --fm-border-2: #dbe1ea;
  --fm-shadow: 0 10px 30px rgba(17, 24, 39, 0.10);
  --fm-shadow-2: 0 6px 18px rgba(17, 24, 39, 0.10);
  --fm-radius: 16px;
  --fm-radius-sm: 12px;

  --fm-blue: #2563eb;
  --fm-blue-2: #1d4ed8;
  --fm-blue-soft: rgba(37,99,235,0.10);

  --fm-green: #16a34a;
  --fm-red: #dc2626;

  --fm-font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  font-family: var(--fm-font);
  color: var(--fm-text);
}

/* Basic reset inside the widget to avoid Divi bleed */
.fm-serp-sim *{ box-sizing: border-box; }
.fm-serp-sim h1, .fm-serp-sim h2, .fm-serp-sim h3, .fm-serp-sim h4, .fm-serp-sim p{ margin: 0; }
.fm-serp-sim button, .fm-serp-sim input, .fm-serp-sim textarea{ font-family: var(--fm-font); }
.fm-serp-sim label{
  display:block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #374151;
  margin-bottom: 6px;
}

/* Outer wrap */
.fm-serp-sim .fm-wrap{
  background: var(--fm-bg);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-radius);
  box-shadow: var(--fm-shadow);
  padding: 22px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
.fm-serp-sim .fm-top{
  display:flex;
  align-items:flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.fm-serp-sim .fm-title{
  font-size: 28px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.fm-serp-sim .fm-sub{
  margin-top: 6px;
  font-size: 14px;
  color: var(--fm-muted);
}

/* Tabs */
.fm-serp-sim .fm-tabs{
  display:flex;
  gap: 8px;
  align-items:center;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--fm-border);
  border-radius: 999px;
  box-shadow: 0 1px 0 rgba(17,24,39,0.04);
}
.fm-serp-sim .fm-tab{
  appearance:none;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  cursor:pointer;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}
.fm-serp-sim .fm-tab[aria-selected="true"]{
  background: var(--fm-blue-soft);
  color: var(--fm-blue-2);
  box-shadow: inset 0 0 0 1px rgba(37,99,235,0.20);
}
.fm-serp-sim .fm-tab:hover{ background: rgba(17,24,39,0.04); }

/* Layout grid */
.fm-serp-sim .fm-grid{
  display:grid;
  grid-template-columns: 420px 1fr;
  gap: 18px;
  align-items:start;
}
@media (max-width: 980px){
  .fm-serp-sim .fm-grid{ grid-template-columns: 1fr; }
}

/* Panels */
.fm-serp-sim .fm-panel,
.fm-serp-sim .fm-preview{
  background: var(--fm-card);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-radius);
  box-shadow: var(--fm-shadow-2);
  overflow:hidden;
}

/* Left panel padding */
.fm-serp-sim .fm-panel{
  padding: 16px;
}
.fm-serp-sim .fm-row{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 980px){
  .fm-serp-sim .fm-row{ grid-template-columns: 1fr; }
}

/* Inputs */
.fm-serp-sim input[type="text"],
.fm-serp-sim input[type="url"],
.fm-serp-sim textarea{
  width:100%;
  border: 1px solid var(--fm-border-2);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--fm-text);
  background: #fff;
  outline: none;
  transition: box-shadow 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.fm-serp-sim textarea{
  min-height: 96px;
  resize: vertical;
}
.fm-serp-sim input:focus,
.fm-serp-sim textarea:focus{
  border-color: rgba(37,99,235,0.55);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.12);
}
.fm-serp-sim input::placeholder,
.fm-serp-sim textarea::placeholder{
  color: #9ca3af;
}

/* Buttons */
.fm-serp-sim .fm-actions{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items:center;
}
.fm-serp-sim .fm-btn{
  appearance:none;
  border: 1px solid var(--fm-border);
  background: #fff;
  color: #111827;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  cursor:pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease, background 120ms ease;
}
.fm-serp-sim .fm-btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(17,24,39,0.10);
}
.fm-serp-sim .fm-btn:disabled{
  opacity: 0.55;
  cursor:not-allowed;
  transform:none;
  box-shadow:none;
}
.fm-serp-sim .fm-btn.primary{
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  border-color: rgba(29,78,216,0.70);
  color: #fff;
}
.fm-serp-sim .fm-btn.primary:hover{
  box-shadow: 0 12px 22px rgba(37,99,235,0.25);
}

/* Source rows */
.fm-serp-sim .fm-src-row{
  display:grid;
  grid-template-columns: 1fr 1fr 40px;
  gap: 10px;
  margin-bottom: 10px;
}
@media (max-width: 980px){
  .fm-serp-sim .fm-src-row{ grid-template-columns: 1fr; }
}
.fm-serp-sim .fm-x{
  appearance:none;
  border: 1px solid var(--fm-border);
  background: #fff;
  border-radius: 12px;
  cursor:pointer;
  font-weight: 900;
  height: 42px;
}
.fm-serp-sim .fm-x:hover{ background: rgba(17,24,39,0.04); }

/* Notes + errors */
.fm-serp-sim .fm-note{
  margin-top: 12px;
  font-size: 12px;
  color: var(--fm-muted);
  line-height: 1.4;
}
.fm-serp-sim .fm-err{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(220,38,38,0.25);
  background: rgba(220,38,38,0.08);
  color: #991b1b;
  font-size: 13px;
  font-weight: 700;
}

/* Right panel header controls */
.fm-serp-sim .fm-preview{
  padding: 14px;
}
.fm-serp-sim .fm-device{
  display:flex;
  justify-content:flex-end;
  gap: 8px;
  margin-bottom: 12px;
}
.fm-serp-sim .fm-pill{
  appearance:none;
  border: 1px solid var(--fm-border);
  background:#fff;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  cursor:pointer;
}
.fm-serp-sim .fm-pill[aria-pressed="true"]{
  background: var(--fm-blue-soft);
  border-color: rgba(37,99,235,0.25);
  color: var(--fm-blue-2);
}

/* Preview card base */
.fm-serp-sim .serp-card,
.fm-serp-sim .aio-card{
  background: #fff;
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-radius);
  overflow: hidden;
}

/* Make preview feel like a "SERP canvas" */
.fm-serp-sim .serp-card{
  padding: 18px;
  box-shadow: inset 0 1px 0 rgba(17,24,39,0.03);
}

/* SERP header */
.fm-serp-sim .serp-head{
  display:flex;
  align-items:center;
  gap: 10px;
  margin-bottom: 10px;
}
.fm-serp-sim .serp-fav{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(37,99,235,0.10);
  border: 1px solid rgba(37,99,235,0.18);
  display:flex;
  align-items:center;
  justify-content:center;
  color: var(--fm-blue-2);
  font-weight: 900;
  font-size: 13px;
}
.fm-serp-sim .serp-site span{
  display:block;
  line-height: 1.1;
}
.fm-serp-sim .serp-site span:first-child{
  font-size: 13px;
  font-weight: 800;
}
.fm-serp-sim .serp-domain{
  font-size: 12px;
  color: var(--fm-muted);
  margin-top: 2px;
}

/* URL line */
.fm-serp-sim .serp-url{
  font-size: 12px;
  color: #374151;
  margin-bottom: 6px;
}

/* Title + desc */
.fm-serp-sim .serp-title{
  font-size: 20px;
  line-height: 1.25;
  font-weight: 800;
  color: #1a0dab; /* classic SERP blue */
  margin-bottom: 6px;
}
.fm-serp-sim .serp-title strong,
.fm-serp-sim .serp-desc strong{
  font-weight: 900;
}
.fm-serp-sim .serp-desc{
  font-size: 14px;
  line-height: 1.45;
  color: #374151;
}
.fm-serp-sim .serp-date{
  color: var(--fm-muted);
  font-weight: 700;
}

/* KPI chips */
.fm-serp-sim .fm-kpis{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.fm-serp-sim .fm-kpi{
  border: 1px solid var(--fm-border);
  background: #fff;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  color: #374151;
}
.fm-serp-sim .fm-kpi strong{
  color: #111827;
}

/* AI Overview */
.fm-serp-sim .aio-card{
  padding: 16px;
}
.fm-serp-sim .aio-label{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  font-size: 12px;
  font-weight: 900;
  color: #111827;
  background: rgba(37,99,235,0.10);
  border: 1px solid rgba(37,99,235,0.18);
  padding: 6px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.fm-serp-sim .aio-heading{
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.fm-serp-sim .aio-text{
  font-size: 14px;
  color: #374151;
  line-height: 1.55;
  margin-bottom: 10px;
}
.fm-serp-sim .aio-bullets{
  margin: 0 0 12px 18px;
  padding: 0;
  color: #374151;
  font-size: 14px;
  line-height: 1.5;
}
.fm-serp-sim .aio-sources{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
@media (max-width: 980px){
  .fm-serp-sim .aio-sources{ grid-template-columns: 1fr; }
}
.fm-serp-sim .aio-src{
  border: 1px solid var(--fm-border);
  background: #fff;
  border-radius: 14px;
  padding: 10px 12px;
}
.fm-serp-sim .aio-src-title{
  font-size: 13px;
  font-weight: 900;
  color: #111827;
  margin-bottom: 4px;
}
.fm-serp-sim .aio-src-domain{
  font-size: 12px;
  color: var(--fm-muted);
}

/* Make mobile feel more "phone-like" without extra markup */
@media (min-width: 981px){
  .fm-serp-sim .fm-preview{
    position: relative;
  }
}

/* =========================================================
   Mangools-style SERP frame + segmented toggle + actions
   (append at end of app.css)
   ========================================================= */

.fm-serp-sim{
  --fm-surface: #ffffff;
  --fm-surface-2: #f3f4f6;
  --fm-line: #e5e7eb;
  --fm-shadow-soft: 0 8px 20px rgba(17,24,39,0.10);
}

/* Segmented control (Desktop/Mobile) */
.fm-serp-sim .fm-device{
  justify-content: flex-end;
  margin-bottom: 12px;
}
.fm-serp-sim .fm-seg{
  display: inline-flex;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--fm-line);
  border-radius: 999px;
  box-shadow: 0 1px 0 rgba(17,24,39,0.04);
  gap: 4px;
}
.fm-serp-sim .fm-pill{
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 8px 10px;
  font-weight: 900;
}
.fm-serp-sim .fm-pill[aria-pressed="true"]{
  background: rgba(37,99,235,0.12);
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(37,99,235,0.20);
}

/* Actions bar (left panel bottom) */
.fm-serp-sim .fm-actions-bar{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items:center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--fm-line);
}
.fm-serp-sim .fm-btn.ghost{
  background: #fff;
}
.fm-serp-sim .fm-btn.danger{
  border-color: rgba(220,38,38,0.25);
  background: rgba(220,38,38,0.06);
  color: #991b1b;
}

/* SERP frame wrapper */
.fm-serp-sim .fm-serp-frame{
  border: 1px solid var(--fm-line);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--fm-shadow-soft);
}

/* Topbar */
.fm-serp-sim .fm-serp-topbar{
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border-bottom: 1px solid var(--fm-line);
  padding: 12px 14px;
}

.fm-serp-sim .fm-serp-toprow{
  display:flex;
  align-items:center;
  gap: 12px;
}

.fm-serp-sim .fm-g-logo{
  font-weight: 1000;
  letter-spacing: -0.02em;
  font-size: 18px;
  color: #111827;
  user-select:none;
}

.fm-serp-sim .fm-serp-search{
  flex: 1;
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--fm-line);
  background: #fff;
  box-shadow: 0 6px 18px rgba(17,24,39,0.06);
}

.fm-serp-sim .fm-serp-search .fm-chip{
  font-size: 11px;
  font-weight: 900;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(37,99,235,0.12);
  color: #1d4ed8;
  border: 1px solid rgba(37,99,235,0.18);
}

.fm-serp-sim .fm-serp-search .fm-q{
  font-size: 13px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* SERP tabs */
.fm-serp-sim .fm-serp-tabs{
  margin-top: 10px;
  display:flex;
  gap: 14px;
  font-size: 12px;
  color: #6b7280;
  padding-left: 44px;
}
.fm-serp-sim .fm-serp-tabs .on{
  color: #1d4ed8;
  font-weight: 900;
  position: relative;
}
.fm-serp-sim .fm-serp-tabs .on:after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:-10px;
  height: 2px;
  background:#1d4ed8;
  border-radius: 2px;
}

/* SERP content area inside frame */
.fm-serp-sim .fm-serp-body{
  background: #fff;
  padding: 14px;
}

/* When mobile: make frame feel narrower + centered */
.fm-serp-sim .fm-mobile-wrap{
  max-width: 360px;
  margin: 0 auto;
}
