/* =========================================================
   PDF Opt-In Widget — widget.css
   All four states: form, returning, sending, confirmation
   ========================================================= */

.pdf-optin-widget {
    display: flex;
    flex-direction: column;
    border: 3px dashed #222;
    border-radius: 0;
    background: #d19abc;
    overflow: hidden;
    margin: 2rem auto;
    font-family: Arial, sans-serif;
    max-width: 720px;
    padding: 0.5rem;
}

/* States — siblings, one visible at a time */
.pdf-optin-state {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.pdf-optin-hidden {
    display: none !important;
}

/* ----- State: form (new visitor) ----- */

/* Header: headline + subheadline — full width above both columns */
.pdf-optin-state--form .pdf-optin-header {
    padding: 1rem 1.25rem 0.5rem;
    text-align: center;
}

/* Body: fields on left, image on right */
.pdf-optin-state--form .pdf-optin-body {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0.5rem 1.25rem 1.25rem;
    gap: 1rem;
}

.pdf-optin-state--form .pdf-optin-fields {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-width: 0;
}

.pdf-optin-image {
    flex: 0 0 315px;
    width: 315px;
    height: 150px;
    border-radius: 3px;
    /* background-size/repeat/position controlled via inline style */
}

/* ----- State: returning visitor ----- */
.pdf-optin-state--returning {
    padding: 2rem;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.pdf-optin-not-you {
    font-size: 0.85rem;
    margin: 0;
}

.pdf-optin-not-you a {
    color: #555;
}

/* ----- State: sending ----- */
.pdf-optin-state--sending {
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    gap: 1rem;
}

.pdf-optin-spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #ddd;
    border-top-color: #8BC34A;
    border-radius: 50%;
    animation: pdf-optin-spin 0.8s linear infinite;
}

@keyframes pdf-optin-spin {
    to { transform: rotate(360deg); }
}

.pdf-optin-sending-text {
    color: #555;
    font-size: 1rem;
    margin: 0;
}

/* ----- State: confirmation ----- */
.pdf-optin-state--confirm {
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 0.75rem;
    background: #f1f8e9;
    text-align: center;
}

.pdf-optin-state--confirm .pdf-optin-headline {
    color: #558B2F;
    margin: 0;
}

.pdf-optin-direct-link {
    font-size: 0.9rem;
    color: #558B2F;
}

/* ----- Shared elements ----- */
.pdf-optin-headline {
    font-size: 1.6rem;
    font-weight: bold;
    margin: 0 0 0.2rem;
    line-height: 1.2;
}

.pdf-optin-subheadline {
    font-size: 0.95rem;
    color: #555;
    margin: 0;
}

.pdf-optin-input {
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

.pdf-optin-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
    background: #8BC34A;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}

.pdf-optin-btn:hover {
    background: #7CB342;
}

/* ----- Responsive ----- */
@media (max-width: 600px) {
    .pdf-optin-state--form .pdf-optin-body {
        flex-direction: column;
    }

    .pdf-optin-image {
        flex: none;
        width: 100%;
        height: 150px;
    }
}
