/**
 * DBP Templates - Text Styling CSS
 * Styles for marker highlights and doodle underlines
 */

/* Marker Highlight Styles - matches your demo exactly */
.dbp-marker-highlight {
    position: relative;
    display: inline;
    margin: -2px -6px;
    padding: 2px 6px;
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

/* Doodle Underline Styles */
.dbp-doodle-underline {
    position: relative;
    display: inline;
    text-decoration: none;
}

.dbp-doodle-underline svg {
    position: absolute;
    top: 1.2em;
    left: 0;
    width: 100%;
    overflow: visible;
    pointer-events: none;
}

.dbp-doodle-underline svg path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

/* Ensure doodle underlines work in editor */
.wp-block-editor .dbp-doodle-underline {
    position: relative !important;
    display: inline !important;
    text-decoration: none !important;
}

.wp-block-editor .dbp-doodle-underline svg {
    position: absolute !important;
    top: 1.2em !important;
    left: 0 !important;
    width: 100% !important;
    overflow: visible !important;
    pointer-events: none !important;
    z-index: 1 !important;
}

/* Specific styling for block editor rich text areas */
.block-editor-rich-text__editable .dbp-doodle-underline {
    position: relative !important;
    display: inline !important;
    text-decoration: none !important;
}

.block-editor-rich-text__editable .dbp-doodle-underline svg {
    position: absolute !important;
    top: 1.2em !important;
    left: 0 !important;
    width: 100% !important;
    overflow: visible !important;
    pointer-events: none !important;
    z-index: 1 !important;
}

/* Ensure SVGs persist during focus states */
.wp-block-editor .dbp-doodle-underline:focus svg,
.wp-block-editor .dbp-doodle-underline:active svg,
.block-editor-rich-text__editable .dbp-doodle-underline:focus svg,
.block-editor-rich-text__editable .dbp-doodle-underline:active svg {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Modal Styles */
.components-modal__content .dbp-highlight-modal,
.components-modal__content .dbp-doodle-modal {
    max-width: 450px;
    width: 100%;
}

.dbp-modal-content {
    padding: 0;
}

.dbp-color-section {
    margin-bottom: 24px;
}

.dbp-color-section h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1e1e1e;
}

.dbp-color-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.dbp-color-preset {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    padding: 0;
}

.dbp-color-preset:hover {
    transform: scale(1.1);
    border-color: rgba(0, 0, 0, 0.2);
}

.dbp-color-preset.active {
    border-color: #0073aa;
    transform: scale(1.15);
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.dbp-color-preset:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.dbp-brush-section {
    margin-bottom: 24px;
}

.dbp-brush-section .components-base-control__label,
.dbp-stroke-section .components-base-control__label {
    font-size: 14px;
    font-weight: 600;
    color: #1e1e1e;
    margin-bottom: 8px;
}

.dbp-stroke-section {
    margin-bottom: 24px;
}

.dbp-preview-area {
    font-size: 22px;
    font-weight: bold;
    text-align: center;
}

.dbp-preview-section {
    margin-bottom: 24px;
}

.dbp-preview-section h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1e1e1e;
}

.dbp-preview {
    background: #f8f9fa;
    border: 1px solid #e2e4e7;
    border-radius: 6px;
    padding: 20px;
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dbp-preview span {
    font-size: 18px;
    font-weight: 500;
    line-height: 1.4;
}

.dbp-modal-actions {
    border-top: 1px solid #e2e4e7;
    padding-top: 16px;
    margin-top: 24px;
    gap: 8px;
}

.dbp-modal-actions .components-button {
    height: 36px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 500;
}

/* Color Picker Styling */
.components-color-picker {
    margin-top: 8px;
}

.components-color-picker .components-color-picker__body {
    padding: 16px;
}

/* Simple Color Picker Styles */
.dbp-simple-color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 10px 0;
}

.dbp-color-button {
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.dbp-color-button:hover {
    transform: scale(1.1);
}

.dbp-color-button:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Button Styles */
.components-button.is-primary {
    background-color: #0073aa;
    color: white;
    border-color: #0073aa;
}

.components-button.is-destructive {
    color: #d63638;
    border-color: #d63638;
}

.components-button.is-destructive:hover {
    background-color: #d63638;
    color: white;
}

/* Frontend Styles - Important overrides */
.dbp-marker-highlight {
    background-repeat: no-repeat !important;
    background-size: 100% 100% !important;
    margin: -2px -6px !important;
    padding: 2px 6px !important;
}

/* Editor Specific Styles */
.wp-block-editor .dbp-marker-highlight {
    background-repeat: no-repeat;
    background-size: 100% 100%;
    margin: -2px -6px;
    padding: 2px 6px;
}

/* Select Control Styling */
.dbp-brush-section .components-select-control__input {
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .components-modal__content .dbp-highlight-modal {
        max-width: 90vw;
        margin: 0 auto;
    }
    
    .dbp-color-presets {
        justify-content: center;
    }
    
    .dbp-color-preset {
        width: 28px;
        height: 28px;
    }
    
    .dbp-modal-actions {
        flex-direction: column;
    }
    
    .dbp-modal-actions .components-button {
        width: 100%;
        justify-content: center;
    }
} 