/* CSS Custom Properties for Admin Bar Height Detection */
:root {
    --admin-bar-height: 0px;
}

.admin-bar {
    --admin-bar-height: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar {
        --admin-bar-height: 46px;
    }
}

/* Overlay container */
#feedback-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    overflow: visible; /* Allow comments to be positioned anywhere on the page */
}

/* Fixed instructions banner */
#feedback-instructions {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #0073aa;
    color: white;
    padding: 12px 20px;
    text-align: center;
    z-index: 99990;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Push body content down - only when feedback mode is active */
body.feedback-mode {
    padding-top: 48px !important;
    overflow-x: hidden; /* Prevent horizontal scroll */
    max-width: 100vw; /* Ensure body doesn't exceed viewport width */
}
/* Place banner below the WordPress admin bar if present */
body.admin-bar #feedback-instructions {
    top: 32px;
}
@media (max-width: 782px) {
    body.admin-bar #feedback-instructions {
        top: 46px;
    }
}
/* Increase body offset when admin bar is present so content is not overlapped */
body.feedback-mode.admin-bar {
    padding-top: 80px !important; /* 48 banner + 32 admin bar */
}
@media (max-width: 782px) {
    body.feedback-mode.admin-bar {
        padding-top: 94px !important; /* 48 banner + 46 admin bar */
    }
}

/* Selection box while dragging */
.feedback-selection-box {
    position: absolute;
    pointer-events: none;
    z-index: 9999;
    /* Border, background, and shadow set dynamically via JS */
}

/* Permanent feedback comment boxes */
/* CSS ISOLATION - Reset children only, preserve container positioning */
.feedback-comment * {
    all: initial !important;
    box-sizing: border-box !important;
}

.feedback-comment {
    /* Positioning - DO NOT override top/left/width/height - set by JavaScript */
    position: absolute !important;
    /* DO NOT set top/left/width/height here - JavaScript controls them */
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    
    /* Display and layout */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    float: none !important;
    clear: none !important;
    
    /* Box model */
    box-sizing: border-box !important;
    padding: 8px !important;
    margin: 0 !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    overflow: visible !important; /* Allow content to overflow the selection box */
    
    /* Layering */
    z-index: 9999 !important;
    pointer-events: auto !important;
    
    /* Interaction */
    cursor: pointer !important;
    
    /* Visual effects */
    transition: all 0.2s ease !important;
    opacity: 1 !important;
    visibility: visible !important;
    
    /* Typography */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    color: #333 !important;
    
    /* Border and background set dynamically via JS - don't override */
}

.feedback-comment:hover {
    filter: brightness(1.1) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
}

/* Active state when clicked */
.feedback-comment.active {
    filter: brightness(1.2) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
}

/* Comment content inside the box - hidden by default */
.feedback-comment .feedback-comment-content {
    display: block !important;
    position: absolute !important; /* Changed from relative to absolute so it can overflow */
    background: white !important;
    background-color: white !important;
    border-radius: 4px !important;
    padding: 8px 10px !important;
    margin: 0 !important;
    max-width: none !important; /* Allow it to expand beyond parent */
    width: auto !important; /* Auto width based on content */
    min-width: 280px !important; /* Ensure enough width for buttons */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    box-sizing: border-box !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.2s ease !important;
    overflow: visible !important;
    z-index: 10000 !important; /* Ensure it appears above the selection box */
    top: 0 !important;
    left: 0 !important;
}

