/**
 * Front-end CSS for Lola Form Builder
 */

:root {
    --lfb-primary: #4A6CFA;
    --lfb-primary-light: #EEF1FF;
    --lfb-primary-dark: #3852D4;
    --lfb-gray-100: #f8f9fa;
    --lfb-gray-200: #e9ecef;
    --lfb-gray-300: #dee2e6;
    --lfb-gray-400: #ced4da;
    --lfb-gray-500: #adb5bd;
    --lfb-gray-600: #6c757d;
    --lfb-gray-700: #495057;
    --lfb-gray-800: #343a40;
    --lfb-success: #28a745;
    --lfb-danger: #dc3545;
    --lfb-border-radius: 8px;
    --lfb-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1);
    --lfb-transition: all 0.2s ease-in-out;
    --lfb-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Form wrapper */
.lfb-form-wrapper {
    margin: 30px 0;
    width: 100%;
    max-width: 100%;
    font-family: var(--lfb-font-family);
    color: var(--lfb-gray-800);
}

/* Form messages */
.lfb-form-messages {
    margin-bottom: 25px;
}

.lfb-form-message {
    padding: 16px 20px;
    border-radius: var(--lfb-border-radius);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    box-shadow: var(--lfb-box-shadow);
}

.lfb-form-message:before {
    font-family: dashicons;
    margin-right: 12px;
    font-size: 20px;
}

.lfb-form-success {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--lfb-success);
    border-left: 4px solid var(--lfb-success);
}

.lfb-form-success:before {
    content: "";
}

.lfb-form-error {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--lfb-danger);
    border-left: 4px solid var(--lfb-danger);
}

.lfb-form-error:before {
    content: "";
}

.lfb-form-submit-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Form */
.lfb-form {
    width: 100%;
    position: relative;
    margin: 0 -10px;
    display: flex;
    flex-wrap: wrap;
}

/* Form title */
.lfb-form-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    width: 100%;
}

/* Form fields */
.lfb-form-field {
    width: 100%;
    margin-bottom: 20px;
    padding: 0 10px;
    box-sizing: border-box;
}

.lfb-form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 15px;
    color: var(--lfb-gray-800);
}

.lfb-required {
    color: var(--lfb-danger);
    margin-left: 4px;
}

.lfb-field-description {
    font-size: 0.9em;
    color: var(--lfb-gray-600);
    margin-bottom: 8px;
    line-height: 1.5;
}

.lfb-form-field input[type="text"],
.lfb-form-field input[type="email"],
.lfb-form-field input[type="url"],
.lfb-form-field input[type="tel"],
.lfb-form-field input[type="number"],
.lfb-form-field input[type="date"],
.lfb-form-field textarea,
.lfb-form-field select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--lfb-gray-300);
    border-radius: var(--lfb-border-radius);
    background-color: #fff;
    color: var(--lfb-gray-800);
    font-size: 16px;
    line-height: 1.5;
    transition: var(--lfb-transition);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    font-family: var(--lfb-font-family);
}

.lfb-form-field input[type="text"]:focus,
.lfb-form-field input[type="email"]:focus,
.lfb-form-field input[type="url"]:focus,
.lfb-form-field input[type="tel"]:focus,
.lfb-form-field input[type="number"]:focus,
.lfb-form-field input[type="date"]:focus,
.lfb-form-field textarea:focus,
.lfb-form-field select:focus {
    border-color: var(--lfb-primary);
    box-shadow: 0 0 0 3px rgba(74, 108, 250, 0.15);
    outline: none;
}

.lfb-form-field select {
    padding: 0.75rem;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
}

.lfb-form-field input::placeholder,
.lfb-form-field textarea::placeholder {
    color: var(--lfb-gray-500);
    opacity: 1;
}

.lfb-form-field textarea {
    min-height: 120px;
    resize: vertical;
}

/* Checkbox and radio fields */
.lfb-checkbox-field label, 
.lfb-radio-field label {
    font-weight: 600;
    margin-bottom: 10px;
}

.lfb-checkbox-group,
.lfb-radio-group {
    margin-top: 8px;
    display: block;
    width: 100%;
}

.lfb-checkbox-item,
.lfb-radio-item {
    margin-bottom: 10px;
    display: block;
    width: 100%;
}

.lfb-checkbox-item label,
.lfb-radio-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 400;
    margin-bottom: 0;
    padding: 6px 0;
}

.lfb-checkbox-item label span,
.lfb-radio-item label span {
    margin-left: 10px;
    line-height: 1.4;
}

.lfb-checkbox-item input,
.lfb-radio-item input {
    margin-right: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 1px solid var(--lfb-gray-400);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    position: relative;
    background-color: white;
    transition: var(--lfb-transition);
    flex-shrink: 0;
}

.lfb-radio-item input {
    border-radius: 50%;
}

