/**
 * AD Pro Forms - Form Builder Styles
 */

.adpf-form-builder-wrapper {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.adpf-fields-sidebar {
    width: 250px;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 15px;
}

.adpf-fields-sidebar h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 600;
}

.adpf-field-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 8px;
    background: #f4f4f4;
    border: 1px solid #dfdfdf;
    border-radius: 4px;
    cursor: move;
    transition: all 0.2s;
}

.adpf-field-item:hover {
    background: #f5f4ec;
    border-color: #ff7120;
}

.adpf-field-item.dragging {
    opacity: 0.5;
}

.adpf-field-item .dashicons {
    color: #ff7120;
}

.adpf-form-builder-area {
    flex: 1;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    min-height: 400px;
}

.adpf-form-builder-dropzone {
    min-height: 300px;
    position: relative;
}

.adpf-form-builder-dropzone.drag-over {
    background: #fff4ec;
    border: 2px dashed #ff7120;
}

.adpf-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #646970;
    font-style: italic;
    border: 2px dashed #dcdcde;
    border-radius: 4px;
}

.adpf-form-field {
    position: relative;
    margin-bottom: 15px;
    border: 1px solid #dfdfdf;
    border-radius: 4px;
    background: #fff;
    transition: all 0.2s;
}

@keyframes adpf-moved-flash {
    0%   { opacity: 1; }
    65%  { opacity: 1; }
    100% { opacity: 0; }
}

.adpf-form-field.adpf-field-moved::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(40, 167, 69, 0.15);
    border-radius: 4px;
    pointer-events: none;
    z-index: 1;
    animation: adpf-moved-flash 0.7s ease-out forwards;
}

.adpf-form-field:hover {
    border-color: #ff7120;
    box-shadow: 0 0 0 1px #ff7120;
}

.adpf-field-config {
    display: none;
    padding: 15px;
    border-top: 1px solid #dcdcde;
    background: #f9f9f9;
}

.adpf-field-config.expanded {
    display: block;
}

.adpf-field-config .form-table {
    margin-top: 0;
}

.adpf-field-config-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dcdcde;
    display: flex;
    gap: 10px;
}

.adpf-field-toggle .dashicons {
    transition: transform 0.2s;
}

.adpf-field-handle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    cursor: move;
    background: #f4f4f4;
    border-bottom: 1px solid #dfdfdf;
}

.adpf-field-handle .dashicons {
    color: #ff7120;
    cursor: move;
}

.adpf-field-label {
    font-weight: 600;
    color: #1d2327;
    width: auto;
    max-width: none;
}

.adpf-required-badge {
    color: #d63638;
    margin-left: 5px;
}

.adpf-field-type {
    margin-left: auto;
    font-size: 11px;
    color: #646970;
    text-transform: uppercase;
    background: #f0f0f1;
    padding: 2px 8px;
    border-radius: 3px;
}

.adpf-field-actions {
    display: flex;
    gap: 5px;
}

.adpf-field-actions .button-link {
    padding: 0;
    min-height: auto;
    line-height: 1;
    cursor: pointer !important;
}

.adpf-field-actions .dashicons {
    cursor: pointer !important;
}

.adpf-field-actions .adpf-field-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: #ff7120 !important;
    color: #fff !important;
    border: 1px solid #ff7120 !important;
    border-radius: 2px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    transition: all 0.2s;
}

.adpf-field-actions .adpf-field-toggle:hover {
    background: #ff8f4d !important;
    border-color: #ff8f4d !important;
    color: #fff !important;
}

.adpf-field-actions .adpf-field-duplicate {
    color: #50575e;
    padding: 4px 8px;
    transition: all 0.2s;
}

.adpf-field-actions .adpf-field-duplicate:hover {
    color: #ff7120;
}

.adpf-field-actions .adpf-field-move-up,
.adpf-field-actions .adpf-field-move-down {
    color: #50575e;
    padding: 4px 6px;
    transition: color 0.15s;
}

.adpf-field-actions .adpf-field-move-up:hover,
.adpf-field-actions .adpf-field-move-down:hover {
    color: #ff7120;
}

.adpf-field-actions .adpf-field-move-up:disabled,
.adpf-field-actions .adpf-field-move-down:disabled {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}