/* Show content on hover or when active */
.feedback-comment:hover .feedback-comment-content,
.feedback-comment.active .feedback-comment-content {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Allow content to expand beyond box if needed - but don't expand the selection box itself */
.feedback-comment:hover .feedback-comment-content,
.feedback-comment.active .feedback-comment-content {
    width: max-content !important; /* Expand to fit content */
    min-width: 280px !important;
}

.feedback-comment .feedback-comment-content p {
    display: block !important;
    margin: 0 0 8px 0 !important;
    padding: 0 !important;
    font-size: 13px !important;
    font-weight: normal !important;
    color: #333 !important;
    line-height: 1.4 !important;
    word-wrap: break-word !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    text-align: left !important;
}

.feedback-comment .feedback-comment-content p strong {
    display: inline !important;
    font-weight: 600 !important;
    color: #333 !important;
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
}

.feedback-comment .feedback-comment-content .feedback-comment-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important; /* Allow buttons to wrap if needed */
    gap: 4px !important;
    justify-content: flex-start !important;
    align-items: center !important;
    margin: 8px 0 0 0 !important;
    padding: 8px 0 0 0 !important;
    border-top: 1px solid #eee !important;
    width: 100% !important;
    box-sizing: border-box !important;
    position: relative !important;
}

.feedback-comment-content .feedback-delete,
.feedback-comment-content .feedback-resolve {
    padding: 2px 6px !important;
    border: none !important;
    border-radius: 2px !important;
    font-size: 9px !important;
    cursor: pointer !important;
    transition: background 0.2s ease !important;
    font-family: inherit !important;
}

.feedback-comment-content .feedback-delete {
    background: #E74C3C !important;
    color: white !important;
}

.feedback-comment-content .feedback-delete:hover {
    background: #C0392B !important;
}

.feedback-comment-content .feedback-resolve {
    background: #27AE60 !important;
    color: white !important;
}

.feedback-comment-content .feedback-resolve:hover {
    background: #229954 !important;
}

/* Individual classes for annotation buttons - FULL ISOLATION */
.feedback-comment .mmm-annotation-delete,
.feedback-comment .mmm-annotation-resolve,
.feedback-comment .mmm-annotation-reopen,
.feedback-comment .mmm-annotation-close,
.feedback-comment .mmm-annotation-move-todo {
    /* Display and positioning */
    display: inline-block !important;
    position: relative !important;
    float: none !important;
    clear: none !important;
    
    /* Box model */
    box-sizing: border-box !important;
    padding: 6px 12px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 4px !important;
    
    /* Dimensions */
    width: auto !important;
    height: auto !important;
    min-width: 60px !important;
    max-width: none !important;
    min-height: 28px !important;
    max-height: none !important;
    
    /* Typography */
    font-size: 12px !important;
    font-weight: 500 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    line-height: 1.2 !important;
    text-align: center !important;
    white-space: nowrap !important;
    text-decoration: none !important;
    text-transform: none !important;
    vertical-align: middle !important;
    
    /* Flexbox child */
    flex: 0 0 auto !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    align-self: center !important;
    
    /* Interaction */
    cursor: pointer !important;
    pointer-events: auto !important;
    user-select: none !important;
    
    /* Visual */
    transition: background 0.2s ease !important;
    opacity: 1 !important;
    
    /* Reset positioning */
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    
    /* Layout */
    overflow: visible !important;
}

.feedback-comment .mmm-annotation-delete {
    background: #E74C3C !important;
    background-color: #E74C3C !important;
    color: white !important;
}

.feedback-comment .mmm-annotation-delete:hover {
    background: #C0392B !important;
    background-color: #C0392B !important;
    color: white !important;
}

.feedback-comment .mmm-annotation-resolve {
    background: #27AE60 !important;
    background-color: #27AE60 !important;
    color: white !important;
}

.feedback-comment .mmm-annotation-resolve:hover {
    background: #229954 !important;
    background-color: #229954 !important;
    color: white !important;
}

.feedback-comment .mmm-annotation-reopen {
    background: #f39c12 !important;
    background-color: #f39c12 !important;
    color: white !important;
}

.feedback-comment .mmm-annotation-reopen:hover {
    background: #e67e22 !important;
    background-color: #e67e22 !important;
    color: white !important;
}

.feedback-comment .mmm-annotation-close {
    background: #7f8c8d !important;
    background-color: #7f8c8d !important;
    color: white !important;
}