.lfb-checkbox-item input:checked,
.lfb-radio-item input:checked {
    background-color: var(--lfb-primary);
    border-color: var(--lfb-primary);
}

.lfb-checkbox-item input:checked::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.lfb-radio-item input:checked::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

/* Field validation */
.lfb-form-field.lfb-field-error input,
.lfb-form-field.lfb-field-error textarea,
.lfb-form-field.lfb-field-error select {
    border-color: var(--lfb-danger);
    background-color: rgba(220, 53, 69, 0.05);
}

.lfb-field-error-message {
    color: var(--lfb-danger);
    font-size: 0.85em;
    margin-top: 6px;
    display: flex;
    align-items: center;
}

.lfb-field-error-message:before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--lfb-danger);
    color: white;
    font-size: 12px;
    font-weight: bold;
    margin-right: 6px;
}

/* Submit button */
.lfb-submit-wrapper {
    margin-top: 30px;
}

.lfb-button {
    background-color: var(--lfb-primary);
    color: #fff;
    border: none;
    border-radius: var(--lfb-border-radius);
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--lfb-transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.lfb-button:hover {
    background-color: var(--lfb-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.lfb-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 108, 250, 0.3);
}

.lfb-button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.lfb-button:disabled {
    background-color: var(--lfb-gray-400);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* reCAPTCHA */
.lfb-recaptcha-wrapper {
    margin-bottom: 25px;
    width: 100%;
}

.lfb-recaptcha-error {
    color: var(--lfb-danger);
    font-size: 0.85em;
    margin-top: 6px;
    display: flex;
    align-items: center;
}

.lfb-recaptcha-error:before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--lfb-danger);
    color: white;
    font-size: 12px;
    font-weight: bold;
    margin-right: 6px;
}

/* Form layouts */
.lfb-form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
}

.lfb-form-inline .lfb-form-field {
    flex: 1 0 230px;
}

.lfb-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 25px;
}

/* Spacer field */
.lfb-spacer-field {
    clear: both;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.lfb-spacer {
    width: 100%;
    clear: both;
    display: block;
    overflow: hidden;
}

/* Removed responsive spacers using CSS variables as they're now handled inline */

.lfb-spacer-field .lfb-field-label {
    font-weight: 700;
    font-size: 1.2em;
    margin-bottom: 10px;
    color: var(--lfb-gray-800);
}

/* File upload */
.lfb-file-field input[type="file"] {
    display: block;
    margin-top: 8px;
    width: 100%;
    padding: 10px 14px;
    background-color: var(--lfb-gray-100);
    border: 1px dashed var(--lfb-gray-400);
    border-radius: var(--lfb-border-radius);
    font-size: 14px;
    color: var(--lfb-gray-700);
    cursor: pointer;
    transition: var(--lfb-transition);
}

.lfb-file-field input[type="file"]:hover {
    background-color: var(--lfb-primary-light);
    border-color: var(--lfb-primary);
}

/* HTML field */
.lfb-html-field {
    display: block;
    width: 100%;
    margin-bottom: 20px;
    overflow: visible;
}

.lfb-html-content-wrapper {
    max-width: 100%;
    overflow-x: auto;
}

.lfb-html-field h1, 
.lfb-html-field h2, 
.lfb-html-field h3, 
.lfb-html-field h4, 
.lfb-html-field h5, 
.lfb-html-field h6 {
    margin-top: 0;
    line-height: 1.2;
    color: var(--lfb-gray-800);
}

.lfb-html-field p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.lfb-html-field p:last-child {
    margin-bottom: 0;
}

.lfb-html-placeholder {
    padding: 15px;
    background-color: var(--lfb-gray-100);
    border: 1px dashed var(--lfb-gray-400);
    border-radius: var(--lfb-border-radius);
    color: var(--lfb-gray-600);
    font-style: italic;
    text-align: center;
}

/* Loading state */
.lfb-loading {
    position: relative;
    pointer-events: none;
}

.lfb-loading:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 1;
    border-radius: var(--lfb-border-radius);
}

