/**
 * Public Stylesheet  BD Smart Advanced Form Builder
 *
 * @package BDSFB
 * @since   3.0.0
 */

/* =============================================================================
    CSS CUSTOM PROPERTIES - Can be overridden by settings
    ============================================================================= */

:root {
    --bdsfb-primary: #155e75;
    --bdsfb-primary-dark: #0f3f57;
    --bdsfb-secondary: #eef4f7;
    --bdsfb-background: #ffffff;
    --bdsfb-text: #10212b;
    --bdsfb-border: #c9d8e2;
    --bdsfb-success: #1f8f5f;
    --bdsfb-error: #c53d39;
    --bdsfb-accent: #0f3f57;
    --bdsfb-surface-soft: #f7fafc;
    --bdsfb-field-bg: #fcfdfe;
    --bdsfb-form-radius: 20px;
    --bdsfb-field-radius: 14px;
    --bdsfb-button-radius: 999px;
    --bdsfb-form-padding: 40px;
    --bdsfb-form-shadow: 0 22px 58px rgba(16, 33, 43, 0.12);
}

/* =============================================================================
    RESET
    ============================================================================= */

.bdsfb-form-container *,
.bdsfb-form-container *::before,
.bdsfb-form-container *::after {
    box-sizing: border-box;
}

/* =============================================================================
    FORM CONTAINER
    ============================================================================= */

.bdsfb-form-container {
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    color: var(--bdsfb-text);
    line-height: 1.6;
    background:
        radial-gradient(circle at top right, rgba(245, 158, 11, 0.08), transparent 24%),
        linear-gradient(180deg, rgba(247, 250, 252, 0.72) 0%, rgba(255, 255, 255, 0) 150px),
        var(--bdsfb-background);
    padding: var(--bdsfb-form-padding);
    border-radius: var(--bdsfb-form-radius);
    border: 1px solid rgba(201, 216, 226, 0.9);
    box-shadow: var(--bdsfb-form-shadow);
}

.bdsfb-form-container.no-shadow {
    box-shadow: none;
}

/* =============================================================================
    PROGRESS BAR
    ============================================================================= */

.bdsfb-progress-bar-wrap {
    margin-bottom: 28px;
}

.bdsfb-progress-bar-track {
    background: var(--bdsfb-secondary);
    border-radius: 99px;
    height: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.bdsfb-progress-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--bdsfb-primary) 0%, var(--bdsfb-primary-dark) 100%);
    border-radius: 99px;
    transition: width 0.4s ease;
    box-shadow: 0 2px 6px color-mix(in srgb, var(--bdsfb-primary) 40%, transparent);
}

.bdsfb-progress-bar-label {
    margin-top: 10px;
    font-size: 13px;
    color: #646970;
    text-align: right;
    font-weight: 500;
}

/* =============================================================================
    FIELD WRAPPERS
    ============================================================================= */

.bdsfb-field-wrap {
    margin-bottom: 24px;
    position: relative;
}

.bdsfb-field-wrap:last-child {
    margin-bottom: 0;
}

/* =============================================================================
    LABELS
    ============================================================================= */

.bdsfb-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--bdsfb-text);
    margin-bottom: 8px;
    cursor: pointer;
    letter-spacing: 0.3px;
}

.bdsfb-required {
    color: #e74c3c;
    margin-left: 3px;
    font-weight: 700;
}

.bdsfb-field-hint {
    font-size: 12px;
    color: #6a7d89;
    margin-top: 6px;
    font-style: italic;
}

/* =============================================================================
    TEXT INPUTS - ELEGANT STYLE
    ============================================================================= */

.bdsfb-input,
.bdsfb-textarea,
.bdsfb-select,
.bdsfb-date-input {
    display: block;
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--bdsfb-border);
    border-radius: var(--bdsfb-field-radius);
    font-size: 15px;
    font-family: inherit;
    color: var(--bdsfb-text);
    background: var(--bdsfb-field-bg);
    outline: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    -webkit-appearance: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.bdsfb-input:hover,
.bdsfb-textarea:hover,
.bdsfb-select:hover,
.bdsfb-date-input:hover {
    border-color: color-mix(in srgb, var(--bdsfb-primary) 22%, var(--bdsfb-border));
    background: #fff;
}

