/* Fillable PDF Sender — Styles v1.5 */

.fps-container {
    max-width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    box-sizing: border-box;
}

/* Desktop: constrain width so PDF is readable, not stretched */
@media (min-width: 769px) {
    .fps-container {
        max-width: 900px;
    }
}

/* Loading bar */
.fps-loading-bar {
    position: relative;
    height: 28px;
    background: #f0f0f1;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.fps-loading-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2271b1, #72aee6);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.fps-loading-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px;
    color: #3c434a;
    font-weight: 500;
}

/* Canvas container (scrollable viewer) */
.fps-canvas-container {
    overflow: auto;
    background: #e8e8e8;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    -webkit-overflow-scrolling: touch;
    line-height: 0;
    font-size: 0;
}

/* Each PDF page — explicit dimensions set via JS */
.fps-page {
    position: relative;
    display: inline-block;
    margin: 0 auto 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    background: white;
    line-height: 0;
}

.fps-canvas {
    display: block;
}

/* Form field overlay — absolute positioned, exact pixel dimensions */
.fps-form-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    line-height: normal;
    font-size: initial;
}

/* Widget wrapper — each field positioned absolutely */
.fps-widget-wrapper {
    position: absolute;
    pointer-events: auto;
    box-sizing: border-box;
}

/* Text fields — semi-transparent so user sees where to type */
.fps-widget-wrapper .fps-text {
    width: 100%;
    height: 100%;
    border: 1px solid transparent;
    background: rgba(255, 248, 220, 0.35);
    border-radius: 2px;
    padding: 1px 3px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.fps-widget-wrapper .fps-text:hover {
    border-color: rgba(34, 113, 177, 0.4);
    background: rgba(255, 248, 220, 0.5);
}

.fps-widget-wrapper .fps-text:focus {
    border-color: #2271b1;
    background: rgba(255, 248, 220, 0.6);
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.25);
}

textarea.fps-text {
    resize: none;
    overflow: hidden;
}

/* Checkboxes — appearance:none, opaque background to cover PDF's checkbox */
.fps-widget-wrapper .fps-checkbox,
.fps-widget-wrapper .fps-radio {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: none;
    cursor: pointer;
    outline: none;
    background: white;

    /* Remove native checkbox appearance */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    /* Custom checkbox look */
    border: 1.5px solid #555;
    border-radius: 2px;
    box-sizing: border-box;
    display: block;
    transition: background 0.1s, border-color 0.1s;
}

.fps-widget-wrapper .fps-checkbox:hover,
.fps-widget-wrapper .fps-radio:hover {
    border-color: #2271b1;
    background: #f0f7ff;
}

/* Checked state — filled with checkmark via background */
.fps-widget-wrapper .fps-checkbox:checked,
.fps-widget-wrapper .fps-radio:checked {
    background: #2271b1;
    border-color: #2271b1;
}

.fps-widget-wrapper .fps-checkbox:checked::after {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-6.5' stroke='white' stroke-width='2.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.fps-widget-wrapper .fps-radio:checked::after {
    content: '';
    display: block;
    width: 50%;
    height: 50%;
    margin: 25% auto;
    border-radius: 50%;
    background: white;
}

/* Dropdown / select */
.fps-widget-wrapper .fps-select {
    width: 100%;
    height: 100%;
    border: 1px solid rgba(34, 113, 177, 0.3);
    background: rgba(255, 248, 220, 0.5);
    border-radius: 2px;
    padding: 0 3px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

.fps-widget-wrapper .fps-select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.25);
}

/* Action area */
.fps-actions {
    padding: 16px 0 8px;
    text-align: center;
    line-height: normal;
    font-size: initial;
}

.fps-send-btn {
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 36px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.05s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.fps-send-btn:hover:not(:disabled) {
    background: #135e96;
}

.fps-send-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.fps-send-btn:disabled {
    background: #c3c4c7;
    cursor: not-allowed;
    box-shadow: none;
}

/* Status messages */
.fps-status {
    margin-top: 10px;
    font-size: 14px;
    min-height: 20px;
    color: #50575e;
}

.fps-status.fps-success {
    color: #00a32a;
    font-weight: 600;
    font-size: 15px;
}

.fps-status.fps-error {
    color: #d63638;
    font-weight: 600;
}

.fps-status.fps-loading {
    color: #72aee6;
}

.fps-error-msg {
    color: #d63638;
    background: #fcf0f1;
    border: 1px solid #f8636a;
    border-radius: 4px;
    padding: 12px 16px;
    font-size: 14px;
}

/* Download link */
.fps-download-link {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 20px;
    background: #f0f7ff;
    color: #2271b1;
    border: 1px solid #2271b1;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.fps-download-link:hover {
    background: #2271b1;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .fps-canvas-container {
        padding: 8px;
    }

    .fps-send-btn {
        width: 100%;
        padding: 14px;
    }
}

/* Large desktop — bump form field font for readability */
@media (min-width: 1200px) {
    .fps-widget-wrapper .fps-text {
        font-size: 14px;
    }
    .fps-widget-wrapper .fps-select {
        font-size: 14px;
    }
}