.lfb-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid var(--lfb-gray-300);
    border-top: 3px solid var(--lfb-primary);
    border-radius: 50%;
    z-index: 2;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .lfb-form-field input[type="text"],
    .lfb-form-field input[type="email"],
    .lfb-form-field input[type="url"],
    .lfb-form-field input[type="tel"],
    .lfb-form-field input[type="number"],
    .lfb-form-field input[type="date"],
    .lfb-form-field textarea,
    .lfb-form-field select {
        padding: 10px 14px;
        font-size: 15px;
    }
    
    .lfb-form-inline .lfb-form-field,
    .lfb-form-grid {
        display: block;
    }
    
    .lfb-form-grid .lfb-form-field {
        margin-bottom: 20px;
    }
    
    .lfb-button {
        width: 100%;
        padding: 12px 20px;
    }
} 

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .lfb-form-wrapper.lfb-dark-mode-support {
        --lfb-primary-light: rgba(74, 108, 250, 0.2);
        --lfb-gray-100: #292b2c;
        --lfb-gray-200: #1e2021;
        --lfb-gray-800: #f8f9fa;
    }
    
    .lfb-form-wrapper.lfb-dark-mode-support .lfb-form-field input,
    .lfb-form-wrapper.lfb-dark-mode-support .lfb-form-field textarea,
    .lfb-form-wrapper.lfb-dark-mode-support .lfb-form-field select {
        background-color: #1e2021;
        color: #f8f9fa;
        border-color: #495057;
    }
    
    .lfb-form-wrapper.lfb-dark-mode-support .lfb-checkbox-item input,
    .lfb-form-wrapper.lfb-dark-mode-support .lfb-radio-item input {
        background-color: #1e2021;
    }
} 

/* Message when no fields are in the form */
.lfb-no-fields-message {
    padding: 30px;
    text-align: center;
    background-color: var(--lfb-gray-100);
    border: 2px dashed var(--lfb-gray-300);
    border-radius: var(--lfb-border-radius);
    margin-bottom: 25px;
    color: var(--lfb-gray-600);
    font-size: 16px;
}

/* Form status messages in URL parameters */
.lfb-status-message {
    padding: 16px 20px;
    border-radius: var(--lfb-border-radius);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    box-shadow: var(--lfb-box-shadow);
}

.lfb-status-message.lfb-success {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--lfb-success);
    border-left: 4px solid var(--lfb-success);
}

.lfb-status-message.lfb-success:before {
    content: "";
    font-family: dashicons;
    margin-right: 12px;
    font-size: 20px;
}

.lfb-status-message.lfb-error {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--lfb-danger);
    border-left: 4px solid var(--lfb-danger);
}

.lfb-status-message.lfb-error:before {
    content: "";
    font-family: dashicons;
    margin-right: 12px;
    font-size: 20px;
}

/* Column layouts */
.lfb-row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -15px;
    margin-right: -15px;
    clear: both;
}

.lfb-col {
    padding-left: 15px;
    padding-right: 15px;
    box-sizing: border-box;
}

.lfb-col-1 {
    width: 8.333333%;
}

.lfb-col-2 {
    width: 16.666667%;
}

.lfb-col-3 {
    width: 25%;
}

.lfb-col-4 {
    width: 33.333333%;
}

.lfb-col-5 {
    width: 41.666667%;
}

.lfb-col-6 {
    width: 50%;
}

.lfb-col-7 {
    width: 58.333333%;
}

.lfb-col-8 {
    width: 66.666667%;
}

.lfb-col-9 {
    width: 75%;
}

.lfb-col-10 {
    width: 83.333333%;
}

.lfb-col-11 {
    width: 91.666667%;
}

.lfb-col-12 {
    width: 100%;
}

/* Responsive columns */
@media (max-width: 768px) {
    .lfb-col {
        width: 100% !important;
    }
}

/* Helper class to clear floats */
.lfb-clearfix:after {
    content: "";
    display: table;
    clear: both;
}

/* RGPD Checkbox */
.lfb-rgpd-field {
    margin-top: 10px;
    margin-bottom: 25px;
    width: 100%;
}

.lfb-rgpd-checkbox {
    margin-top: 8px;
    width: 100%;
}

.lfb-rgpd-checkbox label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-weight: 400;
    margin-bottom: 0;
    padding: 6px 0;
    width: 100%;
}

.lfb-rgpd-checkbox input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 3px;
    flex-shrink: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border: 1px solid var(--lfb-gray-400);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    position: relative;
    background-color: white;
    transition: var(--lfb-transition);
}

.lfb-rgpd-checkbox input[type="checkbox"]:checked {
    background-color: var(--lfb-primary);
    border-color: var(--lfb-primary);
}

.lfb-rgpd-checkbox input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.lfb-rgpd-option {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
}

.lfb-consent-text {
    font-size: 0.95em;
    line-height: 1.5;
}

.lfb-checkbox-option input[type="checkbox"], 
.lfb-radio-option input[type="radio"] {
    margin-top: 4px;
    margin-right: 8px;
}

.lfb-checkbox-option label, 
.lfb-radio-option label {
    font-weight: normal;
    margin: 0;
}

.lfb-form-messages {
    margin-top: 1em;
    margin-bottom: 1em;
}
.lfb-form-success {
    color: #155724;
    background: #d4edda;
    padding: 10px;
    border-left: 4px solid #28a745;
}
.lfb-form-error {
    color: #721c24;
    background: #f8d7da;
    padding: 10px;
    border-left: 4px solid #dc3545;
}