.bdsfb-input:focus,
.bdsfb-textarea:focus,
.bdsfb-select:focus,
.bdsfb-date-input:focus {
    border-color: var(--bdsfb-primary);
    background: #fff;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--bdsfb-primary) 15%, transparent), inset 0 2px 4px rgba(0, 0, 0, 0.02);
    transform: translateY(-1px);
}

.bdsfb-input::placeholder,
.bdsfb-textarea::placeholder {
    color: #a0aab5;
}

.bdsfb-textarea {
    resize: vertical;
    min-height: 130px;
    line-height: 1.6;
}

/* =============================================================================
   SELECT
   ============================================================================= */

.bdsfb-select-wrap {
    position: relative;
}

.bdsfb-select-wrap::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #787c82;
    pointer-events: none;
}

.bdsfb-select {
    padding-right: 36px;
    cursor: pointer;
}

/* =============================================================================
   CHECKBOXES & RADIOS
   ============================================================================= */

.bdsfb-checkbox-group,
.bdsfb-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bdsfb-checkbox-label,
.bdsfb-radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    cursor: pointer;
    user-select: none;
}

.bdsfb-checkbox,
.bdsfb-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.bdsfb-checkbox-custom,
.bdsfb-radio-custom {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 2px solid var(--bdsfb-border);
    border-radius: 4px;
    background: #fff;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
}

.bdsfb-radio-custom {
    border-radius: 50%;
}

.bdsfb-checkbox:checked + .bdsfb-checkbox-custom {
    background: var(--bdsfb-primary);
    border-color: var(--bdsfb-primary);
}

.bdsfb-checkbox:checked + .bdsfb-checkbox-custom::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translate(-1px, -1px);
}

.bdsfb-radio:checked + .bdsfb-radio-custom {
    border-color: var(--bdsfb-primary);
}

.bdsfb-radio:checked + .bdsfb-radio-custom::after {
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    background: var(--bdsfb-primary);
    border-radius: 50%;
}

fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

legend.bdsfb-label {
    padding: 0;
    margin-bottom: 10px;
}

/* =============================================================================
    FILE UPLOAD - ELEGANT WITH REMOVE
    ============================================================================= */

.bdsfb-file-upload-wrap {
    position: relative;
}

