/* =====================================================
   SGP LEAD GENERATION — sgp-leadgen.css
   Place at: /wp-content/themes/my-theme-child/sgp/sgp-leadgen.css
   ===================================================== */

/* ── Shared overlay base ── */
.sgp-lg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 999990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.sgp-lg-overlay.open {
    opacity: 1;
    pointer-events: all;
}

/* ── Shared modal box ── */
.sgp-lg-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,0.35);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    position: relative;
}
.sgp-lg-overlay.open .sgp-lg-modal {
    transform: translateY(0);
}

/* ── Modal header ── */
.sgp-lg-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #c0392b 100%);
    padding: 28px 28px 24px;
    border-radius: 16px 16px 0 0;
    text-align: center;
    position: relative;
}
.sgp-lg-header h2 {
    color: #fff;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 22px;
    margin: 0 0 6px;
    line-height: 1.3;
}
.sgp-lg-header p {
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    margin: 0;
    font-family: 'DM Sans', sans-serif;
}
.sgp-lg-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s;
}
.sgp-lg-close:hover { background: rgba(255,255,255,0.3); }

/* ── Modal body ── */
.sgp-lg-body {
    padding: 24px 28px 28px;
}
.sgp-lg-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.sgp-lg-field {
    margin-bottom: 14px;
}
.sgp-lg-field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #6b7280;
    margin-bottom: 5px;
    font-family: 'DM Sans', sans-serif;
}
.sgp-lg-field input,
.sgp-lg-field select {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 13px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    color: #111827;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    background: #fff;
}
.sgp-lg-field input:focus,
.sgp-lg-field select:focus {
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192,57,43,0.1);
}
.sgp-lg-btn {
    width: 100%;
    background: #c0392b;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 13px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 4px;
}
.sgp-lg-btn:hover { background: #922b21; }
.sgp-lg-btn:disabled { background: #9ca3af; cursor: not-allowed; }
.sgp-lg-msg {
    padding: 11px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    margin-top: 14px;
    display: none;
}
.sgp-lg-msg.success { background: #dcfce7; color: #166534; display: block; }
.sgp-lg-msg.error   { background: #fee2e2; color: #991b1b; display: block; }
.sgp-lg-privacy {
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
    margin-top: 12px;
    font-family: 'DM Sans', sans-serif;
}

/* ════════════════════════════════
   EXIT-INTENT POPUP
════════════════════════════════ */
#sgp-exit-popup .sgp-lg-header {
    padding-top: 36px;
}
#sgp-exit-popup .sgp-lg-header::before {
    content: '🏡';
    display: block;
    font-size: 36px;
    margin-bottom: 10px;
}

/* ════════════════════════════════
   DISTRICT MATCH TOOL
════════════════════════════════ */
#sgp-district-modal {
    max-width: 680px;
}

/* Trigger button — floating on all pages */
#sgp-district-trigger {
    position: fixed;
    bottom: 24px;
    left: 24px;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 30px;
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    z-index: 99980;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s, transform 0.2s;
}
#sgp-district-trigger:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* Progress steps */
.sgp-dm-steps {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 22px;
}
.sgp-dm-step {
    width: 28px;
    height: 4px;
    border-radius: 4px;
    background: #e5e7eb;
    transition: background 0.3s;
}
.sgp-dm-step.active { background: #c0392b; }
.sgp-dm-step.done   { background: #16a34a; }

/* Question screens */
.sgp-dm-screen { display: none; }
.sgp-dm-screen.active { display: block; }

.sgp-dm-q {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 18px;
    color: #111827;
    margin-bottom: 16px;
    line-height: 1.4;
}
.sgp-dm-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 18px;
}
.sgp-dm-opt {
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 12px;
    text-align: center;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    transition: all 0.2s;
    background: #fff;
    line-height: 1.4;
}
.sgp-dm-opt .sgp-dm-opt-icon {
    font-size: 24px;
    display: block;
    margin-bottom: 6px;
}
.sgp-dm-opt:hover,
.sgp-dm-opt.selected {
    border-color: #c0392b;
    background: #fff5f5;
    color: #c0392b;
}

/* Result screen */
.sgp-dm-result-district {
    background: linear-gradient(135deg, #1a1a2e, #c0392b);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: #fff;
    margin-bottom: 18px;
}
.sgp-dm-result-district h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 22px;
    margin: 0 0 6px;
}
.sgp-dm-result-district p {
    font-size: 13px;
    color: rgba(255,255,255,0.8);
    margin: 0;
    font-family: 'DM Sans', sans-serif;
    line-height: 1.5;
}
.sgp-dm-result-info {
    background: #f9fafb;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 18px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    color: #374151;
    line-height: 1.7;
}
.sgp-dm-result-info strong {
    color: #111827;
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
}

/* Listings grid in result */
.sgp-dm-listings {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 18px;
}
.sgp-dm-listing-card {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: box-shadow 0.2s, transform 0.2s;
    background: #fff;
}
.sgp-dm-listing-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}
.sgp-dm-listing-img {
    height: 80px;
    background: #e5e7eb center/cover no-repeat;
    position: relative;
}
.sgp-dm-listing-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: #c0392b;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    text-transform: uppercase;
}
.sgp-dm-listing-badge.dev { background: #1a1a2e; }
.sgp-dm-listing-info {
    padding: 8px;
}
.sgp-dm-listing-title {
    font-size: 11px;
    font-weight: 600;
    color: #111827;
    font-family: 'DM Sans', sans-serif;
    line-height: 1.3;
    margin-bottom: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sgp-dm-listing-price {
    font-size: 11px;
    color: #c0392b;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
}
.sgp-dm-no-listings {
    text-align: center;
    color: #6b7280;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 18px;
}

/* Lead capture inside district match */
.sgp-dm-capture {
    border-top: 1px solid #e5e7eb;
    padding-top: 18px;
}
.sgp-dm-capture p {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    color: #374151;
    margin-bottom: 14px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .sgp-lg-modal { border-radius: 12px; }
    .sgp-lg-header { padding: 24px 20px 20px; border-radius: 12px 12px 0 0; }
    .sgp-lg-body { padding: 20px; }
    .sgp-lg-row { grid-template-columns: 1fr; }
    .sgp-dm-options { grid-template-columns: 1fr 1fr; }
    .sgp-dm-listings { grid-template-columns: 1fr 1fr; }
    #sgp-district-trigger { bottom: 16px; left: 16px; font-size: 12px; padding: 10px 16px; }
    #sgp-district-modal { max-width: 100%; }
}
@media (max-width: 380px) {
    .sgp-dm-listings { grid-template-columns: 1fr; }
}
