/* ==========================================================================
   PDF Popup Widget - Frontend Styles
   ========================================================================== */

/* --- Trigger Button ---------------------------------------------------- */
.ppw-btn-wrap {
    display: block;
}

.ppw-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: none;
    outline: none;
    font-family: inherit;
    line-height: 1.4;
    position: relative;
    overflow: hidden;
    padding: 14px 28px;
    border-radius: 6px;
    background: #e63946;
    color: #fff;
    transition: all 0.3s ease;
    text-decoration: none;
}

.ppw-trigger-btn:hover {
    background: #c1121f;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(230, 57, 70, 0.35);
}

.ppw-trigger-btn:active {
    transform: translateY(0);
}

.ppw-trigger-btn i,
.ppw-trigger-btn svg {
    flex-shrink: 0;
}

/* --- Overlay ----------------------------------------------------------- */
.ppw-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: ppwFadeIn 0.2s ease;
}

.ppw-overlay.ppw-hiding {
    animation: ppwFadeOut 0.2s ease forwards;
}

@keyframes ppwFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes ppwFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* --- Modal ------------------------------------------------------------- */
.ppw-modal {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    overflow-y: auto;
    animation: ppwSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25), 0 8px 20px rgba(0, 0, 0, 0.15);
}

.ppw-modal::-webkit-scrollbar { width: 4px; }
.ppw-modal::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.ppw-overlay.ppw-hiding .ppw-modal {
    animation: ppwSlideDown 0.2s ease forwards;
}

@keyframes ppwSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ppwSlideDown {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(16px); }
}

/* --- Close Button ------------------------------------------------------ */
.ppw-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    z-index: 10;
}

.ppw-close:hover {
    background: #e63946;
    color: #fff;
}

/* --- Modal Header ------------------------------------------------------ */
.ppw-modal-header {
    padding: 36px 32px 20px;
    text-align: center;
    background: linear-gradient(135deg, #fff9f9 0%, #fff 100%);
    border-bottom: 1px solid #f0f0f0;
}

.ppw-pdf-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #e63946 0%, #c1121f 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 8px 24px rgba(230, 57, 70, 0.3);
    animation: ppwPulse 2s infinite;
}

@keyframes ppwPulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(230, 57, 70, 0.3); }
    50%       { box-shadow: 0 8px 32px rgba(230, 57, 70, 0.5); }
}

.ppw-pdf-icon svg {
    width: 28px;
    height: 28px;
    color: #fff;
    stroke: #fff;
}

.ppw-modal-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 8px;
    line-height: 1.3;
}

.ppw-modal-subtitle {
    font-size: 14px;
    color: #666;
    margin: 0;
    line-height: 1.6;
}

/* --- Modal Body -------------------------------------------------------- */
.ppw-modal-body {
    padding: 28px 32px 32px;
}

/* --- Form -------------------------------------------------------------- */
.ppw-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ppw-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ppw-field label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    letter-spacing: 0.02em;
}

.ppw-req {
    color: #e63946;
    margin-left: 2px;
}

.ppw-field input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #dee2e6;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    color: #222;
    background: #f8f9fa;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none;
    box-sizing: border-box;
}

.ppw-field input:focus {
    border-color: #e63946;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.12);
}

.ppw-field input.ppw-invalid {
    border-color: #dc3545;
    background: #fff8f8;
}

.ppw-field-error {
    font-size: 12px;
    color: #dc3545;
    margin-top: 2px;
}

/* --- Submit Button ----------------------------------------------------- */
.ppw-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: #e63946;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 4px;
    letter-spacing: 0.02em;
}

.ppw-submit-btn:hover:not(:disabled) {
    background: #c1121f;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(230, 57, 70, 0.35);
}

.ppw-submit-btn:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

/* Spinner */
.ppw-spin {
    width: 18px;
    height: 18px;
    animation: ppwRotate 0.8s linear infinite;
    color: currentColor;
}

@keyframes ppwRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* --- Messages ---------------------------------------------------------- */
.ppw-success-msg {
    text-align: center;
    padding: 20px;
    font-size: 16px;
    font-weight: 600;
    color: #198754;
    background: #d1e7dd;
    border-radius: 8px;
    margin-bottom: 12px;
    animation: ppwSlideUp 0.3s ease;
}

.ppw-error-msg {
    text-align: center;
    padding: 12px 16px;
    font-size: 14px;
    color: #842029;
    background: #f8d7da;
    border-radius: 8px;
    margin-bottom: 8px;
}

/* --- Privacy Note ------------------------------------------------------ */
.ppw-privacy-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 12px;
    color: #999;
    margin: 4px 0 0;
    text-align: center;
}

.ppw-privacy-note svg {
    flex-shrink: 0;
    color: #28a745;
}

/* --- Download Toast ---------------------------------------------------- */
.ppw-download-toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: #1a1a2e;
    color: #fff;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: ppwSlideUp 0.3s ease;
    max-width: 300px;
}

.ppw-download-toast.ppw-hiding {
    animation: ppwSlideDown 0.3s ease forwards;
}

.ppw-download-toast .ppw-toast-icon {
    color: #4caf50;
    font-size: 18px;
    flex-shrink: 0;
}

/* --- Responsive -------------------------------------------------------- */
@media (max-width: 520px) {
    .ppw-modal {
        border-radius: 16px 16px 0 0;
        margin-top: auto;
        max-height: 85vh;
    }

    .ppw-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .ppw-modal-header {
        padding: 28px 24px 16px;
    }

    .ppw-modal-body {
        padding: 24px 24px 28px;
    }

    .ppw-download-toast {
        bottom: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
    }
}

/* Lock body when popup open */
body.ppw-popup-open {
    overflow: hidden;
}
