/**
 * Gravity Forms List Field Custom Styles
 * - Individual column labels
 * - WYSIWYG editor styling
 * - Modal-specific adjustments
 */
/* Single Entry View Custom Styles */
.gv-edit-entry-wrapper .gfield_list_groups .gfield_list_group {
    display: flex;
    flex-direction: column;
}

/* Hide the header row (controlled by JS, but backup CSS) */
.gfield_list_header.gform-grid-row {
    display: none !important;
}

/* Modal-specific styles */
.gv-edit-entry-wrapper .gfield_list_header.gform-grid-row,
.gv-modal .gfield_list_header.gform-grid-row {
    display: none !important;
}

/* Column labels */
.gfield-list-cell-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    color: #333;
}

/* List group item spacing */
.gfield_list_group_item {
    margin-bottom: 15px;
}

/* WYSIWYG Editor container */
.gfield_list_group_item .wp-editor-wrap {
    margin-top: 5px;
}

/* TinyMCE editor styling */
.gfield_list_group_item .wp-editor-container {
    border: 1px solid #ddd;
    border-radius: 4px;
}

.gfield_list_group_item .mce-tinymce {
    border: none !important;
    box-shadow: none !important;
}

.gfield_list_group_item .mce-toolbar-grp {
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

/* Editor tabs styling */
.gfield_list_group_item .wp-editor-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}

.gfield_list_group_item .wp-switch-editor {
    background: #20231d !important;
    color: #fff !important;
    border: 1px solid #20231d !important;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gfield_list_group_item .wp-switch-editor:hover {
    background: #2d3128 !important;
    border-color: #2d3128 !important;
}

.gfield_list_group_item .wp-switch-editor.switch-tmce,
.gfield_list_group_item .wp-switch-editor.switch-html {
    background: #20231d !important;
}

.gfield_list_group_item .wp-switch-editor.switch-tmce.active,
.gfield_list_group_item .wp-switch-editor.switch-html.active {
    background: #2d3128 !important;
    border-color: #2d3128 !important;
}

/* Modal-specific TinyMCE adjustments */
.gv-edit-entry-wrapper .mce-tinymce,
.gv-modal .mce-tinymce {
    position: relative !important;
    z-index: 1 !important;
}

/* Ensure TinyMCE dropdowns appear above modal */
.mce-floatpanel {
    z-index: 999999 !important;
}

.mce-menu {
    z-index: 999999 !important;
}

/* Modal overflow adjustments */
.gv-edit-entry-wrapper,
.gv-modal {
    overflow: visible !important;
}

.gv-edit-entry-wrapper .gform_wrapper,
.gv-modal .gform_wrapper {
    overflow: visible !important;
}

/* Editor textarea fallback */
.gform-wysiwyg-editor {
    width: 100%;
    min-height: 200px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

/* Row styling improvements */
.gfield_list_group {
    padding: 20px;
    margin-bottom: 20px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
}

/* Button styling */
.gfield_list_icons {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding-top: 30px; /* Align with labeled inputs */
}

.gfield_list_icons button {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add_list_item {
    background: #0073aa;
    color: white;
    border: none;
}

.add_list_item:hover {
    background: #005a87;
}

.delete_list_item {
    background: #dc3232;
    color: white;
    border: none;
}

.delete_list_item:hover {
    background: #a82828;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gfield_list_group {
        padding: 15px;
    }
    
    .gfield-list-cell-label {
        font-size: 13px;
    }
    
    .gform-wysiwyg-editor {
        min-height: 150px;
    }
}

/* Visual feedback for processed rows */
.gfield_list_group[data-custom-processed="true"] {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0.7;
    }
    to {
        opacity: 1;
    }
}
