/**
 * Edge Navigation Styles
 * Apple 风格毛玻璃导航
 */

/* ========================================
   CSS Variables
   ======================================== */
:root {
    --edge-nav-bg: rgba(255, 255, 255, 0.72);
    --edge-nav-border: rgba(0, 0, 0, 0.1);
    --edge-nav-primary: #007AFF;
    --edge-nav-text: #1d1d1f;
    --edge-nav-text-secondary: #86868b;
    --edge-nav-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
    --edge-nav-blur: 20px;
    --edge-nav-transition: cubic-bezier(0.34, 1.56, 0.64, 1) 0.35s;
    --edge-nav-panel-width: 240px;
    --edge-nav-trigger-width: 10px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --edge-nav-bg: rgba(30, 30, 30, 0.72);
        --edge-nav-border: rgba(255, 255, 255, 0.1);
        --edge-nav-text: #f5f5f7;
        --edge-nav-text-secondary: #a1a1a6;
        --edge-nav-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
    }
}

/* ========================================
   Desktop: Trigger Zone
   ======================================== */
/* 触发区域 - 明显的标签式把手 */
#edge-nav-trigger {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 100px;
    z-index: 99998;
    pointer-events: auto;
    cursor: pointer;
}

/* 标签式把手 - 更明显 */
#edge-nav-trigger::after {
    content: '☰';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 80px;
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    border-radius: 0 12px 12px 0;
    box-shadow: 2px 2px 12px rgba(0, 122, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    line-height: 80px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 悬停时把手伸出更多 */
#edge-nav-trigger:hover::after {
    width: 36px;
    box-shadow: 4px 4px 20px rgba(0, 122, 255, 0.4);
    background: linear-gradient(135deg, #0A84FF 0%, #6866E0 100%);
}

/* 添加脉冲动画吸引注意 */
@keyframes pulse-hint {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    50% { transform: translateY(-50%) translateX(4px); }
}

#edge-nav-trigger::after {
    animation: pulse-hint 2s ease-in-out infinite;
}

#edge-nav-trigger:hover::after {
    animation: none;
}

/* ========================================
   Desktop: Navigation Panel
   ======================================== */
.edge-nav-panel {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--edge-nav-panel-width);
    background: var(--edge-nav-bg);
    backdrop-filter: blur(var(--edge-nav-blur));
    -webkit-backdrop-filter: blur(var(--edge-nav-blur));
    border-right: 1px solid var(--edge-nav-border);
    box-shadow: var(--edge-nav-shadow);
    z-index: 99999;
    display: flex;
    align-items: stretch;
    justify-content: center;
    transform: translateX(-100%);
    opacity: 0;
    transition: transform var(--edge-nav-transition),
                opacity 0.25s ease;
    pointer-events: none;
}

.edge-nav-panel.is-visible {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

/* Navigation List - 均匀分布 */
.edge-nav-list {
    list-style: none;
    margin: 0;
    padding: 24px 16px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    height: 100%;
}

.edge-nav-item {
    margin: 0;
    padding: 0;
}

.edge-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--edge-nav-text);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    transition: background-color 0.2s ease,
                transform 0.2s ease;
}

.edge-nav-link:hover {
    background-color: rgba(0, 122, 255, 0.1);
    transform: translateX(4px);
}

.edge-nav-link:active {
    background-color: rgba(0, 122, 255, 0.2);
    transform: translateX(2px);
}

.edge-nav-icon {
    font-size: 20px;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.edge-nav-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================
   Mobile: Bottom Navigation
   ======================================== */
.edge-nav-mobile {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--edge-nav-bg);
    backdrop-filter: blur(var(--edge-nav-blur));
    -webkit-backdrop-filter: blur(var(--edge-nav-blur));
    border-top: 1px solid var(--edge-nav-border);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
    z-index: 99999;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.edge-nav-mobile-list {
    list-style: none;
    margin: 0;
    padding: 8px 4px;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
}

.edge-nav-mobile-item {
    flex: 1;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.edge-nav-mobile-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--edge-nav-text-secondary);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    transition: color 0.2s ease,
                background-color 0.2s ease;
}

.edge-nav-mobile-link:hover,
.edge-nav-mobile-link:active {
    color: var(--edge-nav-primary);
    background-color: rgba(0, 122, 255, 0.08);
}

.edge-nav-mobile-icon {
    font-size: 22px;
}

.edge-nav-mobile-label {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ========================================
   Responsive: Mobile Breakpoint
   ======================================== */
@media (max-width: 767px) {
    /* Hide desktop navigation */
    #edge-nav-trigger,
    .edge-nav-panel {
        display: none !important;
    }

    /* Show mobile navigation */
    .edge-nav-mobile {
        display: block;
    }

    /* Add bottom padding to body to prevent content being hidden */
    body {
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0));
    }
}

/* ========================================
   Desktop: Hide mobile navigation
   ======================================== */
@media (min-width: 768px) {
    .edge-nav-mobile {
        display: none !important;
    }
}

/* ========================================
   Accessibility
   ======================================== */
.edge-nav-link:focus,
.edge-nav-mobile-link:focus {
    outline: 2px solid var(--edge-nav-primary);
    outline-offset: 2px;
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
    .edge-nav-panel,
    .edge-nav-link,
    .edge-nav-mobile-link {
        transition: none;
    }
}

/* ========================================
   Print: Hide navigation
   ======================================== */
@media print {
    #edge-nav-trigger,
    .edge-nav-panel,
    .edge-nav-mobile {
        display: none !important;
    }

    body {
        padding-bottom: 0 !important;
    }
}
