/**
 * HyperMenu - Floating tree navigation styles
 */

/* Hide on mobile */
@media (max-width: 767px) {
    #hypermenu {
        display: none !important;
    }
}

/* Main container */
#hypermenu {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    transition: all 0.3s ease;
}

/* Toggle button */
.hypermenu-toggle {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 12px 12px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 2px 2px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    color: white;
}

.hypermenu-toggle:hover {
    width: 52px;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    box-shadow: 4px 4px 20px rgba(102, 126, 234, 0.6);
}

.hypermenu-toggle svg {
    width: 22px;
    height: 22px;
}

/* Panel */
.hypermenu-panel {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 320px;
    max-height: 70vh;
    background: #1a1a2e;
    border-radius: 0 16px 16px 0;
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#hypermenu.open .hypermenu-toggle {
    opacity: 0;
    visibility: hidden;
}

#hypermenu.open .hypermenu-panel {
    opacity: 1;
    visibility: visible;
}

/* Header */
.hypermenu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 16px 0 0;
}

.hypermenu-title {
    font-weight: 600;
    font-size: 15px;
    color: white;
    letter-spacing: 0.5px;
}

.hypermenu-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.hypermenu-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Search */
.hypermenu-search {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hypermenu-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}

.hypermenu-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.hypermenu-search-input:focus {
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.1);
}

/* Tree container */
.hypermenu-tree {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* Custom scrollbar */
.hypermenu-tree::-webkit-scrollbar {
    width: 6px;
}

.hypermenu-tree::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.hypermenu-tree::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.hypermenu-tree::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Tree list */
.hypermenu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hypermenu-children {
    list-style: none;
    margin: 0;
    padding-left: 20px;
}

/* Tree item */
.hypermenu-item {
    margin: 0;
}

.hypermenu-node {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.hypermenu-node:hover {
    background: rgba(255, 255, 255, 0.08);
}

.hypermenu-item.business > .hypermenu-node {
    border-left-color: #667eea;
}

.hypermenu-item.project > .hypermenu-node {
    border-left-color: #48bb78;
}

.hypermenu-item.order > .hypermenu-node {
    border-left-color: #ed8936;
}

.hypermenu-item.item > .hypermenu-node {
    border-left-color: #e53e3e;
}

/* Arrow */
.hypermenu-arrow {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.hypermenu-arrow.expanded {
    transform: rotate(90deg);
}

/* Icon */
.hypermenu-icon {
    margin: 0 8px;
    font-size: 14px;
    flex-shrink: 0;
}

/* Link */
.hypermenu-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    transition: color 0.2s;
}

.hypermenu-link:hover {
    color: #667eea;
}

.hypermenu-link.clickable {
    cursor: pointer;
}

/* Loading/Empty/Error states */
.hypermenu-loading,
.hypermenu-empty,
.hypermenu-error {
    padding: 8px 16px 8px 52px;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
    font-size: 12px;
}

.hypermenu-error {
    color: #e53e3e;
}

/* Animation for expanding */
.hypermenu-children {
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Flat search results — rendered when the search box has ≥2 chars.
   Each row is a typed entry (business / project / order / item) with
   a breadcrumb showing the parent chain so reps can tell two
   identically-named orders apart at a glance. */
.hypermenu-search-results {
    display: flex;
    flex-direction: column;
    padding: 4px 0;
}
.hypermenu-search-result {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 14px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.hypermenu-search-result:hover {
    background: rgba(102, 126, 234, 0.12);
}
.hypermenu-search-line {
    display: flex;
    align-items: center;
    gap: 8px;
}
.hypermenu-search-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}
.hypermenu-search-crumbs {
    margin-left: 28px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    align-items: center;
}
.hypermenu-crumb {
    white-space: nowrap;
}
.hypermenu-crumb-sep {
    opacity: 0.5;
}