.feedback-comment .mmm-annotation-close:hover {
    background: #5d6d6e !important;
    background-color: #5d6d6e !important;
    color: white !important;
}

.feedback-comment .mmm-annotation-move-todo {
    background: #3498db !important;
    background-color: #3498db !important;
    color: white !important;
}

.feedback-comment .mmm-annotation-move-todo:hover {
    background: #2980b9 !important;
    background-color: #2980b9 !important;
    color: white !important;
}

/* Links inside feedback comments (like screenshot links) */
.feedback-comment .feedback-comment-content a {
    display: block !important;
    margin: 6px 0 0 0 !important;
    padding: 0 !important;
    font-size: 12px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    color: #4A90E2 !important;
    text-decoration: underline !important;
    cursor: pointer !important;
    line-height: 1.4 !important;
    background: none !important;
    border: none !important;
    position: relative !important;
    width: auto !important;
    height: auto !important;
}

.feedback-comment .feedback-comment-content a:hover {
    color: #357ABD !important;
    text-decoration: underline !important;
}

/* Remove old bubble styles - not needed anymore */
.feedback-bubble {
    display: none;
}

/* Simple popup modal for entering feedback - positioned next to selection */
/* COMPLETE CSS ISOLATION - Reset all properties except positioning */
.feedback-modal * {
    /* Reset all child elements */
    all: initial !important;
    box-sizing: border-box !important;
}

.feedback-modal {
    /* Critical: Do NOT use 'all: initial' on modal itself - it breaks positioning */
    /* Manual reset of key properties to ensure isolation */
    
    /* Positioning - CRITICAL! */
    position: absolute !important;
    /* DO NOT set top/left - JavaScript sets them via inline styles */
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    
    /* Display */
    display: block !important;
    float: none !important;
    clear: none !important;
    
    /* Box model */
    box-sizing: border-box !important;
    
    /* Dimensions - auto-size based on content */
    width: fit-content !important;
    min-width: 360px !important;
    max-width: 90vw !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    
    /* Spacing */
    padding: 0 !important;
    margin: 0 !important;
    
    /* Visual styling */
    background: white !important;
    background-color: white !important;
    border: 2px solid #4A90E2 !important;
    border-style: solid !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
    outline: none !important;
    
    /* Layering */
    z-index: 99999 !important;
    pointer-events: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    
    /* Typography */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 14px !important;
    font-weight: normal !important;
    line-height: 1.4 !important;
    color: #333 !important;
    text-align: left !important;
    text-decoration: none !important;
    text-transform: none !important;
    
    /* Layout */
    overflow: visible !important;
    vertical-align: baseline !important;
}

.feedback-modal .feedback-modal-content {
    display: block !important;
    position: relative !important;
    padding: 20px !important;
    margin: 0 !important;
    width: 100% !important;
    overflow: visible !important;
    background: transparent !important;
}

.feedback-modal .feedback-modal-content h3 {
    display: block !important;
    margin: 0 0 16px 0 !important;
    padding: 0 !important;
    color: #333 !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    line-height: 1.3 !important;
    text-align: left !important;
}

.feedback-modal .feedback-modal-content textarea {
    display: block !important;
    width: 100% !important;
    padding: 12px !important;
    margin: 0 0 16px 0 !important;
    border: 2px solid #E0E0E0 !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    box-sizing: border-box !important;
    min-height: 100px !important;
    max-height: 300px !important;
    resize: vertical !important;
    transition: border-color 0.2s ease !important;
    background: white !important;
    background-color: white !important;
    color: #333 !important;
    line-height: 1.5 !important;
    overflow: auto !important;
}

.feedback-modal .feedback-modal-content textarea:focus {
    outline: none !important;
    border-color: #4A90E2 !important;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1) !important;
}

.feedback-modal .feedback-modal-content .feedback-modal-buttons {
    /* Flex container */
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    justify-content: flex-end !important;
    align-items: center !important;
    align-content: center !important;
    
    /* Spacing */
    margin: 0 !important;
    padding: 0 !important;
    
    /* Dimensions */
    width: 100% !important;
    height: auto !important;
    
    /* Positioning */
    position: relative !important;
    
    /* Layout */
    overflow: visible !important;
    background: transparent !important;
}

