/* Frontend Form Styles */
.afe-form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.afe-form {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.afe-field-wrapper {
    margin-bottom: 20px;
}

.afe-field-wrapper label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.afe-field-wrapper .required {
    color: #e74c3c;
}

.afe-input,
.afe-textarea,
.afe-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.afe-input:focus,
.afe-textarea:focus,
.afe-select:focus {
    outline: none;
    border-color: #3498db;
}

.afe-radio-group,
.afe-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.afe-radio-label,
.afe-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal !important;
}

.afe-radio,
.afe-checkbox {
    margin-right: 10px;
    width: auto !important;
}

.afe-form-actions {
    margin-top: 30px;
    text-align: center;
}

.afe-submit-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.afe-submit-btn:hover {
    background: #2980b9;
}

.afe-submit-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.afe-form-messages {
    margin-top: 20px;
}

.afe-success {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
}

.afe-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
}

.afe-field-errors {
    margin-top: 5px;
}

.afe-field-errors .error-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.afe-field-errors .error-list li {
    color: #e74c3c;
    font-size: 14px;
    margin-bottom: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .afe-form-container {
        padding: 10px;
    }
    
    .afe-form {
        padding: 20px;
    }
}

/* Form Grid Layout Styles */
.afe-form-container {
    max-width: 100%;
}

.afe-form-grid {
    display: grid;
    gap: 20px;
    align-items: start;
    margin-bottom: 20px;
}

/* Column span styles */
.afe-field-wrapper[data-column-span="2"] {
    grid-column: span 2;
}

.afe-field-wrapper[data-column-span="3"] {
    grid-column: span 3;
}

.afe-field-wrapper[data-column-span="4"] {
    grid-column: span 4;
}

.afe-layout-element[data-column-span="2"] {
    grid-column: span 2;
}

.afe-layout-element[data-column-span="3"] {
    grid-column: span 3;
}

.afe-layout-element[data-column-span="4"] {
    grid-column: span 4;
}

/* Layout elements */
.afe-layout-element {
    margin: 0;
}

.afe-heading {
    margin: 0 0 10px 0;
    color: #333;
}

.afe-paragraph {
    margin: 0 0 15px 0;
    line-height: 1.6;
    color: #555;
}

.afe-divider {
    border: none;
    border-top: 1px solid #ddd;
    margin: 15px 0;
}

.afe-spacer {
    width: 100%;
}

/* Responsive grid */
@media (max-width: 768px) {
    .afe-form-container[data-columns="3"] .afe-form-grid,
    .afe-form-container[data-columns="4"] .afe-form-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .afe-field-wrapper[data-column-span="3"],
    .afe-field-wrapper[data-column-span="4"],
    .afe-layout-element[data-column-span="3"],
    .afe-layout-element[data-column-span="4"] {
        grid-column: 1 / -1;
    }
}

@media (max-width: 480px) {
    .afe-form-grid {
        grid-template-columns: 1fr !important;
    }
    
    .afe-field-wrapper,
    .afe-layout-element {
        /* grid-column: 1 / -1 !important; */
    }
}

/* Form actions */
.afe-form-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Preview specific styles */
.afe-form-preview .afe-form-grid {
    border: 1px dashed #ddd;
    padding: 20px;
    background: #fafafa;
    border-radius: 4px;
}

.afe-form-preview .afe-spacer {
    opacity: 0.5;
    background: repeating-linear-gradient(45deg, #f0f0f1, #f0f0f1 10px, #fff 10px, #fff 20px);
}

/* WP Editor in properties panel */
.wp-editor-wrapper {
    margin-top: 5px;
}

.wp-editor-wrapper .wp-editor-container {
    border: 1px solid #ddd;
    border-radius: 4px;
}

.wp-editor-wrapper .mce-toolbar-grp {
    border-bottom: 1px solid #ddd;
}

/* Ensure editor fits in panel */
#wp-editor-container-* {
    max-width: 100%;
}

.wp-editor-wrapper iframe {
    max-width: 100%;
}

/* Vertical direction (default) */
.options-preview.options-vertical {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.options-preview.options-vertical .option-preview {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Horizontal direction */
.options-preview.options-horizontal {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 15px;
}

.options-preview.options-horizontal .option-preview {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Disabled option styling */
.afe-form .afe-option-disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.afe-form .afe-option-disabled input[type="checkbox"]:disabled,
.afe-form .afe-option-disabled input[type="radio"]:disabled {
    cursor: not-allowed;
}