.bdsfb-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 74px;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.bdsfb-file-upload-ui {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border: 2px dashed #c8d0d8;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #f0f4f8 100%);
    color: #64748b;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.bdsfb-file-upload-wrap:hover .bdsfb-file-upload-ui,
.bdsfb-file-upload-wrap.bdsfb-has-file .bdsfb-file-upload-ui {
    border-color: var(--bdsfb-primary);
    background: linear-gradient(135deg, #e8f4fc 0%, #d4edf9 100%);
    color: var(--bdsfb-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.15);
}

.bdsfb-file-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bdsfb-file-icon {
    font-size: 28px;
    flex-shrink: 0;
    opacity: 0.8;
}

.bdsfb-file-text {
    font-weight: 500;
}

.bdsfb-file-name {
    font-weight: 600;
    word-break: break-all;
    color: #2c3e50;
}

/* Remove (Cross) Button - Only shows when file is uploaded */
.bdsfb-file-remove {
    display: none;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.bdsfb-file-remove:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.bdsfb-file-remove:active {
    transform: scale(1.0);
}

/* Show remove button only when file is uploaded */
.bdsfb-file-upload-wrap.bdsfb-has-file .bdsfb-file-remove {
    display: flex;
}

/* File Preview */
.bdsfb-file-preview {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background: #f1f5f9;
    border-radius: 10px;
    align-items: center;
    gap: 12px;
}

.bdsfb-file-upload-wrap.bdsfb-has-file .bdsfb-file-preview {
    display: flex;
}

.bdsfb-file-preview img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.bdsfb-file-preview-info {
    flex: 1;
}

.bdsfb-file-preview-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
    word-break: break-all;
}

.bdsfb-file-preview-size {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

/* Drag and Drop State */
.bdsfb-file-upload-wrap.drag-over .bdsfb-file-upload-ui {
    border-color: var(--bdsfb-primary);
    background: linear-gradient(135deg, #d4edf9 0%, #b8e0f5 100%);
    border-style: solid;
    transform: scale(1.02);
}

.bdsfb-field-hint {
    font-size: 12px;
    color: #787c82;
    margin-top: 6px;
}

/* =============================================================================
   FIELD ERRORS
   ============================================================================= */

.bdsfb-field-error {
    font-size: 13px;
    color: var(--bdsfb-error);
    margin-top: 5px;
    min-height: 18px;
}

.bdsfb-field-has-error .bdsfb-input,
.bdsfb-field-has-error .bdsfb-textarea,
.bdsfb-field-has-error .bdsfb-select {
    border-color: var(--bdsfb-error);
    box-shadow: 0 0 0 3px rgba(214, 54, 56, 0.1);
}

.bdsfb-field-has-error .bdsfb-file-upload-ui {
    border-color: var(--bdsfb-error);
    background: #fef0f0;
}

/* =============================================================================
    FORM FOOTER & SUBMIT
    ============================================================================= */

.bdsfb-form-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid color-mix(in srgb, var(--bdsfb-border) 80%, white);
}

.bdsfb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.bdsfb-btn:active {
    transform: scale(0.98);
}

.bdsfb-btn-primary {
    background: linear-gradient(135deg, var(--bdsfb-primary) 0%, var(--bdsfb-primary-dark) 100%);
    color: #fff;
    border-radius: var(--bdsfb-button-radius);
}

.bdsfb-btn-primary:hover {
    background: linear-gradient(135deg, var(--bdsfb-primary-dark) 0%, var(--bdsfb-accent) 100%);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--bdsfb-primary) 40%, transparent);
}

.bdsfb-btn-secondary {
    background: linear-gradient(135deg, var(--bdsfb-secondary) 0%, var(--bdsfb-border) 100%);
    color: var(--bdsfb-text);
    border: 2px solid var(--bdsfb-border);
    border-radius: var(--bdsfb-button-radius);
}

.bdsfb-btn-secondary:hover {
    background: linear-gradient(135deg, var(--bdsfb-background) 0%, var(--bdsfb-secondary) 100%);
    color: var(--bdsfb-text);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.bdsfb-submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* =============================================================================
   SPINNER
   ============================================================================= */

.bdsfb-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e2e4e7;
    border-top-color: var(--bdsfb-primary);
    border-radius: 50%;
    animation: bdsfb-spin 0.7s linear infinite;
}

@keyframes bdsfb-spin {
    to { transform: rotate(360deg); }
}

/* =============================================================================
   SUCCESS MESSAGE
   ============================================================================= */

.bdsfb-success-message {
    text-align: center;
    padding: 48px 32px;
    background: #edfaef;
    border: 1px solid #b3dfbb;
    border-radius: 8px;
}

.bdsfb-success-icon {
    font-size: 48px;
    color: var(--bdsfb-success);
    margin-bottom: 16px;
}

.bdsfb-success-text {
    font-size: 17px;
    color: #1a7e30;
    font-weight: 500;
}

/* =============================================================================
   FORM ERROR MESSAGE
   ============================================================================= */

.bdsfb-form-error-message {
    padding: 14px 18px;
    background: #fef0f0;
    border: 1px solid #f5c0c0;
    border-radius: 5px;
    color: #a82224;
    font-size: 14px;
    margin-bottom: 20px;
}

/* =============================================================================
   MULTI-STEP NAVIGATION
   ============================================================================= */

.bdsfb-step-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 24px;
    gap: 12px;
    flex-wrap: wrap;
}

.bdsfb-step-navigation .bdsfb-prev-step {
    margin-right: auto;
}

.bdsfb-step-navigation .bdsfb-next-step,
.bdsfb-step-navigation .bdsfb-preview-btn,
.bdsfb-step-navigation .bdsfb-submit-btn {
    margin-left: auto;
}

/* =============================================================================
   HONEYPOT
   ============================================================================= */