.feedback-modal .feedback-modal-content .feedback-modal-buttons button,
.feedback-modal .feedback-modal-content .feedback-modal-buttons .feedback-cancel,
.feedback-modal .feedback-modal-content .feedback-modal-buttons .feedback-after-release,
.feedback-modal .feedback-modal-content .feedback-modal-buttons .feedback-submit {
    /* Display and positioning - CRITICAL */
    display: inline-block !important;
    position: relative !important;
    float: none !important;
    clear: none !important;
    
    /* Box model */
    box-sizing: border-box !important;
    padding: 10px 20px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 8px !important;
    
    /* Dimensions - let content size the button */
    width: auto !important;
    height: auto !important;
    min-width: 80px !important;
    max-width: none !important;
    min-height: 40px !important;
    max-height: none !important;
    
    /* Typography */
    font-size: 14px !important;
    font-weight: 500 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    line-height: 1.4 !important;
    white-space: nowrap !important;
    text-align: center !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    vertical-align: middle !important;
    
    /* Flexbox child behavior - prevent growing/shrinking */
    flex: 0 0 auto !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    flex-basis: auto !important;
    align-self: center !important;
    
    /* Interaction */
    cursor: pointer !important;
    pointer-events: auto !important;
    user-select: none !important;
    
    /* Visual effects */
    transition: all 0.2s ease !important;
    opacity: 1 !important;
    
    /* Reset positioning - CRITICAL! */
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    
    /* Layout */
    overflow: visible !important;
    z-index: auto !important;
}

.feedback-modal .feedback-submit {
    background: #4A90E2 !important;
    color: white !important;
}

.feedback-modal .feedback-submit:hover {
    background: #357ABD !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3) !important;
}

.feedback-modal .feedback-cancel {
    background: #F5F5F5 !important;
    color: #666 !important;
    border: 1px solid #E0E0E0 !important;
}

.feedback-modal .feedback-cancel:hover {
    background: #E8E8E8 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

/* Prevent text selection and image dragging while selecting */
body.feedback-selecting {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

body.feedback-selecting * {
    pointer-events: none !important;
}

body.feedback-selecting #feedback-overlay {
    pointer-events: auto !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .feedback-bubble {
        width: 250px;
    }
    
    .feedback-modal {
        min-width: 300px;
        max-width: 90vw;
    }
    
    .feedback-modal-content {
        padding: 16px 12px;
    }
    
    .feedback-modal-buttons {
        gap: 4px;
        justify-content: center;
    }
    
    .feedback-modal-buttons button {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 55px;
    }
}

/* Ensure Settings button text stays red in all states */
#feedback-settings-btn {
	color: #e60023 !important;
}

#feedback-settings-btn:hover,
#feedback-settings-btn:focus,
#feedback-settings-btn:active {
	color: #e60023 !important;
}

/* Prevent document from having excessive height */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Ensure feedback mode doesn't cause layout issues */
body.feedback-mode {
    position: relative;
    min-height: 100vh;
}

/* After Release button styling */
.mmm-ds-pa-btn-warning {
    background-color: #f39c12 !important;
    border-color: #e67e22 !important;
    color: white !important;
}

.mmm-ds-pa-btn-warning:hover {
    background-color: #e67e22 !important;
    border-color: #d35400 !important;
    color: white !important;
}

/* After Release button styling for feedback.js modal */
.feedback-modal .feedback-after-release {
    background-color: #f39c12 !important;
    border: 1px solid #e67e22 !important;
    color: white !important;
    padding: 10px 16px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    margin: 0 !important;
}

.feedback-modal .feedback-after-release:hover {
    background-color: #e67e22 !important;
    border-color: #d35400 !important;
    color: white !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3) !important;
}