/* ===================================
   Survey Builder Pro — Public Styles
   =================================== */

/* ---- Base Container ---- */
.sb-survey {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1a1a2e;
    max-width: 700px;
    margin: 0 auto 40px;
    line-height: 1.6;
}

/* ---- Styles ---- */
.sb-style-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0,0,0,.08);
    overflow: hidden;
}

.sb-style-card .sb-survey-header {
    background: linear-gradient(135deg, #4F46E5, #7C3AED);
    padding: 28px 36px;
}

.sb-style-card .sb-survey-title {
    color: #fff;
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
}

.sb-style-card .sb-form { padding: 28px 36px 36px; }

/* Minimal */
.sb-style-minimal { border-top: 4px solid #4F46E5; }
.sb-style-minimal .sb-survey-header { padding: 20px 0; }
.sb-style-minimal .sb-survey-title { font-size: 1.6rem; color: #1a1a2e; }
.sb-style-minimal .sb-form { padding: 0; }

/* Bold */
.sb-style-bold {
    background: #f0f4ff;
    border-radius: 16px;
    border: 2px solid #4F46E5;
}
.sb-style-bold .sb-survey-header { background: #4F46E5; padding: 24px 30px; border-radius: 14px 14px 0 0; }
.sb-style-bold .sb-survey-title { color: #fff; font-size: 1.6rem; }
.sb-style-bold .sb-form { padding: 28px 30px; }

/* ---- Field Groups ---- */
.sb-field-group {
    margin-bottom: 24px;
}

.sb-label {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 6px;
    color: #2d2d44;
}

.sb-req { color: #e53e3e; margin-left: 2px; }

.sb-desc {
    font-size: 0.85rem;
    color: #666;
    margin: 0 0 8px;
}

/* ---- Inputs ---- */
.sb-input {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #1a1a2e;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
    font-family: inherit;
}

.sb-input:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}

.sb-textarea { resize: vertical; min-height: 110px; }

.sb-select {
    appearance: none;
    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 d='M1 1l5 5 5-5' stroke='%234F46E5' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
    cursor: pointer;
}

/* ---- Options (radio / checkbox) ---- */
.sb-option-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }

.sb-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-size: 0.95rem;
}

.sb-option:hover { border-color: #4F46E5; background: #f5f3ff; }

.sb-option input[type="radio"],
.sb-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #4F46E5;
    flex-shrink: 0;
    margin: 0;
}

.sb-option input:checked + span { color: #4F46E5; font-weight: 600; }

/* ---- Star Rating ---- */
.sb-rating {
    display: flex;
    flex-direction: row-reverse;
    gap: 4px;
    width: fit-content;
}

.sb-rating input { display: none; }

.sb-rating label {
    font-size: 2.2rem;
    color: #ddd;
    cursor: pointer;
    transition: color .15s, transform .1s;
    line-height: 1;
}

.sb-rating label:hover,
.sb-rating label:hover ~ label,
.sb-rating input:checked ~ label {
    color: #f59e0b;
}

.sb-rating label:hover { transform: scale(1.15); }

/* ---- Image Upload Area ---- */
.sb-upload-drop-zone {
    border: 2px dashed #c4b5fd;
    border-radius: 12px;
    padding: 32px 20px;
    text-align: center;
    background: #faf9ff;
    transition: background .15s, border-color .15s;
    cursor: pointer;
}

.sb-upload-drop-zone.drag-over {
    background: #f0edff;
    border-color: #4F46E5;
}

.sb-upload-icon { font-size: 2.5rem; display: block; margin-bottom: 8px; }

.sb-upload-drop-zone p {
    margin: 6px 0;
    color: #666;
    font-size: 0.9rem;
}

.sb-upload-btn {
    display: inline-block;
    background: #4F46E5;
    color: #fff;
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 10px 0;
    transition: background .15s;
}
.sb-upload-btn:hover { background: #3730a3; }

.sb-file-input { display: none; }

.sb-upload-hint { font-size: 0.78rem; color: #999; }

.sb-uploaded-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.sb-img-thumb {
    position: relative;
    width: 100px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    flex-shrink: 0;
}

.sb-img-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sb-img-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,.65);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    padding: 0;
    transition: background .15s;
}
.sb-img-remove:hover { background: #e53e3e; }

/* ---- Section Break ---- */
.sb-section-break {
    margin: 30px 0 20px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 14px;
}

.sb-section-break h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #4F46E5;
    margin: 0 0 6px;
}

/* ---- Image Display ---- */
.sb-image-display { text-align: center; margin: 20px 0; }

.sb-display-image img,
.sb-section-image img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,.1);
}

.sb-display-image figcaption,
.sb-section-image figcaption {
    font-size: 0.82rem;
    color: #888;
    margin-top: 6px;
    font-style: italic;
}

.sb-image-label {
    font-weight: 600;
    margin-top: 8px;
    color: #2d2d44;
}

/* ---- Submit Button ---- */
.sb-submit-row { margin-top: 32px; }

.sb-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #4F46E5, #7C3AED);
    color: #fff;
    border: none;
    padding: 14px 36px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity .2s, transform .1s;
    letter-spacing: .3px;
    font-family: inherit;
}

.sb-submit-btn:hover { opacity: .9; transform: translateY(-1px); }
.sb-submit-btn:active { transform: translateY(0); }
.sb-submit-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ---- Messages ---- */
.sb-messages {
    margin: 16px 36px;
    padding: 14px 18px;
    border-radius: 10px;
    font-weight: 500;
}

.sb-messages.sb-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.sb-messages.sb-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

/* ---- Field error highlight ---- */
.sb-input.sb-has-error,
.sb-field-group.sb-has-error .sb-input {
    border-color: #ef4444;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .sb-style-card .sb-survey-header,
    .sb-style-card .sb-form { padding: 20px; }

    .sb-style-bold .sb-survey-header,
    .sb-style-bold .sb-form { padding: 20px; }

    .sb-messages { margin: 12px 20px; }

    .sb-submit-btn { width: 100%; justify-content: center; }
}