.bdsfb-hp-field {
    position: absolute !important;
    left: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media ( max-width: 600px ) {
    .bdsfb-form-container {
        padding: 24px 18px;
        border-radius: 16px;
    }

    .bdsfb-btn {
        width: 100%;
        padding: 14px;
    }

    .bdsfb-step-navigation {
        flex-direction: column;
        align-items: stretch;
    }

    .bdsfb-step-navigation .bdsfb-btn {
        width: 100%;
    }

    .bdsfb-step-navigation .bdsfb-prev-step,
    .bdsfb-step-navigation .bdsfb-next-step,
    .bdsfb-step-navigation .bdsfb-preview-btn,
    .bdsfb-step-navigation .bdsfb-submit-btn {
        margin-left: 0;
        margin-right: 0;
    }
}

/* =============================================================================
   ACCESSIBILITY
   ============================================================================= */

.bdsfb-input:focus-visible,
.bdsfb-textarea:focus-visible,
.bdsfb-select:focus-visible,
.bdsfb-btn:focus-visible {
    outline: 3px solid var(--bdsfb-primary);
    outline-offset: 2px;
}

.bdsfb-checkbox:focus-visible + .bdsfb-checkbox-custom,
.bdsfb-radio:focus-visible + .bdsfb-radio-custom {
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.3);
}

/* =============================================================================
   PREVIEW MODAL
   ============================================================================= */

.bdsfb-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.bdsfb-preview-modal-content {
    background: #fff;
    padding: 32px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.bdsfb-preview-modal h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #1d2327;
    font-size: 20px;
}

.bdsfb-preview-data {
    margin-bottom: 24px;
}

.bdsfb-preview-item {
    padding: 12px 0;
    border-bottom: 1px solid #e2e4e7;
}

.bdsfb-preview-item:last-child {
    border-bottom: none;
}

.bdsfb-preview-item strong {
    display: block;
    color: #787c82;
    font-size: 12px;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.bdsfb-preview-item span {
    color: #1d2327;
    font-size: 15px;
}

.bdsfb-preview-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* =============================================================================
   CHECKBOX SWITCH STYLE
   ============================================================================= */

.bdsfb-checkbox-group[data-style="switch"] .bdsfb-checkbox-label {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.bdsfb-checkbox-group[data-style="switch"] .bdsfb-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.bdsfb-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    background: #cbd0d4;
    border-radius: 26px;
    transition: 0.3s;
}

.bdsfb-switch::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.bdsfb-checkbox:checked + .bdsfb-switch {
    background: var(--bdsfb-primary);
}

.bdsfb-checkbox:checked + .bdsfb-switch::before {
    transform: translateX(24px);
}

/* =============================================================================
   CHECKBOX/RADIO BUTTON STYLE
   ============================================================================= */

.bdsfb-checkbox-group[data-style="button"] .bdsfb-checkbox-label,
.bdsfb-radio-group[data-style="button"] .bdsfb-radio-label {
    display: inline-block;
    padding: 10px 20px;
    margin: 4px;
    border: 2px solid var(--bdsfb-border);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.bdsfb-checkbox-group[data-style="button"] .bdsfb-checkbox:checked + .bdsfb-checkbox-btn,
.bdsfb-radio-group[data-style="button"] .bdsfb-radio:checked + .bdsfb-radio-btn {
    background: var(--bdsfb-primary);
    border-color: var(--bdsfb-primary);
    color: #fff;
}

/* =============================================================================
   RADIO CARD STYLE
   ============================================================================= */

.bdsfb-radio-group[data-style="card"] .bdsfb-radio-label {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid var(--bdsfb-border);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.bdsfb-radio-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bdsfb-radio-card-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid var(--bdsfb-border);
    border-radius: 50%;
    flex-shrink: 0;
}

.bdsfb-radio:checked + .bdsfb-radio-card .bdsfb-radio-card-indicator {
    border-color: var(--bdsfb-primary);
    background: var(--bdsfb-primary);
}

.bdsfb-radio:checked + .bdsfb-radio-card {
    border-color: var(--bdsfb-primary);
    background: #f5fafd;
}

/* =============================================================================
   INLINE CHECKBOX/RADIO
   ============================================================================= */

.bdsfb-checkbox-group.bdsfb-inline,
.bdsfb-radio-group.bdsfb-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

/* =============================================================================
   CHARACTER COUNTER
   ============================================================================= */

.bdsfb-char-counter {
    font-size: 12px;
    color: #787c82;
    text-align: right;
    margin-bottom: 4px;
}

.bdsfb-char-counter.bdsfb-char-over-limit .bdsfb-char-current {
    color: var(--bdsfb-error);
}

/* =============================================================================
    TEXTAREA FLOATING STYLE
    ============================================================================= */

.bdsfb-textarea-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--bdsfb-primary);
    transition: width 0.3s;
}

