/* ============================================================
   Prateek Form Manager — Frontend CSS v1.2
   Matches reference designs exactly.
   All rules scoped to .pfm-* to prevent theme conflicts.
============================================================ */

/* ── Reset inside form only ──────────────────────────────────────────────── */
.pfm-form-wrapper *, .pfm-popup *, .pfm-sidepanel *, .pfm-stickybar * {
    box-sizing: border-box;
}
.pfm-popup ul, .pfm-sidepanel ul, .pfm-stickybar ul,
.pfm-form-wrapper ul { list-style: none !important; margin: 0 !important; padding: 0 !important; }

/* ── Form fields ─────────────────────────────────────────────────────────── */
.pfm-form .pfm-field,
.pfm-form input[type="text"],
.pfm-form input[type="email"],
.pfm-form input[type="tel"],
.pfm-form select,
.pfm-form textarea {
    display: block;
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Poppins', Arial, sans-serif;
    color: #333;
    background: #fff;
    margin-bottom: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    line-height: 1.4;
}
.pfm-form .pfm-field:focus,
.pfm-form input:focus,
.pfm-form select:focus,
.pfm-form textarea:focus {
    border-color: #0b2a4a;
    box-shadow: 0 0 0 2px rgba(11,42,74,.08);
}
.pfm-form select {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}
.pfm-form textarea { resize: vertical; min-height: 80px; }
.pfm-form .pfm-error-field { border-color: #e74c3c !important; background: #fff8f8 !important; }

/* ── Mobile row ──────────────────────────────────────────────────────────── */
.pfm-mobile-section { margin-bottom: 4px; }
.pfm-mobile-row {
    display: flex;
    align-items: stretch;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
    background: #fff;
    transition: border-color 0.2s;
}
.pfm-mobile-row:focus-within { border-color: #0b2a4a; box-shadow: 0 0 0 2px rgba(11,42,74,.08); }
.pfm-isd-prefix {
    display: flex; align-items: center;
    padding: 0 10px;
    background: #f5f5f5;
    border-right: 1px solid #d0d0d0;
    font-size: 13px; font-weight: 600;
    white-space: nowrap; flex-shrink: 0;
    color: #333;
}
.pfm-mobile-row .pfm-mobile-input {
    flex: 1; border: none !important; border-radius: 0 !important;
    margin-bottom: 0 !important; outline: none !important; box-shadow: none !important;
}
.pfm-mobile-row .pfm-btn-send-otp {
    flex-shrink: 0;
    padding: 0 14px;
    background: #0b2a4a; color: #fff;
    border: none; font-size: 12px; font-weight: 700;
    font-family: 'Poppins', Arial, sans-serif;
    cursor: pointer; white-space: nowrap;
    transition: background 0.2s;
}
.pfm-mobile-row .pfm-btn-send-otp:hover { background: #1a4a80; }
.pfm-mobile-row .pfm-btn-send-otp:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── OTP verify row ──────────────────────────────────────────────────────── */
.pfm-otp-verify-row {
    display: flex; gap: 8px; align-items: center; margin-bottom: 8px;
}
.pfm-otp-input {
    flex: 1; letter-spacing: 6px !important; font-size: 18px !important;
    font-weight: 700 !important; text-align: center !important; margin-bottom: 0 !important;
}
.pfm-btn-verify-otp {
    flex-shrink: 0; height: 44px; padding: 0 14px;
    background: #ffcb08; color: #000;
    border: none; border-radius: 6px;
    font-size: 12px; font-weight: 700;
    font-family: 'Poppins', Arial, sans-serif; cursor: pointer;
}
.pfm-btn-verify-otp:hover { background: #e6b800; }
.pfm-btn-verify-otp:disabled { opacity: 0.5; cursor: not-allowed; }
.pfm-otp-resend-row { font-size: 11px; color: #999; text-align: right; margin-bottom: 10px; }
.pfm-otp-resend-row a { color: #c28a00; font-weight: 600; text-decoration: none; }
.pfm-otp-resend-row a:hover { text-decoration: underline; }
.pfm-verified-badge {
    display: none; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; color: #1a8a3e;
    background: #e8f7ee; border-radius: 6px;
    padding: 8px 12px; margin-bottom: 10px;
}
.pfm-verified-badge.show { display: flex; }

/* ── Image Captcha ───────────────────────────────────────────────────────── */
.pfm-captcha-section {
    margin-bottom: 12px;
    padding: 12px 14px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
}
.pfm-captcha-canvas {
    display: block;
    width: 100%;
    max-width: 220px;
    height: auto;
    margin: 0 auto 6px;
    border-radius: 4px;
    border: 1px solid #dde3ec;
    background: #fff;
}
.pfm-captcha-refresh {
    display: inline-block; margin-bottom: 8px;
    font-size: 12px; color: #0b2a4a; text-decoration: none;
}
.pfm-captcha-refresh:hover { text-decoration: underline; }
.pfm-captcha-answer {
    display: block;
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
    box-sizing: border-box;
    letter-spacing: 4px; font-weight: 700 !important;
    font-size: 16px !important; text-align: center !important;
}

/* ── Consent checkbox ────────────────────────────────────────────────────── */
.pfm-consent-section { margin-bottom: 12px; }
.pfm-consent-label {
    display: flex; align-items: flex-start; gap: 10px;
    cursor: pointer; font-size: 12px; color: #555;
    line-height: 1.5;
}
.pfm-consent-checkbox {
    flex-shrink: 0; width: 16px; height: 16px;
    margin-top: 2px; cursor: pointer;
    accent-color: #0b2a4a;
}

/* ── Status message ──────────────────────────────────────────────────────── */
.pfm-status-msg {
    padding: 8px 12px; border-radius: 6px;
    font-size: 12px; margin-bottom: 10px;
}
.pfm-msg-error   { background: #fff0f0; color: #c0392b; border: 1px solid #e8b4b4; display: block; }
.pfm-msg-success { background: #f0fff4; color: #1a8a3e; border: 1px solid #a8d5b5; display: block; }
.pfm-msg-info    { background: #f0f6ff; color: #1a5fb4; border: 1px solid #b4c8e8; display: block; }

/* ── Submit button ───────────────────────────────────────────────────────── */
.pfm-btn-submit {
    display: block; width: 100%;
    background: #ffcb08; color: #000;
    border: none; border-radius: 6px;
    height: 46px; font-size: 16px; font-weight: 700;
    font-family: 'Poppins', Arial, sans-serif;
    cursor: pointer; transition: background 0.2s, opacity 0.2s;
    text-align: center; letter-spacing: 0.5px;
}
.pfm-btn-submit:hover:not(:disabled) { background: #e6b800; }
.pfm-btn-submit:disabled { opacity: 0.45; cursor: not-allowed; }

/* ══════════════════════════════════════════════════════════════
   POPUP (Image 1 style)
══════════════════════════════════════════════════════════════ */
.pfm-trigger-btn.pfm-popup-trigger {
    position: fixed;
    right: -38px; top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    transform-origin: center center;
    background: #0b2a4a; color: #fff;
    border: none; padding: 12px 22px;
    font-size: 14px; font-weight: 600;
    cursor: pointer; z-index: 9990;
    border-radius: 8px 8px 0 0;
    display: flex; align-items: center; gap: 8px;
    box-shadow: -3px 0 12px rgba(0,0,0,.25);
    transition: background 0.2s, right 0.2s;
    white-space: nowrap;
    font-family: 'Poppins', Arial, sans-serif;
}
.pfm-trigger-btn.pfm-popup-trigger svg { transform: rotate(90deg); flex-shrink: 0; }
.pfm-trigger-btn.pfm-popup-trigger:hover { background: #ffcb08; color: #000; right: -36px; }

.pfm-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.55); z-index: 9995;
    backdrop-filter: blur(2px);
}
.pfm-overlay.active { display: block; }

.pfm-popup {
    display: none; position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: #fff; border-radius: 14px;
    padding: 32px 28px 24px;
    width: 440px; max-width: 96vw;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
    font-family: 'Poppins', Arial, sans-serif;
}
.pfm-popup.active {
    display: block;
    animation: pfmPopIn 0.25s ease forwards;
}
@keyframes pfmPopIn {
    from { opacity: 0; transform: translate(-50%,-47%) scale(.95); }
    to   { opacity: 1; transform: translate(-50%,-50%) scale(1); }
}
.pfm-popup-close {
    position: absolute; top: 12px; right: 14px;
    background: none; border: none; font-size: 26px;
    cursor: pointer; color: #666; line-height: 1; padding: 2px;
}
.pfm-popup-close:hover { color: #000; }
.pfm-popup-title {
    margin: 0 0 14px; font-size: 22px; font-weight: 700;
    color: #0b2a4a; text-align: center;
    padding-right: 20px;
}
.pfm-popup-divider {
    border: none; border-top: 1px solid #eee; margin: 0 0 16px;
}

/* ══════════════════════════════════════════════════════════════
   SIDE PANEL (Image 2 style — slides from right)
══════════════════════════════════════════════════════════════ */
.pfm-sidepanel-tab {
    position: fixed;
    right: 0; top: 50%;
    transform: translateY(-50%);
    background: #0b2a4a; color: #fff;
    border: none; padding: 0;
    width: 36px; /* collapsed */
    cursor: pointer; z-index: 9990;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 8px;
    box-shadow: -3px 0 12px rgba(0,0,0,.25);
    border-radius: 8px 0 0 8px;
    transition: background 0.2s, width 0.2s;
    font-family: 'Poppins', Arial, sans-serif;
    overflow: hidden;
    height: 140px;
}
.pfm-sidepanel-tab span {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 13px; font-weight: 700;
    transform: rotate(180deg);
    white-space: nowrap;
    letter-spacing: 1px;
}
.pfm-sidepanel-tab:hover { background: #1a4a80; }

.pfm-sidepanel {
    position: fixed;
    top: 0; right: -420px; /* hidden off-screen */
    width: 400px; max-width: 96vw;
    height: 100vh; overflow-y: auto;
    background: #fff;
    z-index: 9999;
    box-shadow: -8px 0 40px rgba(0,0,0,.2);
    transition: right 0.35s cubic-bezier(.4,0,.2,1);
    font-family: 'Poppins', Arial, sans-serif;
}
.pfm-sidepanel.active { right: 0; }

.pfm-sidepanel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #eee;
    position: sticky; top: 0; background: #fff; z-index: 1;
}
.pfm-sidepanel-header h3 {
    margin: 0; font-size: 20px; font-weight: 700;
    color: #0b2a4a;
}
.pfm-sidepanel-close {
    background: none; border: none; font-size: 26px;
    cursor: pointer; color: #666; line-height: 1;
}
.pfm-sidepanel-close:hover { color: #000; }
.pfm-sidepanel-body { padding: 20px 24px 32px; }

/* ══════════════════════════════════════════════════════════════
   STICKY BAR — legacy class stubs (actual overrides injected inline by PHP)
══════════════════════════════════════════════════════════════ */
.pfm-stickybar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 9990; }
.pfm-stickybar-inner { max-width: 1300px; margin: 0 auto; display: flex; align-items: center; gap: 14px; }
.pfm-stickybar-label { font-size: 15px; font-weight: 700; color: #fff; white-space: nowrap; text-transform: uppercase; letter-spacing: 1px; flex-shrink: 0; }
.pfm-bar-submit { height: 42px; width: auto !important; padding: 0 24px; font-size: 14px; white-space: nowrap; flex-shrink: 0; border-radius: 6px; }

/* ── OTP popup (triggered from bar) ─────────────────────────────────────── */
.pfm-otp-popup {
    width: 360px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .pfm-popup { padding: 24px 16px 20px; }
    .pfm-stickybar-form .pfm-form.pfm-bar-form { flex-direction: column; align-items: stretch; }
    .pfm-stickybar-form .pfm-form .pfm-field,
    .pfm-stickybar-form .pfm-form select { max-width: 100%; }
    .pfm-stickybar-label { display: none; }
    .pfm-bar-submit { width: 100% !important; }
    .pfm-sidepanel { width: 100%; }
}
