/**
 * YFB Frontend Styles
 *
 * Base styles for rendered forms. Most styling comes from
 * scoped inline CSS generated by the design JSON.
 * These are fallback/structural styles.
 *
 * @package YFB
 * @since 1.0.0
 */

/* ===== Form Reset ===== */
.yfb-form *,
.yfb-form *::before,
.yfb-form *::after {
    box-sizing: border-box;
}

.yfb-form {
    max-width: 720px;
    margin: 0 auto;
}

/* ===== Form Title ===== */
.yfb-form__title {
    margin: 0 0 24px;
    font-size: 24px;
    font-weight: 700;
}

/* ===== Fields Layout ===== */
.yfb-form__fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0 16px;
}

.yfb-field--full {
    width: 100%;
}

.yfb-field--half {
    width: calc(50% - 8px);
}

.yfb-field--third {
    width: calc(33.333% - 11px);
}

/* ===== Input Base ===== */
.yfb-input,
.yfb-textarea,
.yfb-select {
    display: block;
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
}

.yfb-textarea {
    resize: vertical;
    min-height: 80px;
}

.yfb-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236B7280' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px !important;
}

/* ===== Radio & Checkbox ===== */
.yfb-radio-group,
.yfb-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.yfb-radio-label,
.yfb-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.yfb-radio,
.yfb-checkbox {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}

/* ===== File Input ===== */
.yfb-file {
    padding: 8px;
}

.yfb-help-text {
    margin: 4px 0 0;
    font-size: 12px;
    color: #6B7280;
}

/* ===== Rating Stars ===== */
.yfb-rating {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* ===== Range Slider ===== */
.yfb-range-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.yfb-range {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #D1D5DB;
    border-radius: 3px;
    outline: none;
}

.yfb-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4F46E5;
    cursor: pointer;
}

.yfb-range-value {
    min-width: 36px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
}

/* ===== Signature Pad ===== */
.yfb-signature-pad-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.yfb-signature-canvas {
    display: block;
    width: 100%;
    max-width: 400px;
    background: #FAFAFA;
}

.yfb-btn--small {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid #D1D5DB;
    background: #fff;
    cursor: pointer;
    width: fit-content;
}

.yfb-btn--small:hover {
    background: #F3F4F6;
}

/* ===== Color Picker ===== */
.yfb-color-picker {
    width: 60px !important;
    height: 40px;
    padding: 2px;
    cursor: pointer;
}

/* ===== Divider ===== */
.yfb-divider {
    border: none;
    border-top: 1px solid #E5E7EB;
    margin: 16px 0;
}

/* ===== Success Message ===== */
.yfb-form__messages--success {
    text-align: center;
    padding: 32px 16px;
}

.yfb-success-icon {
    width: 56px;
    height: 56px;
    background: #10B981;
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.yfb-form__messages--error {
    color: #EF4444;
    padding: 12px;
    background: #FEF2F2;
    border-radius: 8px;
    margin-top: 12px;
    text-align: center;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .yfb-field--half,
    .yfb-field--third {
        width: 100%;
    }

    .yfb-address-row--split,
    .yfb-name-row {
        flex-direction: column;
    }
}

/* ===== Loading Overlay ===== */
.yfb-btn--submit[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ===== Modal (Frontend) ===== */
.yfb-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.yfb-modal-content {
    background: #fff;
    border-radius: 16px;
    max-width: 760px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 0;
    position: relative;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
}

.yfb-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 28px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    cursor: pointer;
    color: #6B7280;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.15s;
    z-index: 10;
}

.yfb-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #1F2937;
}

.yfb-modal-body {
    padding: 32px;
}
