/* ================================================
   MissMirror Form Builder - Frontend Base Styles
   Enterprise UI v2.0
   ================================================ */

/* Form wrapper - base defaults (overridden by dynamic CSS) */
.mmfb-form-wrapper {
    box-sizing: border-box;
}

.mmfb-form-wrapper *,
.mmfb-form-wrapper *::before,
.mmfb-form-wrapper *::after {
    box-sizing: border-box;
}

.mmfb-form {
    position: relative;
}

/* Fields row - flex layout for multi-column */
.mmfb-fields-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0 16px;
}

/* Field widths */
.mmfb-field {
    margin-bottom: 18px;
}

.mmfb-field-width-100 { width: 100%; }
.mmfb-field-width-75 { width: calc(75% - 12px); }
.mmfb-field-width-66 { width: calc(66.666% - 11px); }
.mmfb-field-width-50 { width: calc(50% - 8px); }
.mmfb-field-width-33 { width: calc(33.333% - 11px); }
.mmfb-field-width-25 { width: calc(25% - 12px); }

/* Labels */
.mmfb-field > label {
    display: block;
    margin-bottom: 6px;
    line-height: 1.3;
}

.mmfb-required {
    color: #dc3232;
    font-weight: 500;
}

/* Inputs base */
.mmfb-field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]),
.mmfb-field textarea,
.mmfb-field select {
    width: 100%;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.mmfb-field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):focus,
.mmfb-field textarea:focus,
.mmfb-field select:focus {
    box-shadow: 0 0 0 3px rgba(194, 24, 91, 0.1);
}

.mmfb-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23666'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px !important;
    cursor: pointer;
}

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

/* Error messages */
.mmfb-error {
    display: block;
    color: #dc3232;
    font-size: 12px;
    margin-top: 6px;
    min-height: 0;
    font-weight: 500;
    line-height: 1.3;
}

.mmfb-error:empty {
    display: none;
}

.mmfb-input-error {
    border-color: #dc3232 !important;
    box-shadow: 0 0 0 3px rgba(220, 50, 50, 0.08) !important;
}

/* Options group (checkbox/radio) */
.mmfb-options-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.mmfb-options-group.mmfb-options-inline {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 14px;
}

.mmfb-option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #444;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.15s ease;
}

.mmfb-option-label:hover {
    color: #222;
}

.mmfb-option-label input[type="checkbox"],
.mmfb-option-label input[type="radio"] {
    margin: 0;
    width: 16px;
    height: 16px;
    accent-color: #c2185b;
    cursor: pointer;
}

/* Consent */
.mmfb-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    line-height: 1.5;
    padding: 8px 12px;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 6px;
    transition: border-color 0.15s ease;
}

.mmfb-consent-label:hover {
    border-color: #ccc;
}

.mmfb-consent-label input[type="checkbox"] {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    accent-color: #c2185b;
    flex-shrink: 0;
    cursor: pointer;
}

/* Layout fields */
.mmfb-heading {
    margin: 12px 0 6px;
    color: #333;
    letter-spacing: -0.01em;
}

.mmfb-heading-desc {
    margin: 0 0 8px;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.mmfb-divider {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 12px 0;
}

.mmfb-html-content {
    font-size: 14px;
    line-height: 1.6;
    color: #444;
}

/* Submit row */
.mmfb-submit-row {
    margin-top: 12px;
}

.mmfb-submit-btn {
    text-align: center;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.mmfb-submit-btn:active {
    transform: translateY(1px);
}

/* Messages */
.mmfb-message {
    padding: 14px 18px;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 16px;
    line-height: 1.5;
    font-weight: 500;
    position: relative;
}

.mmfb-message-success {
    border-left: 4px solid #2e7d32;
}

.mmfb-message-error {
    border-left: 4px solid #c62828;
}

.mmfb-no-fields {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 24px;
    font-size: 14px;
}

/* Loading state */
.mmfb-form.mmfb-loading {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.mmfb-form.mmfb-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 3px solid #e0e0e0;
    border-top-color: #c2185b;
    border-radius: 50%;
    animation: mmfbSpin 0.6s linear infinite;
    z-index: 10;
}

/* Hidden field */
.mmfb-field[data-type="hidden"] {
    display: none;
}

/* Responsive - force full width on mobile */
@media (max-width: 768px) {
    .mmfb-field {
        width: 100% !important;
    }
}

/* Animations */
@keyframes mmfbFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes mmfbSpin {
    to { transform: rotate(360deg); }
}

.mmfb-message {
    animation: mmfbFadeIn 0.3s ease;
}
