/**
 * Automation Content - Fusion Builder Styles
 * 
 * This file contains the styles for the Fusion Builder integration.
 * 
 * @since 1.0.0
 */

/* Element Icon for Fusion Builder Library */
i.fusiona-code {
    display: inline-block;
    font-size: 16px;
    line-height: 1;
}

/* Dialog Styles - Make extremely specific to avoid being overridden */
body .pmc-html-dialog,
html body .pmc-html-dialog,
.fusion-builder-live body .pmc-html-dialog,
#wrapper .pmc-html-dialog,
.fusion-body .pmc-html-dialog {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 700px !important;
    height: 500px !important;
    background-color: #fff !important;
    z-index: 99999999 !important; /* Extremely high z-index */
    box-shadow: 0 5px 25px rgba(0,0,0,0.5) !important;
    border-radius: 5px !important;
    display: flex !important;
    flex-direction: column !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    border: 1px solid #198fd9 !important;
    animation: pmc-dialog-appear 0.2s ease-out !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

@keyframes pmc-dialog-appear {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

body .pmc-dialog-header,
html body .pmc-dialog-header,
.fusion-builder-live body .pmc-dialog-header,
#wrapper .pmc-dialog-header,
.fusion-body .pmc-dialog-header {
    padding: 20px !important;
    background-color: #198fd9 !important;
    border-bottom: 1px solid #e5e5e5 !important;
    border-radius: 5px 5px 0 0 !important;
    margin: 0 !important;
}

body .pmc-dialog-header h2,
html body .pmc-dialog-header h2,
.fusion-builder-live body .pmc-dialog-header h2,
#wrapper .pmc-dialog-header h2,
.fusion-body .pmc-dialog-header h2 {
    margin: 0 !important;
    font-size: 20px !important;
    color: #fff !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    text-align: left !important;
}

body .pmc-dialog-body,
html body .pmc-dialog-body,
.fusion-builder-live body .pmc-dialog-body,
#wrapper .pmc-dialog-body,
.fusion-body .pmc-dialog-body {
    padding: 20px !important;
    flex: 1 !important;
    overflow: auto !important;
    background-color: #fff !important;
}

body .pmc-dialog-footer,
html body .pmc-dialog-footer,
.fusion-builder-live body .pmc-dialog-footer,
#wrapper .pmc-dialog-footer,
.fusion-body .pmc-dialog-footer {
    padding: 15px 20px !important;
    background-color: #f8f8f8 !important;
    border-top: 1px solid #e5e5e5 !important;
    text-align: right !important;
    border-radius: 0 0 5px 5px !important;
}

body .pmc-dialog-backdrop,
html body .pmc-dialog-backdrop,
.fusion-builder-live body .pmc-dialog-backdrop,
#wrapper .pmc-dialog-backdrop,
.fusion-body .pmc-dialog-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-color: rgba(0,0,0,0.7) !important;
    z-index: 99999998 !important; /* Extremely high z-index, one less than dialog */
}

body #pmc-html-input,
html body #pmc-html-input,
.fusion-builder-live body #pmc-html-input,
#wrapper #pmc-html-input,
.fusion-body #pmc-html-input {
    width: 100% !important;
    height: 100% !important;
    border: 1px solid #ddd !important;
    border-radius: 3px !important;
    padding: 15px !important;
    font-family: 'Courier New', monospace !important;
    font-size: 14px !important;
    resize: none !important;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1) !important;
    background-color: #fff !important;
    color: #333 !important;
}

body #pmc-html-input:focus,
html body #pmc-html-input:focus,
.fusion-builder-live body #pmc-html-input:focus,
#wrapper #pmc-html-input:focus,
.fusion-body #pmc-html-input:focus {
    border-color: #198fd9 !important;
    box-shadow: 0 0 0 1px rgba(25,143,217,0.2) !important;
    outline: none !important;
}

body .pmc-fusion-button,
html body .pmc-fusion-button,
.fusion-builder-live body .pmc-fusion-button,
#wrapper .pmc-fusion-button,
.fusion-body .pmc-fusion-button {
    margin-left: 10px !important;
    min-width: 100px !important;
    background-color: #198fd9 !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 3px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    transition: background-color 0.2s !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    text-decoration: none !important;
}

body .pmc-fusion-button:hover,
html body .pmc-fusion-button:hover,
.fusion-builder-live body .pmc-fusion-button:hover,
#wrapper .pmc-fusion-button:hover,
.fusion-body .pmc-fusion-button:hover {
    background-color: #0e7abd !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1) !important;
}

body .pmc-fusion-button.cancel,
html body .pmc-fusion-button.cancel,
.fusion-builder-live body .pmc-fusion-button.cancel,
#wrapper .pmc-fusion-button.cancel,
.fusion-body .pmc-fusion-button.cancel {
    background-color: #f2f2f2 !important;
    color: #333 !important;
}

body .pmc-fusion-button.cancel:hover,
html body .pmc-fusion-button.cancel:hover,
.fusion-builder-live body .pmc-fusion-button.cancel:hover,
#wrapper .pmc-fusion-button.cancel:hover,
.fusion-body .pmc-fusion-button.cancel:hover {
    background-color: #e5e5e5 !important;
}

/* RTF to HTML Editor styles */
.pmc-editor-toolbar {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-bottom: none;
    padding: 5px;
    display: flex;
    flex-wrap: wrap;
}

.pmc-toolbar-btn {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 5px 10px;
    margin: 2px;
    cursor: pointer;
}

.pmc-toolbar-btn:hover {
    background: #f0f0f0;
}

.pmc-toolbar-separator {
    width: 1px;
    background: #ddd;
    margin: 0 5px;
}

.pmc-editor-container {
    display: flex;
    height: 400px;
    border: 1px solid #ddd;
}

.pmc-editor-pane {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
}

.pmc-rtf-editor {
    border-right: 1px solid #ddd;
}

.pmc-html-editor {
    font-family: monospace;
    white-space: pre-wrap;
    background: #f8f8f8;
}

/* Element styles */
.pmc-fusion-content {
    padding: 20px;
    background-color: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Dialog z-index overrides for special cases */
body.fusion-builder-library-open .ui-dialog,
body.fusion-builder-palette-open .ui-dialog,
body.fusion-builder-settings-open .ui-dialog,
div.ui-dialog,
div.mfp-wrap {
    z-index: 99999900 !important; /* High but still below our dialog */
}

/* Prevent any Avada theme conflicts */
body .fusion-builder-live-editor .fusion-builder-wireframe-utility-toolbar {
    z-index: 99999900 !important; /* High but below our dialog */
} 