:root {
    --tab-glass-bg: rgba(255, 255, 255, 0.15);
    --tab-glass-border: rgba(255, 255, 255, 0.4);
    --tab-glass-shadow: rgba(0, 0, 0, 0.1);
    --tab-glass-highlight: rgba(255, 255, 255, 0.8);
    --tab-glass-caustic: rgba(255, 255, 255, 0.4);
    --tab-reflection-start: rgba(255, 255, 255, 0.6);
    --tab-reflection-end: rgba(255, 255, 255, 0.0);
    --tab-glare-color: rgba(255, 255, 255, 0.5);
    
    --tab-pill-bg: rgba(255, 255, 255, 0.7);
    --tab-pill-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05), inset 0 1px 1px rgba(255, 255, 255, 0.8);
    --tab-icon-color: rgba(0, 0, 0, 0.5);
    --tab-icon-active: rgba(0, 0, 0, 0.95);
    --tab-divider: rgba(0, 0, 0, 0.15);
}

body.dark-theme {
    --tab-glass-bg: rgba(30, 30, 35, 0.45);
    --tab-glass-border: rgba(255, 255, 255, 0.15);
    --tab-glass-shadow: rgba(0, 0, 0, 0.8);
    --tab-glass-highlight: rgba(255, 255, 255, 0.25);
    --tab-glass-caustic: rgba(255, 255, 255, 0.05);
    --tab-reflection-start: rgba(255, 255, 255, 0.15);
    --tab-reflection-end: rgba(255, 255, 255, 0.0);
    --tab-glare-color: rgba(255, 255, 255, 0.15);
    
    --tab-pill-bg: rgba(255, 215, 0, 0.25);
    --tab-pill-shadow: 0 4px 12px rgba(255, 215, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 215, 0, 0.15);
    --tab-icon-color: rgba(255, 255, 255, 0.5);
    --tab-icon-active: #ffd700;
    --tab-divider: rgba(255, 255, 255, 0.15);
}

.tab-bar-apple {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9998;
    
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 99px;
    
    background: var(--tab-glass-bg);
    backdrop-filter: blur(50px) saturate(200%);
    -webkit-backdrop-filter: blur(50px) saturate(200%);
    
    box-shadow:
        0 40px 80px -20px var(--tab-glass-shadow),
        0 10px 30px -10px var(--tab-glass-shadow),
        inset 0 2px 3px -1px var(--tab-glass-highlight),
        inset 0 -2px 4px -1px var(--tab-glass-caustic),
        inset 0 0 0 1px var(--tab-glass-border);
    
    transition: all 0.5s ease, opacity 0.4s ease, transform 0.4s ease;
    min-width: 200px;
    max-width: 400px;
    width: auto;
    visibility: visible !important;
    opacity: 1 !important;
}

.tab-bar-apple.hide {
    opacity: 0 !important;
    transform: translateX(-50%) translateY(30px) !important;
    pointer-events: none !important;
}

.tab-bar-apple::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    right: 1px;
    height: 46%;
    border-radius: 99px 99px 24px 24px / 99px 99px 12px 12px;
    background: linear-gradient(180deg, var(--tab-reflection-start) 0%, var(--tab-reflection-end) 100%);
    pointer-events: none;
    z-index: 6;
    transition: background 0.5s ease;
}

.tab-glare-container {
    position: absolute;
    inset: 0;
    border-radius: 99px;
    overflow: hidden;
    pointer-events: none;
    z-index: 5;
}

.tab-glare {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: radial-gradient(circle 90px at var(--x, 50%) var(--y, 50%), var(--tab-glare-color) 0%, transparent 100%);
    mix-blend-mode: overlay;
}

.tab-bar-apple:hover .tab-glare {
    opacity: 1;
}

.tab-items-apple {
    position: relative;
    display: flex;
    gap: 4px;
    z-index: 3;
    align-items: center;
}

.tab-pill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--tab-pill-bg);
    border-radius: 99px;
    box-shadow: var(--tab-pill-shadow);
    transition: transform 0.5s cubic-bezier(0.34, 1.2, 0.64, 1),
                width 0.5s cubic-bezier(0.34, 1.2, 0.64, 1),
                background 0.5s ease,
                box-shadow 0.5s ease;
    z-index: 1;
    pointer-events: none;
}

.tab-item-apple {
    position: relative;
    background: transparent;
    border: none;
    padding: 0 20px;
    height: 44px;
    border-radius: 99px;
    font-family: 'Estedad', 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--tab-icon-color);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.3s ease;
    outline: none;
    z-index: 2;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    white-space: nowrap;
}

.tab-item-apple .btn-content {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    transition: transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

.tab-item-apple:active .btn-content {
    transform: scale(0.92);
}

.tab-item-apple.active {
    color: var(--tab-icon-active);
}

.tab-divider {
    width: 1px;
    height: 24px;
    background: var(--tab-divider);
    margin: 0 4px;
    z-index: 3;
    transition: background 0.5s ease;
    flex-shrink: 0;
}

.tab-item-apple .tab-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.tab-item-apple .tab-label {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.theme-btn-apple {
    position: relative;
    background: transparent;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: var(--tab-icon-color);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    z-index: 3;
    outline: none;
    margin-left: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    flex-shrink: 0;
}

.theme-btn-apple:hover,
.theme-btn-apple:active {
    color: var(--tab-icon-active);
}

.theme-icon-wrapper-apple {
    position: relative;
    width: 20px;
    height: 20px;
    pointer-events: none;
    transition: transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

.theme-btn-apple:active .theme-icon-wrapper-apple {
    transform: scale(0.8);
}

.theme-icon-wrapper-apple svg {
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.5s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.4s ease;
    stroke-width: 2.2;
}

.sun-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.moon-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0);
}

body.dark-theme .sun-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

body.dark-theme .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

@media (max-width: 768px) {
    .tab-bar-apple {
        bottom: 16px;
        padding: 6px 8px;
        min-width: 160px;
        max-width: 320px;
    }
    
    .tab-item-apple {
        padding: 0 14px;
        height: 38px;
        font-size: 12px;
    }
    
    .tab-item-apple .tab-icon {
        width: 17px;
        height: 17px;
    }
    
    .tab-item-apple .tab-label {
        font-size: 12px;
    }
    
    .tab-pill {
        height: 38px;
    }
    
    .tab-divider {
        height: 20px;
    }

    .theme-btn-apple {
        width: 38px;
        height: 38px;
    }
    
    .theme-icon-wrapper-apple {
        width: 17px;
        height: 17px;
    }
    
    .theme-icon-wrapper-apple svg {
        width: 17px;
        height: 17px;
    }
}

@media (max-width: 480px) {
    .tab-bar-apple {
        bottom: 12px;
        padding: 5px 6px;
        min-width: 130px;
        max-width: 260px;
    }
    
    .tab-item-apple {
        padding: 0 10px;
        height: 34px;
        font-size: 11px;
    }
    
    .tab-item-apple .tab-icon {
        width: 15px;
        height: 15px;
    }
    
    .tab-item-apple .tab-label {
        font-size: 11px;
    }
    
    .tab-pill {
        height: 34px;
    }
    
    .tab-divider {
        height: 18px;
        margin: 0 2px;
    }

    .theme-btn-apple {
        width: 34px;
        height: 34px;
    }
    
    .theme-icon-wrapper-apple {
        width: 15px;
        height: 15px;
    }
    
    .theme-icon-wrapper-apple svg {
        width: 15px;
        height: 15px;
    }
}