/**
 * WikiPlatform Rich Text Editor Styles
 * Lightweight WYSIWYG toolbar for WPForms Paragraph Text fields
 */

/* Wrapper - unified border around toolbar + editor */
.wprte-wrapper {
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    background: #fff !important;
    transition: border-color 0.2s ease !important;
    margin-top: 2px !important;
}

.wprte-wrapper:focus-within {
    border-color: #0073aa !important;
    box-shadow: 0 0 0 1px #0073aa !important;
}

/* Toolbar */
.wprte-toolbar {
    display: flex !important;
    align-items: center !important;
    gap: 2px !important;
    padding: 5px 6px !important;
    background: #f9f9f9 !important;
    border-bottom: 1px solid #ddd !important;
    flex-wrap: wrap !important;
}

/* Toolbar buttons - medium size */
.wprte-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 28px !important;
    height: 28px !important;
    padding: 3px 5px !important;
    border: 1px solid transparent !important;
    border-radius: 3px !important;
    background: transparent !important;
    color: #555 !important;
    font-size: 13px !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    line-height: 1 !important;
}

.wprte-btn:hover {
    background: #e8e8e8 !important;
    border-color: #ccc !important;
    color: #333 !important;
}

.wprte-btn:active {
    background: #ddd !important;
}

.wprte-btn-active {
    background: #0073aa !important;
    color: #fff !important;
    border-color: #006799 !important;
}

.wprte-btn-active svg {
    fill: #fff !important;
}

.wprte-btn strong {
    font-weight: 700 !important;
    font-size: 14px !important;
}

.wprte-btn em {
    font-style: italic !important;
    font-size: 14px !important;
    font-family: Georgia, "Times New Roman", serif !important;
}

/* Subscript and Superscript button text */
.wprte-btn .wprte-sub-icon {
    font-size: 13px !important;
    line-height: 1 !important;
}

.wprte-btn .wprte-sub-icon sub,
.wprte-btn .wprte-sub-icon sup {
    font-size: 9px !important;
    line-height: 0 !important;
}

/* Separator between button groups */
.wprte-separator {
    width: 1px !important;
    height: 20px !important;
    background: #ccc !important;
    margin: 0 3px !important;
}

/* === Undo / Redo buttons === */
.wprte-btn-undo,
.wprte-btn-redo {
    padding: 3px 5px !important;
}

.wprte-btn-undo svg,
.wprte-btn-redo svg {
    width: 18px !important;
    height: 18px !important;
    stroke: #555 !important;
    fill: none !important;
}

.wprte-btn-undo:hover svg,
.wprte-btn-redo:hover svg {
    stroke: #333 !important;
}

/* === Paste button === */
.wprte-btn-paste {
    font-size: 15px !important;
}

/* === Format Painter button === */
.wprte-btn-format-painter {
    font-size: 15px !important;
}

.wprte-btn-format-painter.wprte-format-painter-active {
    background: #ff9800 !important;
    color: #fff !important;
    border-color: #e68a00 !important;
    animation: wprte-fp-pulse 1.5s infinite !important;
}

@keyframes wprte-fp-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(255, 152, 0, 0); }
}

/* Format painter cursor on editor - I-beam like Word */
.wprte-format-painter-cursor {
    cursor: text !important;
}

/* === Alignment buttons (SVG icons - stroke-based) === */
.wprte-btn[data-command="justifyLeft"] svg,
.wprte-btn[data-command="justifyCenter"] svg,
.wprte-btn[data-command="justifyRight"] svg,
.wprte-btn[data-command="justifyFull"] svg {
    width: 16px !important;
    height: 16px !important;
    stroke: #555 !important;
    fill: none !important;
}

.wprte-btn[data-command="justifyLeft"]:hover svg,
.wprte-btn[data-command="justifyCenter"]:hover svg,
.wprte-btn[data-command="justifyRight"]:hover svg,
.wprte-btn[data-command="justifyFull"]:hover svg {
    stroke: #333 !important;
}

.wprte-btn-active[data-command="justifyLeft"] svg,
.wprte-btn-active[data-command="justifyCenter"] svg,
.wprte-btn-active[data-command="justifyRight"] svg,
.wprte-btn-active[data-command="justifyFull"] svg {
    stroke: #fff !important;
}

