/* ============================================================================
   LIQUID GLASS CONTEXT MENU
   Apple-inspired glassmorphism effect for dmc.Menu dropdown

   NOTE: this file loads on every docs page (root assets/ is served globally).
   All rules below are scoped under specific classes (no bare element or
   universal selectors), so it is safe to load site-wide alongside the
   "Context Menu" interactions example.
   ============================================================================ */

/* Glass morphism menu dropdown styling */
.glass-morphism-menu {
    /* Advanced blur and saturation for liquid glass effect */
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;

    /* Translucent gradient background - MORE TRANSPARENT for better glass effect */
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.65) 0%,
        rgba(255, 255, 255, 0.55) 100%
    ) !important;

    /* Subtle border with slight transparency */
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    border-radius: 12px !important;

    /* Layered shadow system for depth */
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.9),
        inset 0 -1px 0 0 rgba(255, 255, 255, 0.5) !important;

    /* Smooth transitions */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;

    /* Overflow handling */
    overflow: hidden !important;
}

/* Dark mode liquid glass menu */
[data-mantine-color-scheme="dark"] .glass-morphism-menu {
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;

    /* MORE TRANSPARENT dark background for better glass effect */
    background: linear-gradient(
        135deg,
        rgba(30, 37, 51, 0.75) 0%,
        rgba(20, 25, 34, 0.65) 100%
    ) !important;

    border: 1px solid rgba(255, 255, 255, 0.15) !important;

    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 0 rgba(255, 255, 255, 0.05) !important;
}

/* Animated liquid gradient border effect */
.glass-morphism-menu::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(
        45deg,
        rgba(79, 195, 247, 0.3),
        rgba(156, 39, 176, 0.3),
        rgba(255, 193, 7, 0.3),
        rgba(33, 150, 243, 0.3)
    );
    background-size: 400% 400%;
    border-radius: 12px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: liquidGradient 8s ease infinite;
}

@keyframes liquidGradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Show gradient border on hover */
.glass-morphism-menu:hover::before {
    opacity: 0.5;
}

/* Menu item hover effects with glass morphism - enhanced transparency */
.glass-morphism-menu .mantine-Menu-item:hover {
    background: rgba(79, 195, 247, 0.2) !important;
    backdrop-filter: blur(10px) !important;
    transition: all 0.2s ease !important;
}

[data-mantine-color-scheme="dark"] .glass-morphism-menu .mantine-Menu-item:hover {
    background: rgba(79, 195, 247, 0.25) !important;
}

/* Menu labels styling */
.glass-morphism-menu .mantine-Menu-label {
    color: rgba(0, 0, 0, 0.6) !important;
    font-weight: 600 !important;
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 8px 12px 4px !important;
}

[data-mantine-color-scheme="dark"] .glass-morphism-menu .mantine-Menu-label {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* Menu divider with glass effect */
.glass-morphism-menu .mantine-Menu-divider {
    border-color: rgba(0, 0, 0, 0.08) !important;
    margin: 4px 0 !important;
}

[data-mantine-color-scheme="dark"] .glass-morphism-menu .mantine-Menu-divider {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Submenu dropdown also gets glass effect with enhanced transparency */
.glass-morphism-menu .mantine-SubMenu-dropdown {
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;

    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.65) 0%,
        rgba(255, 255, 255, 0.55) 100%
    ) !important;

    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    border-radius: 12px !important;

    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.9),
        inset 0 -1px 0 0 rgba(255, 255, 255, 0.5) !important;
}

[data-mantine-color-scheme="dark"] .glass-morphism-menu .mantine-SubMenu-dropdown {
    background: linear-gradient(
        135deg,
        rgba(30, 37, 51, 0.75) 0%,
        rgba(20, 25, 34, 0.65) 100%
    ) !important;

    border: 1px solid rgba(255, 255, 255, 0.15) !important;

    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 0 rgba(255, 255, 255, 0.05) !important;
}

/* Menu items styling */
.glass-morphism-menu .mantine-Menu-item {
    border-radius: 8px !important;
    margin: 2px 4px !important;
    transition: all 0.2s ease !important;
}

/* Keyboard shortcut styling */
.glass-morphism-menu .mantine-Menu-item .mantine-Text-root {
    opacity: 0.6 !important;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace !important;
    font-size: 0.75rem !important;
}

/* Red (danger) menu item special styling */
.glass-morphism-menu .mantine-Menu-item[data-menu-item][data-color="red"] {
    color: var(--mantine-color-red-6) !important;
}

.glass-morphism-menu .mantine-Menu-item[data-menu-item][data-color="red"]:hover {
    background: rgba(239, 68, 68, 0.15) !important;
}

[data-mantine-color-scheme="dark"] .glass-morphism-menu .mantine-Menu-item[data-menu-item][data-color="red"]:hover {
    background: rgba(239, 68, 68, 0.25) !important;
}

