/* ==========================================================================
   Google Ads AI Campaign Builder — Light theme (brand #3417b1)
   ========================================================================== */

.ads-ai-wrapper {
    --ads-primary: #3417b1;
    --ads-bg: #ffffff;
    --ads-card-bg: #f7f6fc;
    --ads-text: #1f1b33;
    --ads-font: Vazirmatn, Tahoma, sans-serif;

    --ads-primary-dark: color-mix(in srgb, var(--ads-primary) 82%, #000);
    --ads-primary-soft: rgba(52, 23, 177, 0.08);
    --ads-primary-soft: color-mix(in srgb, var(--ads-primary) 8%, #fff);
    --ads-primary-ring: rgba(52, 23, 177, 0.18);
    --ads-primary-ring: color-mix(in srgb, var(--ads-primary) 18%, transparent);
    --ads-border: #e6e3f3;
    --ads-muted: #6b6785;
    --ads-ok: #0f8a4f;
    --ads-warn: #c0392b;

    background-color: var(--ads-bg);
    color: var(--ads-text);
    font-family: var(--ads-font);
    line-height: 1.7;
    border-radius: 16px;
    padding: 28px;
    direction: rtl;
    text-align: right;
    border: 1px solid var(--ads-border);
    box-shadow: 0 8px 30px rgba(52, 23, 177, 0.08);
    box-sizing: border-box;
}

.ads-ai-wrapper *,
.ads-ai-wrapper *::before,
.ads-ai-wrapper *::after { box-sizing: border-box; }

/* ---------- Header ---------- */
.ads-ai-header {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    padding-bottom: 16px; margin-bottom: 22px;
    border-bottom: 1px solid var(--ads-border);
}
.ads-ai-title { display: flex; align-items: center; gap: 12px; }
.ads-ai-title-icon {
    width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px;
    background: var(--ads-primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
}
.ads-ai-title-icon svg { width: 22px; height: 22px; }
.ads-ai-title h3 { margin: 0; padding: 0; color: var(--ads-text); font-size: 1.25rem; font-weight: 800; line-height: 1.4; }
.ads-ai-subtitle { margin: 2px 0 0; font-size: 0.82rem; color: var(--ads-muted); }

/* ---------- Form ---------- */
.ads-ai-controls { display: flex; gap: 16px; margin-bottom: 16px; }
.ads-control-col { flex: 1; min-width: 0; }
.ads-control-col label,
.ads-ai-form-group label {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px; font-size: 0.88rem; font-weight: 600; color: var(--ads-text);
}
.ads-kw-counter { font-weight: 500; font-size: 0.78rem; color: var(--ads-muted); }
.ads-kw-counter.is-over { color: var(--ads-warn); font-weight: 700; }

.ads-select, .ads-textarea {
    width: 100%; background-color: #fff; border: 1px solid #d6d2ea;
    color: var(--ads-text); border-radius: 10px; padding: 11px 14px; outline: none;
    font-family: inherit; font-size: 0.95rem; transition: border-color .2s, box-shadow .2s;
}
.ads-textarea { resize: vertical; min-height: 130px; line-height: 1.8; }
.ads-textarea::placeholder { color: #a39fbd; }
.ads-select:hover, .ads-textarea:hover { border-color: #b9b2e0; }
.ads-select:focus, .ads-textarea:focus {
    border-color: var(--ads-primary); box-shadow: 0 0 0 3px var(--ads-primary-ring);
}

/* ---------- Buttons ---------- */
.ads-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent; border-radius: 10px; padding: 12px 22px;
    font-family: inherit; font-weight: 700; font-size: 0.95rem; line-height: 1.4;
    cursor: pointer; transition: background-color .2s, box-shadow .2s, transform .1s, color .2s;
}
.ads-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ads-primary-ring); }
.ads-btn:active:not(:disabled) { transform: translateY(1px); }
.ads-btn:disabled { opacity: .55; cursor: not-allowed; }

.ads-btn-primary, .ads-btn-success {
    background-color: var(--ads-primary); color: #fff; width: 100%; margin-top: 12px;
    box-shadow: 0 4px 14px rgba(52, 23, 177, 0.25);
}
.ads-btn-primary:hover:not(:disabled), .ads-btn-success:hover:not(:disabled) { background-color: var(--ads-primary-dark); color: #fff; }
.ads-btn-success { margin-top: 24px; font-size: 1rem; }

.ads-btn-secondary { background: #fff; border-color: #d6d2ea; color: var(--ads-primary); padding: 8px 16px; font-size: 0.85rem; }
.ads-btn-secondary:hover:not(:disabled) { background: var(--ads-primary-soft); border-color: var(--ads-primary); color: var(--ads-primary); }

/* ---------- Notice (جایگزین alert) ---------- */
.ads-notice {
    display: none; margin: 14px 0 0; padding: 12px 16px; border-radius: 10px; font-size: 0.9rem;
    background: #fdf1f0; color: var(--ads-warn); border: 1px solid #f3c9c4;
}
.ads-notice.is-visible { display: block; }

/* ---------- Loader ---------- */
.ads-ai-loader { text-align: center; padding: 28px 0 8px; color: var(--ads-muted); font-size: 0.9rem; }
.ads-spinner {
    width: 34px; height: 34px; margin: 0 auto 12px; border-radius: 50%;
    border: 3px solid var(--ads-primary-soft); border-top-color: var(--ads-primary);
    animation: ads-spin 0.9s linear infinite;
}
@keyframes ads-spin { to { transform: rotate(360deg); } }

/* ---------- Results ---------- */
.ads-ai-results { margin-top: 8px; }

.ads-group-title-wrapper {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    background: var(--ads-primary); color: #fff;
    padding: 11px 18px; border-radius: 12px 12px 0 0; margin-top: 28px;
    font-size: 1.05rem; font-weight: 700;
}
.ads-group-title-wrapper .ads-editable { border-bottom-color: rgba(255,255,255,.55); color: #fff; }
.ads-group-title-wrapper .ads-editable:focus { border-bottom-color: #fff; background: rgba(255,255,255,.12); }

.ads-card {
    background-color: var(--ads-card-bg); border-radius: 0 0 12px 12px; padding: 20px;
    margin-top: 0; border: 1px solid var(--ads-border); border-top: none;
}
.ads-card-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--ads-border); padding-bottom: 12px; margin-bottom: 14px; }
.ads-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.ads-badge {
    background: #fff; color: var(--ads-text); padding: 3px 10px; border-radius: 999px;
    font-size: 0.78rem; font-weight: 600; border: 1px solid var(--ads-border); direction: ltr;
}
.ads-badge-score { color: var(--ads-ok); border-color: #b7e3cd; background: #effaf4; }
.ads-badge-score.is-bad { color: var(--ads-warn); border-color: #f3c9c4; background: #fdf1f0; }

.ads-ai-keyword-badge {
    display: inline-block; background: var(--ads-primary-soft); color: var(--ads-primary);
    padding: 0 7px; border-radius: 999px; font-size: 0.72rem; font-weight: 700;
    margin-left: 4px; border: 1px solid var(--ads-primary-ring);
}
.ads-kw-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.ads-kw-chip {
    display: inline-flex; align-items: center; gap: 4px; background: #fff;
    border: 1px solid var(--ads-border); border-radius: 8px; padding: 3px 10px; font-size: 0.9rem;
}

.ads-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.ads-grid-col { background: #fff; border: 1px solid var(--ads-border); padding: 14px; border-radius: 10px; min-width: 0; }

.ads-list { margin: 8px 0 0; padding: 0; list-style: none; font-size: 0.9rem; }
.ads-list li {
    display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
    padding: 7px 0; border-bottom: 1px dashed var(--ads-border);
}
.ads-list li:last-child { border-bottom: none; }
.ads-list .ads-editable { flex: 1; min-width: 0; word-break: break-word; }

.ads-editable { outline: none; border-bottom: 1px dashed #c4bfe0; border-radius: 2px; transition: background .15s, border-color .15s; cursor: text; }
.ads-editable:hover { background: var(--ads-primary-soft); }
.ads-editable:focus { border-bottom: 1px solid var(--ads-primary); background: var(--ads-primary-soft); }

.ads-char-count { flex: 0 0 auto; font-size: 0.74rem; color: var(--ads-muted); direction: ltr; font-variant-numeric: tabular-nums; }
.ads-char-count.is-over { color: var(--ads-warn); font-weight: 700; }

.ads-section-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ads-section-header strong { font-size: 0.92rem; }
.ads-neg-box { margin-bottom: 4px; }

.ads-copy-btn {
    background: #fff; color: var(--ads-primary); border: 1px solid var(--ads-primary-ring); border-radius: 8px;
    padding: 4px 12px; font-family: inherit; font-size: 0.76rem; font-weight: 600; cursor: pointer;
    transition: background .2s, color .2s, border-color .2s; white-space: nowrap;
}
.ads-copy-btn:hover { background: var(--ads-primary); color: #fff; border-color: var(--ads-primary); }
.ads-copy-btn.is-done { background: var(--ads-ok); border-color: var(--ads-ok); color: #fff; }

.ads-path { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--ads-border); direction: ltr; text-align: left; font-size: 0.9rem; color: var(--ads-muted); }
.ads-path .ads-editable { color: var(--ads-text); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
    .ads-ai-wrapper { padding: 18px; border-radius: 12px; }
    .ads-ai-controls { flex-direction: column; gap: 12px; }
    .ads-grid { grid-template-columns: 1fr; }
    .ads-ai-header .ads-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .ads-spinner { animation-duration: 2.5s; }
    .ads-btn, .ads-select, .ads-textarea { transition: none; }
}

/* ==========================================================================
   شبیه‌ساز آگهی گوگل (پیش‌نمایش دسکتاپ/موبایل) + Ad Strength
   ========================================================================== */
.ads-domain-group { margin-bottom: 14px; max-width: 360px; }
.ads-btn-row { display: inline-flex; gap: 6px; }

.ads-sim { margin-top: 22px; padding-top: 16px; border-top: 1px dashed var(--ads-border); }
.ads-sim-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.ads-seg { display: inline-flex; border: 1px solid #d6d2ea; border-radius: 10px; overflow: hidden; background: #fff; }
.ads-seg button {
    border: 0; background: transparent; padding: 8px 16px; font-family: inherit; font-size: 0.85rem; font-weight: 600;
    color: var(--ads-muted); cursor: pointer; transition: background .2s, color .2s;
}
.ads-seg button + button { border-right: 1px solid #d6d2ea; }
.ads-seg button.is-active { background: var(--ads-primary); color: #fff; }
.ads-seg button:not(.is-active):hover { background: var(--ads-primary-soft); color: var(--ads-primary); }
.ads-sim-query {
    flex: 1 1 200px; min-width: 0; border: 1px solid #d6d2ea; border-radius: 10px; padding: 8px 12px; background: #fff;
    font-family: inherit; font-size: 0.9rem; color: var(--ads-text); outline: none;
}
.ads-sim-query:focus { border-color: var(--ads-primary); box-shadow: 0 0 0 3px var(--ads-primary-ring); }
.ads-sim-var { direction: ltr; display: inline-block; opacity: .75; }
.ads-sim-note { margin: 10px 0 0; font-size: 0.74rem; color: var(--ads-muted); }

.ads-sim-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ads-sim-preview { background: #eceaf6; border: 1px solid var(--ads-border); border-radius: 12px; padding: 18px; display: flex; justify-content: center; min-height: 240px; }

/* --- Browser (desktop) --- */
.ads-browser { width: 100%; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 6px 20px rgba(31,27,51,.12); direction: ltr; text-align: left; }
.ads-browser-bar { display: flex; align-items: center; gap: 6px; background: #f1f0f7; padding: 9px 12px; border-bottom: 1px solid #e3e0f0; }
.ads-browser-bar i { width: 9px; height: 9px; border-radius: 50%; background: #cfcae6; }
.ads-browser-url { margin-left: 10px; flex: 1; background: #fff; border-radius: 999px; padding: 2px 12px; font-size: 11px; color: #9b97b5; }
.ads-browser-body { padding: 16px 18px 20px; }

/* --- Phone (mobile) --- */
.ads-phone { width: 300px; max-width: 100%; background: #1f1b33; border-radius: 34px; padding: 10px; box-shadow: 0 10px 28px rgba(31,27,51,.25); direction: ltr; text-align: left; }
.ads-phone-notch { width: 80px; height: 6px; background: #3a3556; border-radius: 6px; margin: 2px auto 8px; }
.ads-phone-screen { background: #fff; border-radius: 24px; padding: 14px 14px 18px; min-height: 380px; overflow: hidden; }

.ads-serp-search {
    display: flex; align-items: center; gap: 8px; border: 1px solid #dfe1e5; border-radius: 999px; padding: 8px 14px;
    color: #5f6368; font-size: 14px; box-shadow: 0 1px 4px rgba(32,33,36,.12); background: #fff;
}
.ads-serp-search span { color: #202124; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ads-serp-tabs { display: flex; gap: 16px; margin: 12px 0 10px; font-size: 12px; color: #5f6368; border-bottom: 1px solid #ebebeb; }
.ads-serp-tabs span { padding: 0 2px 7px; }
.ads-serp-tabs .is-on { color: #202124; border-bottom: 2px solid #202124; font-weight: 600; }
.ads-serp-ghost-top { height: 10px; }

/* --- Ad block --- */
.ads-ad { margin-top: 14px; font-family: Arial, Tahoma, sans-serif; text-align: start; }
.ads-ad-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; direction: ltr; text-align: left; }
.ads-ad-fav { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; background: #e8eaed; color: #3c4043; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.ads-ad-site { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.ads-ad-name { font-size: 14px; color: #202124; }
.ads-ad-url { font-size: 12px; color: #4d5156; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ads-ad-spons { color: #202124; font-weight: 700; }
.ads-ad-title { color: #1a0dab; font-size: 20px; line-height: 1.3; margin: 2px 0 4px; font-weight: 400; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ads-ad-desc { color: #4d5156; font-size: 14px; line-height: 1.58; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ads-ad-title b, .ads-ad-desc b { font-weight: 700; }
.ads-ad-sep { color: #70757a; margin: 0 2px; }
.ads-ad-empty { color: #9aa0a6; font-style: italic; }
.ads-ad-mobile .ads-ad-title { font-size: 18px; -webkit-line-clamp: 3; }
.ads-ad-mobile .ads-ad-desc { font-size: 13.5px; }

.ads-serp-ghost { margin-top: 26px; }
.ads-serp-ghost i { display: block; height: 9px; border-radius: 5px; background: #eeeef3; margin-bottom: 9px; }
.ads-serp-ghost i:nth-child(1) { width: 38%; } .ads-serp-ghost i:nth-child(2) { width: 82%; } .ads-serp-ghost i:nth-child(3) { width: 64%; }

/* --- Ad Strength --- */
.ads-strength { background: #fff; border: 1px solid var(--ads-border); border-radius: 12px; padding: 16px; }
.ads-str-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.ads-str-title { font-weight: 700; font-size: 0.95rem; }
.ads-str-level { font-weight: 700; font-size: 0.85rem; }
.ads-str-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; direction: ltr; }
.ads-str-meter i { height: 8px; border-radius: 6px; background: #e8e6f2; }
.ads-str-score { margin: 8px 0 12px; font-size: 0.8rem; color: var(--ads-muted); }
.ads-str-score b { font-size: 1.4rem; color: var(--ads-text); }
.ads-str-level.ads-str-poor, .ads-str-meter.ads-str-poor i.on { color: #d93025; background: #d93025; }
.ads-str-level.ads-str-avg,  .ads-str-meter.ads-str-avg  i.on { color: #d98200; background: #f29900; }
.ads-str-level.ads-str-good, .ads-str-meter.ads-str-good i.on { color: #1e8e3e; background: #1e8e3e; }
.ads-str-level.ads-str-exc,  .ads-str-meter.ads-str-exc  i.on { color: #0b6b2e; background: #0b6b2e; }
.ads-str-level { background: none !important; }
.ads-badge.ads-str { font-weight: 700; }
.ads-badge.ads-str-poor { color: #d93025; border-color: #f3c9c4; background: #fdf1f0; }
.ads-badge.ads-str-avg  { color: #a76400; border-color: #f6dba5; background: #fff8e8; }
.ads-badge.ads-str-good { color: #1e8e3e; border-color: #b7e3cd; background: #effaf4; }
.ads-badge.ads-str-exc  { color: #0b6b2e; border-color: #9fd6b6; background: #e4f6ec; }

.ads-str-list { list-style: none; margin: 0; padding: 0; font-size: 0.82rem; }
.ads-str-list li { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; line-height: 1.6; }
.ads-str-ic { flex: 0 0 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-top: 3px; color: #fff; }
.ads-str-list .is-ok .ads-str-ic { background: #1e8e3e; }
.ads-str-list .is-warn .ads-str-ic { background: #f29900; }
.ads-str-list .is-bad .ads-str-ic { background: #d93025; }

@media (max-width: 860px) { .ads-sim-grid { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .ads-sim-preview { padding: 10px; } .ads-browser-body { padding: 12px; } .ads-ad-title { font-size: 18px; } }
