/**
 * Admin styles for SPAI Contact Form
 */

/* General */
.spai-admin-wrapper {
    margin: 20px 20px 20px 0;
    max-width: 1200px;
}

.spai-admin-header {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-bottom: 0;
    padding: 20px;
}

.spai-admin-header h1 {
    margin: 0;
    font-size: 23px;
    font-weight: 400;
    line-height: 1.3;
}

.spai-admin-content {
    background: #fff;
    border: 1px solid #c3c4c7;
    padding: 20px;
}

/* Tabs */
.spai-tabs {
    display: flex;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-bottom: 0;
}

.spai-tab {
    padding: 10px 20px;
    background: #f0f0f1;
    border: 0;
    border-right: 1px solid #c3c4c7;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.spai-tab:hover {
    background: #e5e5e5;
}

.spai-tab.active {
    background: #fff;
    font-weight: 600;
}

.spai-tab-content {
    display: none;
    padding: 20px 0;
}

.spai-tab-content.active {
    display: block;
}

/* Form Builder */
.spai-form-builder-wrapper {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.spai-form-builder-sidebar {
    flex: 0 0 200px;
    background: #f6f7f7;
    border: 1px solid #c3c4c7;
    padding: 15px;
}

.spai-form-builder-sidebar h3 {
    margin-top: 0;
    font-size: 14px;
}

.spai-field-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.spai-add-field {
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    padding: 8px 10px;
}

.spai-add-field .dashicons {
    margin-right: 8px;
}

.spai-form-builder-main {
    flex: 1;
    background: #f6f7f7;
    border: 1px solid #c3c4c7;
    padding: 15px;
    min-height: 400px;
}

.spai-form-builder-main h3 {
    margin-top: 0;
    font-size: 14px;
}

.spai-form-builder-properties {
    flex: 0 0 300px;
    background: #f6f7f7;
    border: 1px solid #c3c4c7;
    padding: 15px;
}

.spai-form-builder-properties h3 {
    margin-top: 0;
    font-size: 14px;
}

/* Form Fields List */
.spai-form-fields-list {
    min-height: 200px;
}

.spai-field-item {
    background: #fff;
    border: 1px solid #c3c4c7;
    margin-bottom: 10px;
    border-radius: 3px;
}

.spai-field-item.ui-sortable-helper {
    opacity: 0.8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.spai-field-placeholder {
    background: #f0f0f1;
    border: 2px dashed #c3c4c7;
    height: 50px;
    margin-bottom: 10px;
}

.spai-field-header {
    display: flex;
    align-items: center;
    padding: 10px;
    position: relative;
}

.spai-field-move {
    cursor: move;
    color: #787c82;
    margin-right: 10px;
}

.spai-field-label {
    flex: 1;
    font-weight: 600;
}

.spai-field-type {
    color: #787c82;
    font-size: 12px;
    margin-left: 10px;
}

.spai-field-required {
    color: #d63638;
    margin-left: 5px;
}

.spai-field-actions {
    display: flex;
    gap: 5px;
    margin-left: auto;
}

.spai-field-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #787c82;
    transition: color 0.2s;
}

.spai-field-actions button:hover {
    color: #2271b1;
}

.spai-field-actions button:hover .dashicons-trash {
    color: #d63638;
}

/* Field Editor */
.spai-field-editor {
    background: #fff;
    padding: 15px;
    border-radius: 3px;
}

.spai-field-editor h3 {
    margin-top: 0;
    font-size: 14px;
    border-bottom: 1px solid #c3c4c7;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.spai-field-group {
    margin-bottom: 15px;
}

.spai-field-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
}

.spai-field-group input[type="text"],
.spai-field-group input[type="url"],
.spai-field-group textarea {
    width: 100%;
}

.spai-field-group input[type="checkbox"] {
    margin-right: 5px;
}

.spai-field-group .description {
    margin-top: 5px;
    color: #646970;
    font-size: 13px;
}

.spai-field-editor-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #c3c4c7;
}

/* Integration Settings */
.spai-integration-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    padding: 20px;
    margin-bottom: 20px;
}

.spai-integration-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.spai-integration-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Field Mapping */
.spai-field-mapping {
    border: 1px solid #c3c4c7;
    padding: 15px;
    background: #f6f7f7;
}

.spai-mapping-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.spai-mapping-row select {
    flex: 1;
}

/* Buttons */
.spai-button {
    display: inline-block;
    text-decoration: none;
    font-size: 13px;
    line-height: 2.15384615;
    min-height: 30px;
    margin: 0;
    padding: 0 10px;
    cursor: pointer;
    border: 1px solid #2271b1;
    border-radius: 3px;
    background: #2271b1;
    color: #fff;
}

.spai-button:hover {
    background: #135e96;
    border-color: #135e96;
    color: #fff;
}

.spai-button-secondary {
    background: #f0f0f1;
    border-color: #0073aa;
    color: #0073aa;
}

.spai-button-secondary:hover {
    background: #e5e5e5;
    color: #0073aa;
}
/* Form Builder Styles */
.spai-form-builder-wrapper {
    display: grid;
    grid-template-columns: 200px 1fr 300px;
    gap: 20px;
    margin-top: 20px;
}

.spai-form-builder-sidebar,
.spai-form-builder-main,
.spai-form-builder-properties {
    background: #fff;
    border: 1px solid #ccd0d4;
    padding: 20px;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.spai-form-builder-sidebar h3,
.spai-form-builder-main h3,
.spai-form-builder-properties h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 600;
}

/* Field Buttons */
.spai-field-buttons {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.spai-field-buttons .button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
}

.spai-field-buttons .button .dashicons {
    margin-right: 8px;
}

/* Form Fields List */
.spai-form-fields-list {
    min-height: 200px;
}

.spai-field-item {
    background: #f8f9fa;
    border: 1px solid #ddd;
    margin-bottom: 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.spai-field-item:hover {
    border-color: #2271b1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.spai-field-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 10px;
}

.spai-field-move {
    cursor: move;
    color: #666;
}

.spai-field-label {
    flex: 1;
    font-weight: 500;
}

.spai-field-type {
    color: #666;
    font-size: 12px;
}

.spai-field-required {
    color: #d63638;
    font-weight: bold;
    margin-left: 5px;
}

.spai-field-actions {
    display: flex;
    gap: 5px;
}

.spai-field-actions button {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

.spai-field-actions button:hover {
    color: #2271b1;
}

.spai-field-actions button:hover .dashicons-trash {
    color: #d63638;
}

/* Field Placeholder */
.spai-field-placeholder {
    background: #f0f0f1;
    border: 2px dashed #ccd0d4;
    height: 50px;
    margin-bottom: 8px;
}

/* Field Editor */
.spai-field-editor {
    font-size: 13px;
}

.spai-field-editor h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.spai-field-group {
    margin-bottom: 15px;
}

.spai-field-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #1d2327;
}

.spai-field-group input[type="text"],
.spai-field-group input[type="url"],
.spai-field-group textarea {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
}

.spai-field-group textarea {
    resize: vertical;
}

.spai-field-group .description {
    font-size: 12px;
    color: #646970;
    margin-top: 4px;
}

.spai-field-editor-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

/* Responsive */
@media (max-width: 1200px) {
    .spai-form-builder-wrapper {
        grid-template-columns: 1fr;
    }
    
    .spai-field-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .spai-field-buttons .button {
        width: auto;
    }
}

/* Export Buttons */
.page-title-action .dashicons {
    vertical-align: middle;
    line-height: 1;
}