.bdsfb-field-wrap:has(.bdsfb-textarea:focus) .bdsfb-textarea-line {
    width: 100%;
}

/* =============================================================================
    A4 PREVIEW MODAL - Enhanced Popup
    ============================================================================= */

.bdsfb-preview-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bdsfb-preview-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.bdsfb-preview-modal {
    background: #fff;
    border-radius: 12px;
    width: 95%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    animation: bdsfb-modal-appear 0.3s ease;
}

@keyframes bdsfb-modal-appear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.bdsfb-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    background: linear-gradient(135deg, var(--bdsfb-primary) 0%, var(--bdsfb-primary-dark) 100%);
    color: #fff;
}

.bdsfb-preview-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.bdsfb-preview-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.bdsfb-preview-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

/* Preview Pages Navigation */
.bdsfb-preview-pages {
    background: #f0f2f5;
    padding: 0 28px;
    border-bottom: 1px solid #e1e4e8;
}

.bdsfb-preview-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 14px 0;
}

.bdsfb-preview-nav button {
    background: #fff;
    border: 1px solid var(--bdsfb-border);
    color: #1d2327;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.bdsfb-preview-nav button:hover:not(:disabled) {
    background: var(--bdsfb-primary);
    border-color: var(--bdsfb-primary);
    color: #fff;
}

.bdsfb-preview-nav button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bdsfb-preview-page-info {
    font-size: 14px;
    color: #646970;
    font-weight: 500;
}

/* A4 Paper Pages */
.bdsfb-preview-papers {
    max-height: 65vh;
    overflow-y: auto;
    padding: 28px;
    background: #e8eaed;
}

.bdsfb-a4-page {
    display: none;
    background: #fff;
    width: 100%;
    max-width: 700px;
    min-height: 900px;
    margin: 0 auto;
    padding: 50px 55px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    position: relative;
    font-family: 'Times New Roman', Times, serif;
    color: #1a1a1a;
    font-size: 15px;
    line-height: 1.6;
}

.bdsfb-a4-page.active {
    display: block;
    animation: bdsfb-page-fade 0.3s ease;
}

@keyframes bdsfb-page-fade {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Resume Photo in Top Right */
.bdsfb-preview-photo-wrap {
    position: absolute;
    top: 20px;
    right: 25px;
    width: 130px;
    height: 150px;
    border: 3px solid #e8e8e8;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bdsfb-preview-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Preview Content */
.bdsfb-preview-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.bdsfb-preview-item {
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.bdsfb-preview-item:last-child {
    border-bottom: none;
}

.bdsfb-preview-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    margin-bottom: 4px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.bdsfb-preview-value {
    font-size: 16px;
    color: #1a1a1a;
    word-wrap: break-word;
}

/* Preview Actions Footer */
.bdsfb-preview-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    padding: 20px 28px;
    background: #f8f9fa;
    border-top: 1px solid #e1e4e8;
}

/* Responsive */
@media (max-width: 768px) {
    .bdsfb-preview-modal {
        width: 98%;
        max-height: 95vh;
        border-radius: 8px;
    }
    
    .bdsfb-preview-header {
        padding: 16px 20px;
    }
    
    .bdsfb-preview-header h2 {
        font-size: 18px;
    }
    
    .bdsfb-preview-papers {
        padding: 16px;
    }
    
    .bdsfb-a4-page {
        padding: 30px 25px;
        min-height: auto;
    }
    
    .bdsfb-preview-photo-wrap {
        width: 90px;
        height: 110px;
        top: 15px;
        right: 15px;
    }
    
    .bdsfb-preview-actions {
        flex-direction: column;
        padding: 16px;
    }
    
    .bdsfb-preview-actions .bdsfb-btn {
        width: 100%;
    }
}

/* =============================================================================
   UI REFINEMENTS - Attachment Cards & A4 Preview
   ============================================================================= */

.bdsfb-file-upload-wrap {
    position: relative;
}

.bdsfb-file-upload-ui {
    min-height: 74px;
    align-items: center;
    border: 2px dashed #cbd5e1;
    background: #fcfdff;
    box-shadow: none;
    transform: none;
}

.bdsfb-file-upload-wrap:hover .bdsfb-file-upload-ui {
    border-color: var(--bdsfb-primary);
    background: #f8fbff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    transform: none;
}

.bdsfb-file-upload-wrap.bdsfb-has-file .bdsfb-file-upload-ui {
    border-color: #bfdbfe;
    background: linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
    color: var(--bdsfb-text);
    box-shadow: none;
    transform: none;
}

.bdsfb-file-left {
    width: 100%;
    justify-content: flex-start;
}

.bdsfb-file-icon::before {
    content: '\1F4CE';
}

.bdsfb-file-text {
    color: #475569;
    font-weight: 500;
}

.bdsfb-file-selected {
    position: relative;
    z-index: 4;
    margin-top: 10px;
}

.bdsfb-file-selected-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #dbe7f3;
    border-radius: 12px;
    background: #f8fbff;
}

.bdsfb-file-selected-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bdsfb-file-selected-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    word-break: break-word;
}