.adpf-edit-text {
    font-size: 13px;
    color: #fff;
}

.adpf-field-toggle:hover .adpf-edit-text {
    color: #fff;
}

.adpf-field-toggle .dashicons {
    color: #fff;
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.adpf-field-actions .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.adpf-field-placeholder {
    height: 60px;
    background: #fff4ec;
    border: 2px dashed #ff7120;
    border-radius: 4px;
    margin-bottom: 15px;
}


/* Modal */
.adpf-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100000;
    align-items: center;
    justify-content: center;
}

.adpf-modal-overlay.show {
    display: flex;
}

.adpf-modal {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.adpf-modal-header {
    padding: 20px;
    border-bottom: 1px solid #dcdcde;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.adpf-modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.adpf-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #646970;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
}

.adpf-modal-close:hover {
    color: #1d2327;
}

.adpf-modal-body {
    padding: 20px;
}

.adpf-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #dcdcde;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Options */
.adpf-option-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.adpf-option-input {
    flex: 1;
}

.adpf-remove-option {
    min-width: 30px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
}

/* Drag ghost */
.adpf-drag-ghost {
    pointer-events: none;
    background: #fff;
    border: 2px solid #ff7120;
    border-radius: 4px;
    margin: 0;
}

/* Drop indicator line */
.adpf-drop-indicator {
    height: 3px;
    background: #ff7120;
    border-radius: 2px;
    margin: 8px 0;
    pointer-events: none;
    box-shadow: 0 0 0 2px rgba(255, 113, 32, 0.2);
}

/* Form Editor Header */
.adpf-form-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.adpf-form-editor-title {
    margin: 0;
}

.adpf-top-actions {
    display: flex;
    gap: 16px;
}

/* Form Action Buttons (Save/Cancel) */
.adpf-form-action-button {
    font-size: 16px !important;
    padding: 10px 20px !important;
    height: auto !important;
    min-height: auto !important;
    line-height: 1.5 !important;
}

.adpf-form-editor-footer-actions {
    margin-top: 30px;
}

/* Field width toggle */
.adpf-field-width-toggle {
    display: inline-flex !important;
    align-items: center;
    gap: 3px;
    padding: 4px 8px;
    color: #50575e;
    font-size: 11px;
    border: 1px solid #dfdfdf !important;
    border-radius: 2px;
    background: #f4f4f4 !important;
    transition: all 0.2s;
    cursor: pointer;
}

.adpf-field-width-toggle:hover {
    color: #ff7120;
    border-color: #ff7120 !important;
}

.adpf-field-width-toggle .dashicons {
    font-size: 14px !important;
    width: 14px !important;
    height: 14px !important;
    color: inherit !important;
}

.adpf-field-width-toggle.adpf-width-half {
    background: #fff4ec !important;
    border-color: #ff7120 !important;
    color: #ff7120;
}

.adpf-width-label {
    font-weight: 600;
    font-size: 11px;
}

/* Half-width field visual indicator in builder */
.adpf-form-field-half {
    border-color: #ff7120;
    border-left: 3px solid #ff7120;
}

/* Shared card + tab styles now live in assets/css/admin.css (.adpf-ui scope). */
#adpf-tab-settings.adpf-tab-panel { padding-top: 16px; }
#adpf-tab-builder.adpf-tab-panel { padding-top: 20px; }

/* ── Form editor layout ──────────────────────────────────────────────── */
/* Settings tab: constrain width like the settings page */
#adpf-tab-settings { max-width: 900px; }

/* Builder tab: full-width flex layout */
.adpf-form-builder-wrapper { align-items: flex-start; }
.adpf-sidebar-card { width: 240px; flex-shrink: 0; }
.adpf-builder-card { flex: 1; min-width: 0; }

/* Remove box from sidebar / builder area — now provided by .adpf-card */
.adpf-sidebar-card .adpf-fields-sidebar {
    width: auto;
    background: none;
    border: none;
    border-radius: 0;
    padding: 12px;
}
.adpf-builder-card .adpf-form-builder-area {
    background: none;
    border: none;
    border-radius: 0;
    padding: 16px;
    min-height: 400px;
}