/* Editor area */
.wprte-editor {
    padding: 10px 14px !important;
    min-height: 120px !important;
    max-height: 500px !important;
    overflow-y: auto !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    color: #333 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    outline: none !important;
    background: #fff !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

.wprte-editor:empty::before {
    content: attr(data-placeholder) !important;
    color: #aaa !important;
    pointer-events: none !important;
}

/* Editor content styles */
.wprte-editor p {
    margin: 0 0 10px 0 !important;
}

.wprte-editor p:last-child {
    margin-bottom: 0 !important;
}

/* Lists inside editor */
.wprte-editor ul,
.wprte-editor ol {
    margin: 0 0 10px 0 !important;
    padding-left: 28px !important;
    list-style-position: inside !important;
}

.wprte-editor ul {
    list-style-type: disc !important;
}

.wprte-editor ol {
    list-style-type: decimal !important;
}

.wprte-editor ul li,
.wprte-editor ol li {
    margin-bottom: 4px !important;
}

.wprte-editor strong,
.wprte-editor b {
    font-weight: 700 !important;
}

.wprte-editor em,
.wprte-editor i {
    font-style: italic !important;
}

.wprte-editor sub {
    vertical-align: sub !important;
    font-size: 0.8em !important;
}

.wprte-editor sup {
    vertical-align: super !important;
    font-size: 0.8em !important;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .wprte-toolbar {
        padding: 4px 6px !important;
        gap: 3px !important;
    }

    .wprte-btn {
        min-width: 28px !important;
        height: 28px !important;
        font-size: 12px !important;
        padding: 2px 5px !important;
    }

    .wprte-editor {
        padding: 8px 12px !important;
        font-size: 16px !important; /* Prevent iOS zoom on focus */
    }
}

/* ============================================
   Profile display page - rich text rendering
   ============================================ */

/* Paragraphs */
.section-content p,
.detail-value-long p,
.profile-about p,
.profile-summary-content p,
.contact-value-multiline p {
    margin: 0 0 10px 0;
}

.section-content p:last-child,
.detail-value-long p:last-child,
.profile-about p:last-child,
.profile-summary-content p:last-child,
.contact-value-multiline p:last-child {
    margin-bottom: 0;
}

/* Bold and Italic */
.section-content strong,
.section-content b,
.detail-value-long strong,
.detail-value-long b,
.profile-about strong,
.profile-about b,
.profile-summary-content strong,
.profile-summary-content b,
.contact-value-multiline strong,
.contact-value-multiline b {
    font-weight: 700;
}

.section-content em,
.section-content i,
.detail-value-long em,
.detail-value-long i,
.profile-about em,
.profile-about i,
.profile-summary-content em,
.profile-summary-content i,
.contact-value-multiline em,
.contact-value-multiline i {
    font-style: italic;
}

/* Lists */
.section-content ul,
.section-content ol,
.detail-value-long ul,
.detail-value-long ol,
.profile-about ul,
.profile-about ol,
.profile-summary-content ul,
.profile-summary-content ol,
.contact-value-multiline ul,
.contact-value-multiline ol {
    margin: 0 0 10px 0;
    padding-left: 24px;
}

.section-content ul {
    list-style-type: disc;
}

.section-content ol {
    list-style-type: decimal;
}

.section-content ul li,
.section-content ol li,
.detail-value-long ul li,
.detail-value-long ol li,
.profile-about ul li,
.profile-about ol li,
.profile-summary-content ul li,
.profile-summary-content ol li,
.contact-value-multiline ul li,
.contact-value-multiline ol li {
    margin-bottom: 4px;
}

/* Subscript and Superscript on display pages */
.section-content sub,
.detail-value-long sub,
.profile-about sub,
.profile-summary-content sub,
.contact-value-multiline sub {
    vertical-align: sub;
    font-size: 0.8em;
}

.section-content sup,
.detail-value-long sup,
.profile-about sup,
.profile-summary-content sup,
.contact-value-multiline sup {
    vertical-align: super;
    font-size: 0.8em;
}

/* Text alignment on display pages */
.section-content [style*="text-align: center"],
.detail-value-long [style*="text-align: center"],
.profile-about [style*="text-align: center"],
.profile-summary-content [style*="text-align: center"],
.contact-value-multiline [style*="text-align: center"] {
    text-align: center !important;
}

.section-content [style*="text-align: right"],
.detail-value-long [style*="text-align: right"],
.profile-about [style*="text-align: right"],
.profile-summary-content [style*="text-align: right"],
.contact-value-multiline [style*="text-align: right"] {
    text-align: right !important;
}

.section-content [style*="text-align: justify"],
.detail-value-long [style*="text-align: justify"],
.profile-about [style*="text-align: justify"],
.profile-summary-content [style*="text-align: justify"],
.contact-value-multiline [style*="text-align: justify"] {
    text-align: justify !important;
}
