/* JobPro Activities Enhancer Styles */

/* Enhanced Form Styles */
.jpae-enhanced-form {
    position: relative;
}

.jpae-file-upload-section {
    margin: 20px 0;
}

.jpae-file-upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
    position: relative;
}

.jpae-file-upload-area:hover,
.jpae-file-upload-area.drag-over {
    border-color: #ff6e6e;
    background: #fff0f0;
}

.jpae-file-upload-area input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    cursor: pointer;
}

.jpae-upload-info i {
    font-size: 32px;
    color: #ff6e6e;
    margin-bottom: 10px;
    display: block;
}

.jpae-upload-info p {
    margin: 10px 0 5px;
    font-weight: 500;
    color: #333;
}

.jpae-upload-info small {
    color: #666;
    font-size: 12px;
}

/* File Preview Styles */
.jpae-file-preview {
    margin-top: 15px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.jpae-file-preview:not(:empty) {
    display: block;
}

.jpae-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.jpae-file-item:hover {
    background: #f0f0f0;
}

.jpae-file-item i {
    color: #ff6e6e;
    font-size: 16px;
    min-width: 20px;
}

.jpae-file-item .file-name {
    flex: 1;
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jpae-file-item .file-size {
    color: #666;
    font-size: 12px;
}

.jpae-remove-file {
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.jpae-remove-file:hover {
    background: #cc0000;
}

/* Activity Interactions Styles */
/* Enhanced Activity Interactions - UPDATED DESIGN */
.jpae-activity-interactions {
    margin-top: 15px !important;
    padding: 15px !important;
    background: #f8f9ff !important;
    border: 1px solid #e3e6f0 !important;
    border-radius: 8px !important;
}

/* Remove old stats styling and replace with new centered design */
.jpae-activity-stats {
    display: none !important; /* Hide old stats */
}

.jpae-activity-actions {
    display: none !important; /* Hide old actions */
}

/* New enhanced button styling */
.jpae-activity-like-btn,
.jpae-activity-confirm-btn {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 10px 16px !important;
    border: 2px solid #e0e0e0 !important;
    background: white !important;
    color: #333 !important;
    border-radius: 25px !important;
    cursor: pointer !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    min-height: 36px !important;
}

/* Like button states */
.jpae-activity-like-btn.liked {
    background: #2196F3 !important;
    border-color: #2196F3 !important;
    color: white !important;
}

.jpae-activity-like-btn:hover:not(.liked) {
    border-color: #2196F3 !important;
    color: #2196F3 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
}

.jpae-activity-like-btn.liked:hover {
    background: #1976D2 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
}

/* Confirm button states */
.jpae-activity-confirm-btn.confirmed {
    background: #4CAF50 !important;
    border-color: #4CAF50 !important;
    color: white !important;
    opacity: 0.8 !important;
}

.jpae-activity-confirm-btn:hover:not(.confirmed) {
    border-color: #4CAF50 !important;
    color: #4CAF50 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
}

.jpae-activity-confirm-btn.confirmed:hover {
    background: #4CAF50 !important;
    transform: none !important;
}

/* Button content styling */
.jpae-activity-like-btn span:first-child,
.jpae-activity-confirm-btn span:first-child {
    font-size: 14px !important;
}

.jpae-activity-like-btn span:last-child,
.jpae-activity-confirm-btn span:last-child {
    font-size: 12px !important;
}

/* Processing states */
.jpae-activity-like-btn.processing,
.jpae-activity-confirm-btn.processing {
    opacity: 0.7 !important;
    cursor: not-allowed !important;
    position: relative !important;
}

.jpae-activity-like-btn.processing::after,
.jpae-activity-confirm-btn.processing::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    right: 8px !important;
    width: 12px !important;
    height: 12px !important;
    margin-top: -6px !important;
    border: 2px solid transparent !important;
    border-top: 2px solid currentColor !important;
    border-radius: 50% !important;
    animation: jpae-spin 1s linear infinite !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .jpae-activity-interactions > div:last-child {
        justify-content: center !important;
        flex-wrap: wrap !important;
    }
    
    .jpae-activity-like-btn,
    .jpae-activity-confirm-btn {
        flex: 1 !important;
        justify-content: center !important;
        min-width: 120px !important;
    }
}

/* Activity Attachments Styles */
.jpae-activity-attachments {
    margin-top: 15px !important;
    padding: 15px !important;
    background: #f0f0f0 !important;
    border: 2px solid #ff6e6e !important;
    border-radius: 6px !important;
}

.jpae-activity-attachments h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #333;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.jpae-activity-attachments h4:before {
    content: "📎";
    font-size: 16px;
}

.jpae-attachment-item {
    margin-bottom: 8px !important;
    padding: 10px !important;
    background: white !important;
    border: 1px solid #ff6e6e !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
}

.jpae-attachment-item:last-child {
    margin-bottom: 0 !important;
}

.jpae-attachment-item:hover {
    box-shadow: 0 2px 8px rgba(149, 0, 0, 0.3) !important;
    border-color: #750000 !important;
}

.jpae-attachment-item a {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    text-decoration: none !important;
    color: #ff6e6e !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
}

.jpae-attachment-item a:hover {
    color: #750000 !important;
    text-decoration: none !important;
    transform: translateX(5px);
}

.jpae-attachment-item i {
    font-size: 18px;
    min-width: 24px;
    text-align: center;
}

.jpae-attachment-item small {
    color: #666;
    margin-left: auto;
    font-weight: normal;
}

/* Notification Styles */
.jpae-notification {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 10000;
    padding: 15px 20px;
    border-radius: 6px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
}

.jpae-notification.success {
    background: #46b450;
    color: white;
    border-left: 4px solid #2e7d32;
}

.jpae-notification.error {
    background: #dc3232;
    color: white;
}

/* Enhanced Submit Button */
.jpae-enhanced-submit.processing {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Enhanced Activities Section */
.jpae-enhanced-activities-section {
    position: relative !important;
    z-index: 1000 !important;
    order: -1 !important;
    background: #efefef !important;
    border: 2px solid #950000 !important;
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 6px;
}

.jpae-top-priority {
    border: 3px solid #ff6e6e !important;
    box-shadow: 0 0 0 3px rgba(149, 0, 0, 0.2) !important;
    animation: jpae-pulse-red 2s infinite !important;
}

@keyframes jpae-pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(149, 0, 0, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(149, 0, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(149, 0, 0, 0); }
}

.jpae-enhanced-section-title {
    display: block !important;
    margin-bottom: 15px !important;
    padding-bottom: 5px !important;
    border-bottom: 2px solid #ff6e6e !important;
    color: #222222 !important;
    font-weight: 600 !important;
    font-size: 14px !important;
}

.jpae-enhanced-activity {
    background: white !important;
    border: 2px solid #ff6e6e !important;
    /*box-shadow: 0 3px 6px rgba(149, 0, 0, 0.2) !important;*/
    margin-bottom: 15px !important;
    padding: 15px !important;
    border-radius: 6px !important;
}

.jpae-enhanced-activity:hover {
    box-shadow: 0 4px 8px rgba(149, 0, 0, 0.3) !important;
}

.jpae-enhanced-marker {
    background: #ff6e6e !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 12px !important;
    font-size: 10px !important;
    margin-bottom: 8px !important;
    display: inline-block !important;
    font-weight: bold !important;
}

/* Tooltip styling */
.jpae-tooltip {
    position: absolute;
    background: #333 !important;
    color: white !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: normal !important;
    z-index: 10000 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
    pointer-events: none !important;
    max-width: 300px !important;
    word-wrap: break-word !important;
    white-space: normal !important;
    line-height: 1.4 !important;
}

.jpae-tooltip-trigger {
    cursor: help !important;
    position: relative !important;
    border-bottom: 1px dotted #666 !important;
    transition: all 0.2s ease !important;
}

.jpae-tooltip-trigger:hover {
    border-bottom-color: #ff6e6e !important;
    color: #ff6e6e !important;
}

/* Enhanced download buttons */
.jpae-download-ready a {
    background: #ff6e6e !important;
    color: white !important;
    font-weight: bold !important;
    border: 2px solid #ff6e6e !important;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.3) !important;
}

.jpae-download-ready a:hover {
    background: #750000 !important;
    border-color: #750000 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4) !important;
}

/* Prominent attachments */
.jpae-prominent-attachments {
    background: rgba(248, 249, 250, 0.8) !important;
    border: 2px solid #ff6e6e !important;
    animation: jpae-highlight 3s ease-in-out !important;
}

@keyframes jpae-highlight {
    0%, 100% { background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%); }
    50% { background: linear-gradient(135deg, #fff9db 0%, #ffecb3 100%); }
}

/* File upload area click styling */
.jpae-file-upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
    position: relative;
}

.jpae-file-upload-area:hover,
.jpae-file-upload-area.drag-over {
    border-color: #ff6e6e;
    background: #fff0f0;
}

/* File section in form */
.jpae-file-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* Responsive Design */
@media (max-width: 768px) {
    .jpae-file-upload-area {
        padding: 20px;
    }
    
    .jpae-upload-info i {
        font-size: 24px;
    }
    
    .jpae-activity-actions {
        justify-content: center;
    }
    
    .jpae-activity-like-btn,
    .jpae-activity-confirm-btn {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }
    
    .jpae-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        width: auto;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .jpae-file-upload-area {
        background: #2a2a2a;
        border-color: #555;
    }
    
    .jpae-file-upload-area:hover,
    .jpae-file-upload-area.drag-over {
        background: #333;
        border-color: #ff6e6e;
    }
    
    .jpae-file-item {
        background: #2a2a2a;
        border-color: #555;
        color: #fff;
    }
    
    .jpae-activity-interactions {
        background: #2a2a2a;
        border-color: #555;
    }
    
    .jpae-activity-attachments {
        background: #2a2a2a;
        border-color: #ff6e6e;
        color: #fff;
    }
}

/* Animation Classes */
.jpae-fade-in {
    animation: jpae-fadeIn 0.3s ease-in;
}

.jpae-slide-up {
    animation: jpae-slideUp 0.3s ease-out;
}

@keyframes jpae-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes jpae-slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading States */
.jpae-loading {
    position: relative;
    pointer-events: none;
}

.jpae-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #ff6e6e;
    border-radius: 50%;
    animation: jpae-spin 1s linear infinite;
}

@keyframes jpae-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Debug styles */
.jpae-debug-info {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px;
    border-radius: 4px;
    font-size: 11px;
    z-index: 9999;
    display: none;
}

/* Make sure buttons are visible and clickable */
.jpae-activity-actions button {
    pointer-events: auto;
    z-index: 10;
    position: relative;
}

/* Prevent duplicate buttons */
.jpae-processing {
    opacity: 0.7;
}

.jpae-enhanced .jpae-activity-interactions {
    display: block !important;
}

/* Compact but visible interactions */
.jpae-compact-interactions {
    background: rgba(248, 249, 250, 0.8) !important;
    border-radius: 6px !important;
    margin-top: 8px !important;
    padding: 8px 12px !important;
}

/* Download buttons should be very prominent */
.jpae-download-ready {
    border-left: 4px solid #fd7e14 !important;
}

.jpae-download-ready:hover {
    border-left-color: #e8650e !important;
    background: #fffbf0 !important;
}

/* Make modal more accommodating */
.jobpro-dynm-modal-content,
.jobpro-modal-content {
    max-height: 85vh !important;
    overflow-y: auto !important;
}

.jobpro-dynm-modal-content-scroll {
    max-height: none !important;
}

/* Force visibility in all modal types */
div[class*="modal"] .jpae-enhanced-activities-section,
.jobpro-dynm-modal .jpae-enhanced-activities-section,
.jobpro-modal .jpae-enhanced-activities-section {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    margin-top: 0 !important;
    background: #fff !important;
    border: 2px solid #ff6e6e !important;
}

/* Reply Forms Styles */
.jpae-reply-form,
.jpae-nested-reply-form {
    position: relative !important;
    background: #f0f8f5 !important;
    border: 2px solid #28a745 !important;
    border-radius: 8px !important;
    padding: 20px !important;
    margin-top: 15px !important;
    margin-bottom: 15px !important;
    min-height: 200px !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

.jpae-nested-reply-form {
    background: #f8ffff !important;
    border-color: #17a2b8 !important;
    margin-left: 0 !important;
    padding: 15px !important;
    min-height: 180px !important;
}

.jpae-reply-form h5,
.jpae-nested-reply-form h6 {
    margin: 0 0 15px 0 !important;
    color: #28a745 !important;
    font-size: 16px !important;
    font-weight: bold !important;
}

.jpae-nested-reply-form h6 {
    color: #17a2b8 !important;
    font-size: 14px !important;
}

/* Reply Textarea Styling */
.jpae-reply-text {
    width: 100% !important;
    min-height: 100px !important;
    padding: 12px !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    resize: vertical !important;
    box-sizing: border-box !important;
    font-family: inherit !important;
    line-height: 1.4 !important;
    margin-bottom: 15px !important;
}

.jpae-nested-reply-form .jpae-reply-text {
    min-height: 80px !important;
    font-size: 13px !important;
}

/* Reply File Upload Areas */
.jpae-reply-file-upload {
    margin-bottom: 15px !important;
}

.jpae-reply-file-upload label {
    display: block !important;
    margin-bottom: 8px !important;
    font-weight: bold !important;
    font-size: 14px !important;
    color: #28a745 !important;
}

.jpae-nested-reply-form .jpae-reply-file-upload label {
    color: #17a2b8 !important;
    font-size: 12px !important;
}

.jpae-reply-file-upload-area {
    border: 2px dashed #28a745 !important;
    padding: 20px !important;
    text-align: center !important;
    cursor: pointer !important;
    border-radius: 6px !important;
    background: #f8fff8 !important;
    min-height: 60px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
}

.jpae-nested-reply-form .jpae-reply-file-upload-area {
    border-color: #17a2b8 !important;
    background: #f0ffff !important;
    padding: 15px !important;
    min-height: 50px !important;
}

.jpae-reply-file-upload-area:hover {
    border-color: #1e7e34 !important;
    background: #e8f5e8 !important;
}

.jpae-nested-reply-form .jpae-reply-file-upload-area:hover {
    border-color: #138496 !important;
    background: #e0f7ff !important;
}

.jpae-reply-file-upload-area p {
    margin: 8px 0 !important;
    font-size: 14px !important;
    color: #28a745 !important;
    font-weight: 500 !important;
}

.jpae-nested-reply-form .jpae-reply-file-upload-area p {
    color: #17a2b8 !important;
    font-size: 12px !important;
}

.jpae-reply-file-upload-area small {
    color: #666 !important;
    font-size: 12px !important;
}

.jpae-nested-reply-form .jpae-reply-file-upload-area small {
    font-size: 11px !important;
}

/* Reply File Preview */
.jpae-reply-file-preview {
    margin-top: 10px !important;
    display: none !important;
}

.jpae-reply-file-preview:not(:empty) {
    display: block !important;
}

.jpae-reply-file-item {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px !important;
    background: white !important;
    border-radius: 4px !important;
    margin: 4px 0 !important;
    border: 1px solid #28a745 !important;
    box-sizing: border-box !important;
}

.jpae-nested-reply-form .jpae-reply-file-item {
    border-color: #17a2b8 !important;
}

.jpae-reply-file-item i {
    color: #28a745 !important;
    font-size: 14px !important;
}

.jpae-nested-reply-form .jpae-reply-file-item i {
    color: #17a2b8 !important;
}

.jpae-reply-file-item span {
    flex: 1 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
}

.jpae-remove-reply-file {
    background: #dc3545 !important;
    color: white !important;
    border: none !important;
    padding: 4px 8px !important;
    border-radius: 50% !important;
    font-size: 10px !important;
    cursor: pointer !important;
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.jpae-remove-reply-file:hover {
    background: #c82333 !important;
}

/* Reply Form Buttons */
.jpae-reply-form .jpae-cancel-reply,
.jpae-reply-form .jpae-submit-reply,
.jpae-nested-reply-form .jpae-cancel-reply,
.jpae-nested-reply-form .jpae-submit-reply {
    padding: 10px 20px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    border: 1px solid !important;
    transition: all 0.2s ease !important;
}

.jpae-nested-reply-form .jpae-cancel-reply,
.jpae-nested-reply-form .jpae-submit-reply {
    padding: 8px 16px !important;
    font-size: 12px !important;
}

.jpae-cancel-reply {
    background: white !important;
    border-color: #ddd !important;
    color: #666 !important;
}

.jpae-cancel-reply:hover {
    background: #f8f9fa !important;
    border-color: #adb5bd !important;
}

.jpae-submit-reply {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
}

.jpae-nested-reply-form .jpae-submit-reply {
    background: #17a2b8 !important;
    border-color: #17a2b8 !important;
}

.jpae-submit-reply:hover {
    background: #218838 !important;
    border-color: #1e7e34 !important;
}

.jpae-nested-reply-form .jpae-submit-reply:hover {
    background: #138496 !important;
    border-color: #117a8b !important;
}

/* Reply Form Action Container */
.jpae-reply-form > div:last-child,
.jpae-nested-reply-form > div:last-child {
    display: flex !important;
    gap: 10px !important;
    justify-content: flex-end !important;
    padding-top: 15px !important;
    border-top: 1px solid #ddd !important;
    margin-top: 15px !important;
}

.jpae-nested-reply-form > div:last-child {
    gap: 8px !important;
    padding-top: 10px !important;
    margin-top: 10px !important;
}

/* Reply Button Styles */
.jpae-reply-btn,
.jpae-reply-to-reply-btn {
    padding: 6px 12px !important;
    border: 1px solid #28a745 !important;
    background: white !important;
    color: #28a745 !important;
    border-radius: 15px !important;
    cursor: pointer !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
}

.jpae-reply-to-reply-btn {
    border-color: #17a2b8 !important;
    color: #17a2b8 !important;
}

.jpae-reply-btn:hover,
.jpae-reply-to-reply-btn:hover {
    background: #28a745 !important;
    color: white !important;
}

.jpae-reply-to-reply-btn:hover {
    background: #17a2b8 !important;
}

/* Prevent Nested Shrinking */
.jpae-reply-item {
    width: 100% !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
}

.jpae-thread-level-0 { margin-left: 0px !important; }
.jpae-thread-level-1 { margin-left: 20px !important; }
.jpae-thread-level-2 { margin-left: 40px !important; }
.jpae-thread-level-3 { margin-left: 60px !important; }
.jpae-thread-level-4 { margin-left: 80px !important; }
.jpae-thread-level-5 { margin-left: 100px !important; }

/* Override any shrinking from parent containers */
.jpae-reply-item * {
    min-width: 0 !important;
    word-wrap: break-word !important;
}

/* Ensure forms don't get cut off */
.jpae-replies-section {
    overflow: visible !important;
    width: 100% !important;
}

/* Hidden file inputs */
.jpae-reply-files {
    display: none !important;
}

/* Make sure all reply content is visible */
.jpae-reply-form,
.jpae-nested-reply-form,
.jpae-reply-item {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Debug - temporary borders to see sizing issues */
.jpae-debug .jpae-reply-form {
    border: 3px solid red !important;
}

.jpae-debug .jpae-nested-reply-form {
    border: 3px solid blue !important;
}

.jpae-debug .jpae-reply-item {
    border: 2px solid green !important;
}

/* Prevent duplicate reply rendering */
.jpae-reply-item[data-reply-id] {
    position: relative;
}

.jpae-reply-item[data-reply-id]::before {
    content: attr(data-reply-id);
    position: absolute;
    top: -20px;
    right: 0;
    font-size: 8px;
    color: #999;
    background: rgba(255,255,255,0.8);
    padding: 2px 4px;
    border-radius: 2px;
    display: none; /* Only show in debug mode */
}

.jpae-debug .jpae-reply-item[data-reply-id]::before {
    display: block;
}

/* Ensure proper threading indentation */
.jpae-thread-level-0 { margin-left: 0px !important; max-width: 100%; }
.jpae-thread-level-1 { margin-left: 20px !important; max-width: calc(100% - 20px); }
.jpae-thread-level-2 { margin-left: 40px !important; max-width: calc(100% - 40px); }
.jpae-thread-level-3 { margin-left: 60px !important; max-width: calc(100% - 60px); }
.jpae-thread-level-4 { margin-left: 80px !important; max-width: calc(100% - 80px); }
.jpae-thread-level-5 { margin-left: 100px !important; max-width: calc(100% - 100px); }

/* Enhanced debug visualization for nested replies */
.jpae-debug .jpae-reply-item::after {
    content: "ID: " attr(data-reply-id) " | Parent: " attr(data-parent-reply-id) " | Level: " attr(data-thread-level);
    position: absolute;
    top: -15px;
    right: 5px;
    font-size: 8px;
    color: #999;
    background: rgba(255,255,255,0.9);
    padding: 2px 4px;
    border-radius: 2px;
    border: 1px solid #ddd;
    white-space: nowrap;
    z-index: 1000;
}

/* Visual indicators for different thread levels */
.jpae-thread-level-0 { border-left-color: #28a745 !important; }
.jpae-thread-level-1 { border-left-color: #17a2b8 !important; }
.jpae-thread-level-2 { border-left-color: #ffc107 !important; }
.jpae-thread-level-3 { border-left-color: #fd7e14 !important; }
.jpae-thread-level-4 { border-left-color: #e83e8c !important; }
.jpae-thread-level-5 { border-left-color: #6f42c1 !important; }

/* Ensure proper nesting doesn't cause overflow */
.jpae-replies-section {
    overflow-x: auto;
    padding-right: 10px;
}

/* CRITICAL: Force all reply forms to be hidden by default */
.jpae-reply-form,
.jpae-nested-reply-form {
    display: none !important;
}

/* Only show when explicitly activated */
.jpae-reply-form.jpae-active,
.jpae-nested-reply-form.jpae-active {
    display: block !important;
}

/* Prevent any override attempts */
.jpae-reply-form[style*="block"],
.jpae-nested-reply-form[style*="block"] {
    display: none !important;
}

/* Ensure unique reply items */
.jpae-reply-item[data-reply-id] {
    position: relative;
}

/* Debug mode to see reply IDs */
.jpae-debug .jpae-reply-item[data-reply-id]::before {
    content: "ID: " attr(data-reply-id);
    position: absolute;
    top: -15px;
    right: 5px;
    font-size: 8px;
    color: red;
    background: yellow;
    padding: 2px 4px;
    border-radius: 2px;
    z-index: 1000;
}