.bdsfb-file-selected-size {
    font-size: 12px;
    color: #64748b;
}

.bdsfb-file-selected-remove {
    width: auto;
    height: auto;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #64748b;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0 2px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.bdsfb-file-selected-remove:hover {
    background: transparent;
    color: #dc2626;
    transform: scale(1.05);
}

.bdsfb-file-remove,
.bdsfb-file-name,
.bdsfb-file-preview {
    display: none !important;
}

.bdsfb-file-upload-wrap.drag-over .bdsfb-file-upload-ui {
    border-color: var(--bdsfb-primary);
    background: #edf7ff;
    border-style: solid;
    transform: none;
}

.bdsfb-message-success {
    background: #edfaef;
    border-color: #b7e0c0;
    color: #1a7f37;
}

.bdsfb-preview-header p {
    margin: 6px 0 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.86);
}

.bdsfb-preview-papers {
    padding: 24px;
    background:
        linear-gradient(180deg, #e9edf2 0%, #dfe5eb 100%);
}

.bdsfb-a4-page {
    width: min(100%, 794px);
    min-height: 1123px;
    padding: 54px 52px 48px;
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.65) 0, rgba(248, 250, 252, 0) 120px),
        #fff;
}

.bdsfb-preview-page-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e2e8f0;
}

.bdsfb-preview-document-title {
    font-size: 28px;
    line-height: 1.2;
    font-weight: 700;
    color: #0f172a;
    font-family: Georgia, 'Times New Roman', serif;
}

.bdsfb-preview-document-meta {
    font-size: 12px;
    color: #64748b;
    text-align: right;
    white-space: nowrap;
}

.bdsfb-preview-content {
    gap: 16px;
}

.bdsfb-preview-item {
    padding: 14px 0 16px;
    border-bottom: 1px solid #e5e7eb;
}

.bdsfb-preview-label {
    font-size: 11px;
    letter-spacing: 0.12em;
    color: #475569;
}

.bdsfb-preview-value {
    font-size: 15px;
    line-height: 1.7;
    white-space: pre-wrap;
}

.bdsfb-preview-item-file {
    border-bottom: none;
    padding-top: 4px;
}

.bdsfb-preview-attachment-card {
    margin-top: 8px;
    padding: 14px;
    border: 1px solid #dbe5f0;
    border-radius: 16px;
    background: #fbfdff;
}

