/* ==========================================================================
   AQ Filament Tiptap Editor: Sticky Taskbar & Color Palette Enhancements
   ========================================================================== */

/* 1. Ensure zero clipping on Tiptap containers so dropdowns pop down freely */
.tiptap-wrapper,
.tiptap-editor,
.tiptap-toolbar,
.tiptap-toolbar-left,
.tiptap-toolbar-right {
    overflow: visible !important;
}

/* 2. Fixed/Sticky Toolbar for Desktop & Mobile */
.tiptap-toolbar-wrapper,
.tiptap-wrapper > div:first-child {
    position: sticky !important;
    top: 4rem !important; /* 64px, docked right below Filament's sticky topbar */
    z-index: 30 !important;
    transition: top 0.15s ease, box-shadow 0.15s ease;
}

.tiptap-toolbar {
    background-color: #f8fafc !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.1) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04) !important;
    border-top-left-radius: 0.375rem !important;
    border-top-right-radius: 0.375rem !important;
}

.dark .tiptap-toolbar {
    background-color: #0f172a !important;
    border-bottom-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4) !important;
}

/* 3. Fullscreen Mode Handling (Dock directly to top: 0) */
.tiptap-wrapper.tiptap-fullscreen .tiptap-toolbar-wrapper,
.tiptap-wrapper.tiptap-fullscreen > div:first-child,
.tiptap-wrapper.tiptap-fullscreen .tiptap-toolbar {
    top: 0 !important;
    z-index: 60 !important;
    border-radius: 0 !important;
}

/* 4. Dropdown Popups (Color, Heading, etc.) */
.tiptap-toolbar [x-ref="panel"],
.tiptap-toolbar .tiptap-panel,
.tiptap-toolbar [x-show="open"] {
    z-index: 70 !important;
}

/* 5. Mobile Responsiveness (< 768px) */
@media (max-width: 767px) {
    .tiptap-toolbar-wrapper,
    .tiptap-wrapper > div:first-child {
        top: 4rem !important;
        z-index: 30 !important;
    }

    .tiptap-toolbar {
        padding: 4px !important;
    }

    .tiptap-toolbar-left {
        gap: 3px !important;
    }

    .tiptap-toolbar-right {
        padding: 2px 4px !important;
        border-left: 1px solid rgba(0, 0, 0, 0.08) !important;
        background-color: inherit !important;
    }

    .dark .tiptap-toolbar-right {
        border-left-color: rgba(255, 255, 255, 0.1) !important;
    }
}
