/* ===================================================
   CF7 Popup Widget — Frontend Styles
   =================================================== */

/* ---- Trigger Button ---- */
.cf7pw-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.4;
    text-decoration: none;
    transition: filter 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.cf7pw-trigger-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background 0.18s ease;
}

.cf7pw-trigger-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}

.cf7pw-trigger-btn:hover::after {
    background: rgba(255,255,255,0.06);
}

.cf7pw-trigger-btn:active {
    transform: translateY(0);
    filter: brightness(0.97);
}

/* ---- Trigger Link ---- */
.cf7pw-trigger-link {
    display: inline;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.15s ease;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
}

.cf7pw-trigger-link:hover {
    opacity: 0.72;
    text-decoration-thickness: 2px;
}

/* ---- Overlay ---- */
.cf7pw-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99990;
    background: var(--cf7pw-overlay, rgba(0,0,0,0.55));
    padding: 16px;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.cf7pw-overlay.cf7pw-visible {
    display: flex;
    opacity: 0;
    animation: cf7pw-overlay-in 0.28s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.cf7pw-overlay.cf7pw-closing {
    animation: cf7pw-overlay-out 0.22s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
}

@keyframes cf7pw-overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes cf7pw-overlay-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ---- Modal ---- */
.cf7pw-modal {
    background: #fff;
    border-radius: var(--cf7pw-modal-radius, 16px);
    width: 100%;
    max-width: var(--cf7pw-modal-width, 560px);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 20px 60px rgba(0,0,0,0.25),
        0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(24px) scale(0.97);
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cf7pw-overlay.cf7pw-visible .cf7pw-modal {
    animation: cf7pw-modal-in 0.3s cubic-bezier(0.34, 1.3, 0.64, 1) forwards;
}

.cf7pw-overlay.cf7pw-closing .cf7pw-modal {
    animation: cf7pw-modal-out 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
}

@keyframes cf7pw-modal-in {
    from { transform: translateY(28px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

@keyframes cf7pw-modal-out {
    from { transform: translateY(0)    scale(1);    opacity: 1; }
    to   { transform: translateY(14px) scale(0.97); opacity: 0; }
}

/* ---- Modal Header ---- */
.cf7pw-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
    min-height: 60px;
}

.cf7pw-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    margin: 0;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.cf7pw-modal-title-empty {
    display: block;
}

/* ---- Close Button ---- */
.cf7pw-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f4f4f5;
    border: none;
    cursor: pointer;
    color: #555;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
    margin-left: auto;
    padding: 0;
}

.cf7pw-close:hover {
    background: #e4e4e7;
    color: #111;
    transform: rotate(90deg);
}

.cf7pw-close:active {
    transform: rotate(90deg) scale(0.92);
}

/* ---- Modal Body ---- */
.cf7pw-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

.cf7pw-modal-body::-webkit-scrollbar {
    width: 5px;
}

.cf7pw-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.cf7pw-modal-body::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 100px;
}

/* ---- CF7 Form Overrides inside Modal ---- */
.cf7pw-modal-body .wpcf7 {
    padding: 0 !important;
    margin: 0 !important;
}

.cf7pw-modal-body .wpcf7-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cf7pw-modal-body .wpcf7-form p {
    margin: 0 !important;
}

.cf7pw-modal-body input[type="text"],
.cf7pw-modal-body input[type="email"],
.cf7pw-modal-body input[type="tel"],
.cf7pw-modal-body input[type="url"],
.cf7pw-modal-body input[type="number"],
.cf7pw-modal-body input[type="date"],
.cf7pw-modal-body select,
.cf7pw-modal-body textarea {
    width: 100% !important;
    padding: 11px 14px !important;
    border: 1.5px solid #e2e2e2 !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    color: #222 !important;
    background: #fafafa !important;
    box-sizing: border-box !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
    font-family: inherit !important;
    outline: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.cf7pw-modal-body input[type="text"]:focus,
.cf7pw-modal-body input[type="email"]:focus,
.cf7pw-modal-body input[type="tel"]:focus,
.cf7pw-modal-body input[type="url"]:focus,
.cf7pw-modal-body input[type="number"]:focus,
.cf7pw-modal-body input[type="date"]:focus,
.cf7pw-modal-body select:focus,
.cf7pw-modal-body textarea:focus {
    border-color: #555 !important;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06) !important;
    background: #fff !important;
}

.cf7pw-modal-body textarea {
    min-height: 110px !important;
    resize: vertical !important;
}

.cf7pw-modal-body .wpcf7-submit,
.cf7pw-modal-body input[type="submit"] {
    background: #1a1a2e !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 28px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    letter-spacing: 0.02em !important;
    transition: filter 0.18s ease, transform 0.15s ease !important;
    font-family: inherit !important;
    width: auto !important;
    min-width: 140px !important;
}

.cf7pw-modal-body .wpcf7-submit:hover,
.cf7pw-modal-body input[type="submit"]:hover {
    filter: brightness(1.2) !important;
    transform: translateY(-1px) !important;
}

.cf7pw-modal-body .wpcf7-submit:active,
.cf7pw-modal-body input[type="submit"]:active {
    transform: translateY(0) !important;
}

/* CF7 validation / response */
.cf7pw-modal-body .wpcf7-not-valid-tip {
    color: #e53e3e !important;
    font-size: 12px !important;
    margin-top: 4px !important;
    display: block !important;
}

.cf7pw-modal-body .wpcf7-not-valid {
    border-color: #e53e3e !important;
    background: #fff5f5 !important;
}

.cf7pw-modal-body .wpcf7-response-output {
    padding: 12px 16px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    margin: 8px 0 0 !important;
    border: none !important;
}

.cf7pw-modal-body .wpcf7-mail-sent-ok {
    background: #f0fff4 !important;
    color: #276749 !important;
    border-left: 3px solid #48bb78 !important;
}

.cf7pw-modal-body .wpcf7-mail-sent-ng,
.cf7pw-modal-body .wpcf7-aborted {
    background: #fff5f5 !important;
    color: #c53030 !important;
    border-left: 3px solid #fc8181 !important;
}

.cf7pw-modal-body .wpcf7-spam-blocked {
    background: #fffff0 !important;
    color: #744210 !important;
    border-left: 3px solid #ecc94b !important;
}

/* ---- Prevent body scroll when modal open ---- */
body.cf7pw-no-scroll {
    overflow: hidden !important;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .cf7pw-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .cf7pw-modal {
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        max-height: 92vh;
        width: 100%;
        max-width: 100% !important;
    }

    @keyframes cf7pw-modal-in {
        from { transform: translateY(100%); opacity: 1; }
        to   { transform: translateY(0);    opacity: 1; }
    }

    @keyframes cf7pw-modal-out {
        from { transform: translateY(0);   opacity: 1; }
        to   { transform: translateY(80%); opacity: 0; }
    }

    .cf7pw-modal-header {
        padding: 18px 20px 14px;
    }

    .cf7pw-modal-body {
        padding: 20px;
    }
}

@media (max-width: 400px) {
    .cf7pw-modal-body {
        padding: 16px;
    }

    .cf7pw-modal-header {
        padding: 16px 16px 12px;
    }
}