.bdsfb-preview-attachment-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.bdsfb-preview-attachment-head a {
    color: var(--bdsfb-primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.bdsfb-preview-attachment-name {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    word-break: break-word;
}

.bdsfb-preview-attachment-meta {
    margin-top: 3px;
    font-size: 12px;
    color: #64748b;
}

.bdsfb-preview-attachment-media {
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
}

.bdsfb-preview-attachment-media img,
.bdsfb-preview-attachment-media iframe {
    display: block;
    width: 100%;
    min-height: 340px;
    border: 0;
    background: #fff;
}

.bdsfb-preview-page-bottom {
    margin-top: 28px;
    padding-top: 14px;
    border-top: 1px solid #e2e8f0;
    font-size: 12px;
    color: #64748b;
    text-align: right;
}

.bdsfb-preview-empty {
    padding: 24px;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    color: #64748b;
    text-align: center;
    background: #f8fafc;
}

@media (max-width: 768px) {
    .bdsfb-file-input {
        height: 64px;
    }

    .bdsfb-file-upload-ui {
        min-height: 64px;
        padding: 16px;
    }

    .bdsfb-a4-page {
        min-height: auto;
        padding: 28px 22px 24px;
    }

    .bdsfb-preview-page-top {
        flex-direction: column;
    }

    .bdsfb-preview-document-meta {
        text-align: left;
        white-space: normal;
    }

    .bdsfb-preview-attachment-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .bdsfb-preview-attachment-media img,
    .bdsfb-preview-attachment-media iframe {
        min-height: 220px;
    }
}

/* =============================================================================
   PALETTE OVERRIDES
   ============================================================================= */

.bdsfb-checkbox-custom,
.bdsfb-radio-custom,
.bdsfb-radio-card-indicator,
.bdsfb-checkbox-group[data-style="button"] .bdsfb-checkbox-label,
.bdsfb-radio-group[data-style="button"] .bdsfb-radio-label,
.bdsfb-radio-group[data-style="card"] .bdsfb-radio-label,
.bdsfb-preview-nav button {
    border-color: var(--bdsfb-border);
}

.bdsfb-checkbox:checked + .bdsfb-checkbox-custom,
.bdsfb-radio:checked + .bdsfb-radio-custom,
.bdsfb-radio:checked + .bdsfb-radio-card .bdsfb-radio-card-indicator,
.bdsfb-checkbox:checked + .bdsfb-switch,
.bdsfb-checkbox-group[data-style="button"] .bdsfb-checkbox:checked + .bdsfb-checkbox-btn,
.bdsfb-radio-group[data-style="button"] .bdsfb-radio:checked + .bdsfb-radio-btn,
.bdsfb-preview-nav button:hover:not(:disabled),
.bdsfb-preview-header {
    background: linear-gradient(135deg, var(--bdsfb-primary) 0%, var(--bdsfb-primary-dark) 100%);
    border-color: var(--bdsfb-primary);
}

.bdsfb-radio:checked + .bdsfb-radio-card,
.bdsfb-file-upload-wrap:hover .bdsfb-file-upload-ui,
.bdsfb-file-upload-wrap.drag-over .bdsfb-file-upload-ui {
    border-color: color-mix(in srgb, var(--bdsfb-primary) 30%, var(--bdsfb-border));
    background: color-mix(in srgb, var(--bdsfb-primary) 6%, white);
}

.bdsfb-radio:checked + .bdsfb-radio-card {
    background: color-mix(in srgb, var(--bdsfb-primary) 5%, white);
}

.bdsfb-field-error,
.bdsfb-char-counter.bdsfb-char-over-limit .bdsfb-char-current {
    color: var(--bdsfb-error);
}

.bdsfb-field-has-error .bdsfb-input,
.bdsfb-field-has-error .bdsfb-textarea,
.bdsfb-field-has-error .bdsfb-select,
.bdsfb-field-has-error .bdsfb-file-upload-ui {
    border-color: var(--bdsfb-error);
}

.bdsfb-success-message {
    background: color-mix(in srgb, var(--bdsfb-success) 10%, white);
    border-color: color-mix(in srgb, var(--bdsfb-success) 28%, white);
}

.bdsfb-success-icon,
.bdsfb-success-text {
    color: var(--bdsfb-success);
}

.bdsfb-form-error-message {
    background: color-mix(in srgb, var(--bdsfb-error) 8%, white);
    border-color: color-mix(in srgb, var(--bdsfb-error) 24%, white);
    color: color-mix(in srgb, var(--bdsfb-error) 82%, black);
}

.bdsfb-spinner {
    border-top-color: var(--bdsfb-primary);
}

.bdsfb-input:focus-visible,
.bdsfb-textarea:focus-visible,
.bdsfb-select:focus-visible,
.bdsfb-btn:focus-visible {
    outline-color: var(--bdsfb-primary);
}

.bdsfb-checkbox:focus-visible + .bdsfb-checkbox-custom,
.bdsfb-radio:focus-visible + .bdsfb-radio-custom {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--bdsfb-primary) 24%, transparent);
}