/* Performance optimizations */
.glass-morphism-menu {
    will-change: transform, opacity;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .glass-morphism-menu,
    .glass-morphism-menu::before {
        animation: none !important;
        transition: none !important;
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .glass-morphism-menu {
        backdrop-filter: blur(15px) saturate(160%) !important;
        -webkit-backdrop-filter: blur(15px) saturate(160%) !important;
    }
}

/* Focus states for accessibility */
.glass-morphism-menu .mantine-Menu-item:focus-visible {
    outline: 2px solid var(--mantine-color-blue-6) !important;
    outline-offset: 2px !important;
}

/* Icon styling within menu items */
.glass-morphism-menu .mantine-Menu-item svg {
    transition: transform 0.2s ease !important;
}

.glass-morphism-menu .mantine-Menu-item:hover svg {
    transform: scale(1.1) !important;
}

/* Smooth appear animation */
@keyframes menuAppear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.glass-morphism-menu {
    animation: menuAppear 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Enhanced text readability on glass background */
.glass-morphism-menu .mantine-Menu-item {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

[data-mantine-color-scheme="dark"] .glass-morphism-menu .mantine-Menu-item {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

/* ============================================================================
   CONTEXT MENU POSITIONING
   ============================================================================ */

/* Context menu container for absolute positioning */
.context-menu-container {
    position: fixed;
    z-index: 9999;
    pointer-events: auto;
}

/* Hide menu target (invisible trigger) */
.context-menu-trigger {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* ============================================================================
   COLOR SCHEME INDICATORS
   ============================================================================ */

/* Color swatch for color scheme menu items */
.color-scheme-swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

[data-mantine-color-scheme="dark"] .color-scheme-swatch {
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Specific color swatches */
.swatch-default {
    background: linear-gradient(135deg, #22c55e 50%, #a855f7 50%);
}

.swatch-ocean {
    background: linear-gradient(135deg, #06b6d4 50%, #3b82f6 50%);
}

.swatch-forest {
    background: linear-gradient(135deg, #10b981 50%, #14b8a6 50%);
}

.swatch-sunset {
    background: linear-gradient(135deg, #f59e0b 50%, #f97316 50%);
}

.swatch-midnight {
    background: linear-gradient(135deg, #8b5cf6 50%, #6366f1 50%);
}

.swatch-rose {
    background: linear-gradient(135deg, #ec4899 50%, #f43f5e 50%);
}

/* ============================================================================
   THEME PRESET INDICATORS
   ============================================================================ */

.preset-indicator {
    width: 20px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

[data-mantine-color-scheme="dark"] .preset-indicator {
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.preset-glass {
    background: linear-gradient(135deg, rgba(255,255,255,0.8), rgba(255,255,255,0.4));
    backdrop-filter: blur(4px);
}

.preset-solid {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.preset-minimal {
    background: transparent;
    border-style: dashed;
}

[data-mantine-color-scheme="dark"] .preset-glass {
    background: linear-gradient(135deg, rgba(50,50,60,0.8), rgba(30,30,40,0.4));
}

[data-mantine-color-scheme="dark"] .preset-solid {
    background: #2d3748;
}

/* ============================================================================
   NODE TYPE INDICATORS
   ============================================================================ */

.node-type-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

.node-input-icon {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

.node-process-icon {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.node-output-icon {
    background: linear-gradient(135deg, #a855f7, #9333ea);
    color: white;
}

.node-resizable-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

/* ============================================================================
   EDGE TYPE INDICATORS
   ============================================================================ */

.edge-type-preview {
    width: 24px;
    height: 12px;
    position: relative;
}

.edge-type-preview::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: currentColor;
    transform: translateY(-50%);
}

.edge-bezier::before {
    border-radius: 50%;
    height: 8px;
    top: 2px;
    transform: none;
    background: transparent;
    border: 2px solid currentColor;
    border-top: none;
    border-left: none;
}

.edge-straight::before {
    /* default straight line */
}

.edge-step::before {
    height: 8px;
    background: transparent;
    border: 2px solid currentColor;
    border-top: none;
    border-radius: 0;
}

.edge-smoothstep::before {
    height: 8px;
    background: transparent;
    border: 2px solid currentColor;
    border-top: none;
    border-radius: 4px;
}

/* ============================================================================
   ACTIVE/SELECTED STATES
   ============================================================================ */

.glass-morphism-menu .mantine-Menu-item[data-active="true"] {
    background: rgba(59, 130, 246, 0.15) !important;
}

.glass-morphism-menu .mantine-Menu-item[data-active="true"]::after {
    content: '✓';
    position: absolute;
    right: 12px;
    font-size: 12px;
    color: var(--mantine-color-blue-6);
}

[data-mantine-color-scheme="dark"] .glass-morphism-menu .mantine-Menu-item[data-active="true"] {
    background: rgba(59, 130, 246, 0.25) !important;
}

/* ============================================================================
   STATUS BAR STYLING
   ============================================================================ */

.status-bar {
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.7) 0%,
        rgba(255, 255, 255, 0.5) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

[data-mantine-color-scheme="dark"] .status-bar {
    background: linear-gradient(
        135deg,
        rgba(30, 37, 51, 0.8) 0%,
        rgba(20, 25, 34, 0.7) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ============================================================================
   END LIQUID GLASS CONTEXT MENU
   ============================================================================ */
