/* ========================================
   Advanced Multi-Level Slide Menu Styles
   ======================================== */

/* CSS Variables for easy customization */
:root {
    --ham-menu-font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --ham-menu-font-size: 14px;
    --ham-menu-line-height: 1.5;
    
    /* Colors */
    --ham-menu-bg-color: #ffffff;
    --ham-menu-text-color: #333333;
    --ham-menu-border-color: #eeeeee;
    --ham-menu-overlay-color: rgba(0, 0, 0, 0.5);
    --ham-menu-hover-bg: #f8f9fa;
    --ham-menu-active-color: #3EB184;
    
    /* Dimensions */
    --ham-menu-desktop-width: 100%;
    --ham-menu-mobile-width: 100%;
    --ham-menu-header-height: 60px;
    --ham-menu-item-height: 50px;
    
    /* Animation */
    --ham-menu-animation-duration: 0.3s;
    --ham-menu-animation-easing: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ========================================
   Menu Panel
   ======================================== */

.ham-menu-panel {
    width: var(--ham-menu-desktop-width); 
    
    /* max-height: 80vh; */
    background: var(--ham-menu-bg-color);
    /* box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); */
    /* border-radius: 8px; */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    
    /* iOS fixes */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* ========================================
   Menu Header
   ======================================== */

.ham-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--ham-menu-header-height);
    padding: 0 20px;
    border-bottom: 1px solid var(--ham-menu-border-color);
    background: var(--ham-menu-bg-color);
    flex-shrink: 0;
}

.ham-menu-back {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--ham-menu-text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    min-width: 40px;
    height: 40px;
}

.ham-menu-back:hover {
    background: var(--ham-menu-hover-bg);
}

.ham-menu-back svg {
    width: 20px;
    height: 20px;
}
.ham-menu-back svg path{
    stroke: var(--ham-menu-text-color);
}
.ham-menu-spacer {
    min-width: 40px;
    height: 40px;
}

.ham-menu-title {
    font-family: var(--ham-menu-font-family);
    font-size: 16px;
    font-weight: 600;
    color: var(--ham-menu-text-color);
    flex: 1;
    text-align: center;
    margin: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================
   Menu Content
   ======================================== */

.ham-menu-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 300px; /* Ensure minimum height for menu levels */
}

.ham-menu-level {
    width: 95%;
    overflow-y: auto;
    overflow-x: hidden;
    display: none; /* Hide by default */
    
    /* iOS fixes */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.ham-menu-level.ham-menu-level-active {
    display: block; /* Show active level */
}

.ham-menu-list {
    list-style: none;
    margin: 0 !important;
    padding: 0;
}

.ham-menu-item {
    border-bottom: 1px solid var(--ham-menu-border-color);
}

.ham-menu-item:last-child {
    border-bottom: none;
}

.ham-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: var(--ham-menu-item-height);
    font-family: var(--ham-menu-font-family);
    font-size: var(--ham-menu-font-size);
    color: var(--ham-menu-text-color);
    text-decoration: none;
    transition: background-color 0.2s ease;
    
    /* iOS fixes */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.ham-menu-link.wyrozniona-pozycja{
    color: #fff !important;
    background-color: #3eb184;
}

.ham-menu-link:hover {
    background: var(--ham-menu-hover-bg);
}

.ham-menu-text {
    flex: 1;
    font-weight: 500;
}

.ham-menu-arrow {
    color: #999;
    transition: transform 0.2s ease;
    margin-left: 10px;
}

.ham-menu-arrow svg {
    width: 16px;
    height: 16px;
}

/* Parent link styling */
.ham-menu-parent-link {
    background: var(--ham-menu-hover-bg);
    font-weight: 600;
}
.ham-menu-parent-link span{
    font-family: var(--ham-menu-font-family);
    font-weight: 700;
    font-size: 14px;
    color: var(--ham-menu-text-color);
}

.ham-menu-parent-link .ham-menu-text {
    color: var(--ham-menu-text-color);
}



/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .ham-menu-panel {
        width: var(--ham-menu-mobile-width);
        max-width: 350px;
    }
    
    .ham-menu-header {
        padding: 0 15px;
    }
    
    .ham-menu-link {
        padding: 0 20px;
        height: 48px;
    }
    
    .ham-menu-title {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .ham-menu-panel {
        width: 90vw;
    }
    
    .ham-menu-header {
        height: 55px;
        padding: 0 12px;
    }
    
    .ham-menu-link {
        padding: 0 20px;
        height: 45px;
    }
    
    .ham-menu-title {
        font-size: 14px;
        margin: 0 8px;
    }
}

/* ========================================
   iOS Specific Fixes
   ======================================== */

/* Prevent text selection on iOS */
.ham-menu-header,
.ham-menu-link {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Improve touch targets on iOS */
@media (pointer: coarse) {
    .ham-menu-link {
        min-height: 44px;
    }
    
    .ham-menu-back {
        min-width: 44px;
        min-height: 44px;
    }
}

/* ========================================
   Animation Classes
   ======================================== */

.ham-menu-slide-enter {
    transform: translateX(100%);
}

.ham-menu-slide-enter-active {
    transform: translateX(0);
    transition: transform var(--ham-menu-animation-duration) var(--ham-menu-animation-easing);
}

.ham-menu-slide-exit {
    transform: translateX(0);
}

.ham-menu-slide-exit-active {
    transform: translateX(-100%);
    transition: transform var(--ham-menu-animation-duration) var(--ham-menu-animation-easing);
}

/* ========================================
   Loading & Error States
   ======================================== */

.ham-menu-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    font-family: var(--ham-menu-font-family);
    color: #666;
}

.ham-menu-error {
    padding: 20px;
    font-family: var(--ham-menu-font-family);
    color: #e74c3c;
    text-align: center;
}

/* ========================================
   Accessibility
   ======================================== */

/* Focus states */
.ham-menu-back:focus,
.ham-menu-link:focus {
    outline: 2px solid var(--ham-menu-active-color);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ham-menu-panel,
    .ham-menu-level,
    .ham-menu-link,
    .ham-menu-arrow {
        transition: none !important;
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --ham-menu-border-color: #000000;
        --ham-menu-hover-bg: #f0f0f0;
    }
}
