/**
 * CXB Form — Frontend styles
 *
 * @since 4.3.0
 * @package Cxb_B2B_Product_Showcase
 */

/* ================================================================
   Layout
================================================================ */
.cxb-form-wrap {
    box-sizing: border-box;
}
.cxb-form-wrap *, .cxb-form-wrap *::before, .cxb-form-wrap *::after {
    box-sizing: inherit;
}

.cxb-form-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

/* Vertical: force every field to full width */
.cxb-form-layout--vertical .cxb-form-field {
    width: 100% !important;
}

/* Horizontal: field widths are set via inline style from the widget */
.cxb-form-layout--horizontal .cxb-form-field {
    flex-shrink: 0;
    min-width: 0;
}

/* ================================================================
   Field wrapper
================================================================ */
.cxb-form-field {
    display: flex;
    flex-direction: column;
}

.cxb-form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

.cxb-form-required {
    color: #e53935;
    font-weight: 700;
}

/* ================================================================
   Inputs
================================================================ */
.cxb-form-input,
.cxb-form-textarea,
.cxb-form-select {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.cxb-form-input:focus,
.cxb-form-textarea:focus,
.cxb-form-select:focus {
    border-color: #0A7AFF;
    box-shadow: 0 0 0 2px rgba(10, 122, 255, 0.15);
}

.cxb-form-textarea {
    resize: vertical;
    min-height: 100px;
}

.cxb-form-select {
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px;
}

/* ================================================================
   Checkbox group
================================================================ */
.cxb-form-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 20px;
    padding-top: 4px;
}

.cxb-form-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
}

.cxb-form-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.cxb-form-checkbox-label span {
    line-height: 1;
}

/* ================================================================
   File upload zone
================================================================ */
.cxb-form-file-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 20px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .2s, background-color .2s;
    text-align: center;
}

.cxb-form-file-zone:hover,
.cxb-form-file-zone--dragover {
    border-color: #0A7AFF;
    background-color: rgba(10, 122, 255, 0.04);
}

.cxb-form-file-input {
    /* Visually hidden but still functional when triggered by JS */
    position: absolute;
    top: 0; left: 0;
    width: 1px; height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}

.cxb-form-file-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #888;
}

.cxb-form-file-placeholder svg {
    color: #aaa;
}

.cxb-form-file-placeholder span {
    font-size: 14px;
    font-weight: 500;
}

.cxb-form-file-placeholder small {
    font-size: 12px;
    color: #aaa;
}

.cxb-form-file-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f0f7ff;
    border-radius: 6px;
    width: 100%;
}

.cxb-form-file-name {
    flex: 1;
    font-size: 14px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cxb-form-file-remove {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
    transition: color .2s;
}

.cxb-form-file-remove:hover {
    color: #e53935;
}

/* ================================================================
   File upload progress bar
================================================================ */
.cxb-form-file-progress {
    width: 100%;
    margin-top: 10px;
    position: relative;
}

.cxb-form-file-progress-bar {
    height: 6px;
    width: 0;
    background-color: #0A7AFF;
    border-radius: 3px;
    transition: width .25s ease;
}

.cxb-form-file-progress--success .cxb-form-file-progress-bar {
    background-color: #2e7d32;
}

.cxb-form-file-progress-text {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* ================================================================
   Submit button
================================================================ */
.cxb-form-actions {
    margin-top: 20px;
}

.cxb-form-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background-color: #0A7AFF;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color .2s, opacity .2s;
    line-height: 1.4;
}

.cxb-form-submit:hover {
    background-color: #005cbf;
}

.cxb-form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ================================================================
   Messages
================================================================ */
.cxb-form-message {
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.6;
}

.cxb-form-message--success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.cxb-form-message--error {
    background: #fce4ec;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* ================================================================
   Error state for fields
================================================================ */
.cxb-form-field--error .cxb-form-input,
.cxb-form-field--error .cxb-form-textarea,
.cxb-form-field--error .cxb-form-select {
    border-color: #e53935;
    box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.15);
}

.cxb-form-field--error .cxb-form-file-zone {
    border-color: #e53935;
}

/* ================================================================
   Responsive: stack on mobile
================================================================ */
@media (max-width: 768px) {
    .cxb-form-layout--horizontal .cxb-form-field {
        width: 100% !important;
    }
}
