/**
 * 柑心果園 - 導覽樣式統一管理
 * 避免重複和互相影響
 */

/* ===== 桌面版導航樣式 ===== */
@media (min-width: 993px) {
    /* 桌面版隱藏手機選單 */
    .main-menu {
        display: none !important;
    }
    
    .desktop-nav {
        display: flex;
        justify-content: center;
        width: 100%;
        margin-top: 15px;
    }

    .nav-menu {
        display: flex;
        align-items: center;
        gap: 12px;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .nav-link {
        color: var(--white);
        text-decoration: none;
        font-size: 15px;
        font-weight: 500;
        padding: 10px 16px;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        gap: 4px;
        border-radius: 6px;
        white-space: nowrap;
        position: relative;
    }

    .nav-link:hover {
        background-color: var(--primary-color);
        color: white;
    }

    .nav-link.active {
        background-color: var(--primary-color);
        color: white;
    }

    .nav-link i {
        font-size: 12px;
        transition: transform 0.3s ease;
    }

    .dropdown {
        position: relative;
    }

    .dropdown:hover .nav-link i,
    .dropdown.active .nav-link i {
        transform: rotate(180deg);
    }

    .dropdown-menu {
        position: absolute;
        top: 100%;
        left: 0;
        background: white;
        min-width: 200px;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.3s ease;
        z-index: 10000;
        padding: 8px 0;
        margin-top: 4px;
        list-style: none;
    }

    .dropdown:hover .dropdown-menu,
    .dropdown.active .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .dropdown-menu li {
        margin: 0;
    }

    .dropdown-menu a {
        display: block;
        padding: 12px 20px;
        color: #333;
        text-decoration: none;
        font-size: 14px;
        transition: all 0.2s ease;
    }

    .dropdown-menu a:hover {
        background-color: var(--bg-light);
        color: var(--primary-color);
    }
}

/* ===== 手機版導航樣式 ===== */
@media (max-width: 992px) {
    .desktop-nav {
        display: none !important;
    }

    .mobile-header {
        display: block !important;
    }

    .mobile-menu-toggle {
        display: flex;
        position: relative;
        background: transparent;
        border: none;
        width: 40px;
        height: 40px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        cursor: pointer;
        transition: all 0.3s ease;
        -webkit-tap-highlight-color: transparent;
        z-index: 1001;
        padding: 8px;
        box-shadow: none;
    }
    
    .mobile-menu-toggle:hover,
    .mobile-menu-toggle:focus,
    .mobile-menu-toggle.active {
        background: transparent;
        border: none;
        box-shadow: none;
    }
    
    .mobile-menu-toggle .hamburger-icon,
    .mobile-menu-toggle img {
        display: none;
    }
    
    .mobile-menu-toggle .menu-line {
        width: 28px;
        height: 3px;
        background: var(--primary-color);
        border-radius: 2px;
        transition: all 0.3s ease;
    }
    
    /* 選單打開時隱藏漢堡按鈕 */
    .mobile-menu-toggle.active {
        opacity: 0;
        pointer-events: none;
    }
    
    /* ===== 手機版選單樣式 - 現代化設計 ===== */
    .main-menu {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        width: 350px;
        height: 100vh;
        background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
        z-index: 10000;
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
        overflow-y: auto;
        overflow-x: hidden;
        border-left: 1px solid #e9ecef;
        flex-direction: column;
    }
    
    .main-menu.open,
    .main-menu.active {
        display: flex !important;
        transform: translateX(0) !important;
    }
    
    /* 確保選單狀態一致性 */
    .main-menu:not(.open):not(.active) {
        display: none !important;
        transform: translateX(100%) !important;
    }
    
    /* 選單頭部 */
    .menu-header {
        background: linear-gradient(135deg, #ff8c42 0%, #ff6b1a 30%, #ff4757 70%, #ff3742 100%);
        padding: 25px 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: sticky;
        top: 0;
        z-index: 10;
        box-shadow: 0 8px 32px rgba(255, 107, 26, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
        border-bottom: 3px solid rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(10px);
        position: relative;
        overflow: hidden;
    }
    
    .menu-header::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
        animation: shimmer 3s infinite;
    }
    
    @keyframes shimmer {
        0% { left: -100%; }
        100% { left: 100%; }
    }
    
    .menu-logo {
        display: flex;
        align-items: center;
        gap: 12px;
    }
    
    .menu-logo-img {
        width: 45px;
        height: 45px;
        border-radius: 12px;
        object-fit: cover;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        border: 2px solid rgba(255, 255, 255, 0.3);
        transition: transform 0.3s ease;
    }
    
    .menu-logo-img:hover {
        transform: scale(1.05);
    }
    
    .menu-logo-text {
        color: white;
    }
    
    .logo-main {
        font-size: 20px;
        font-weight: 800;
        margin-bottom: 3px;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        letter-spacing: 0.5px;
    }
    
    .logo-sub {
        font-size: 13px;
        opacity: 0.95;
        font-weight: 500;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }
    
    .menu-close {
        background: rgba(255, 255, 255, 0.25);
        border: 2px solid rgba(255, 255, 255, 0.3);
        font-size: 22px;
        color: white;
        cursor: pointer;
        padding: 10px;
        border-radius: 12px;
        transition: all 0.3s ease;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    .menu-close:hover {
        background: rgba(255, 255, 255, 0.4);
        transform: scale(1.1) rotate(90deg);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    /* 選單導航 */
    .menu-nav {
        padding: 20px 0;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .menu-list {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    
    .menu-item {
        margin-bottom: 4px;
        opacity: 0;
        transform: translateX(20px);
        animation: slideInRight 0.5s ease forwards;
    }
    
    .menu-item:nth-child(1) { animation-delay: 0.1s; }
    .menu-item:nth-child(2) { animation-delay: 0.2s; }
    .menu-item:nth-child(3) { animation-delay: 0.3s; }
    .menu-item:nth-child(4) { animation-delay: 0.4s; }
    .menu-item:nth-child(5) { animation-delay: 0.5s; }
    .menu-item:nth-child(6) { animation-delay: 0.6s; }
    
    @keyframes slideInRight {
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
    
    .menu-link {
        display: flex;
        align-items: center;
        padding: 18px 25px;
        color: #2c3e50;
        text-decoration: none;
        font-weight: 600;
        font-size: 17px;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        border-radius: 0 30px 30px 0;
        margin-right: 25px;
        background: linear-gradient(135deg, rgba(255, 140, 66, 0.05) 0%, rgba(255, 107, 26, 0.1) 100%);
        border-left: 4px solid transparent;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        overflow: hidden;
    }
    
    .menu-link::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
        transition: left 0.6s ease;
    }
    
    .menu-link:hover::before {
        left: 100%;
    }
    
    /* 僅在非觸控設備上啟用hover效果 */
    @media (hover: hover) and (pointer: fine) {
        .menu-link:hover {
            background: linear-gradient(135deg, #ff8c42, #ff6b1a);
            color: white;
            transform: translateX(10px) scale(1.02);
            box-shadow: 0 8px 25px rgba(255, 107, 26, 0.5), 0 0 20px rgba(255, 140, 66, 0.3);
            border-left: 4px solid rgba(255, 255, 255, 0.8);
        }
    }
    
    .menu-icon {
        width: 28px;
        font-size: 20px;
        margin-right: 15px;
        text-align: center;
        color: #ff8c42;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
    }
    
    .menu-link:hover .menu-icon {
        color: white;
        transform: scale(1.1) rotate(5deg);
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }
    
    .menu-text {
        flex: 1;
    }
    
    .menu-arrow {
        font-size: 16px;
        transition: transform 0.3s ease;
        color: #ff8c42;
        font-weight: bold;
    }
    
    .dropdown.active .menu-arrow {
        transform: rotate(180deg);
        color: white;
    }
    
    /* 子選單 */
    .submenu {
        display: none;
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 50%, #dee2e6 100%);
        margin: 0;
        padding: 8px 0;
        list-style: none;
        border-radius: 0 0 15px 15px;
        margin-right: 25px;
        overflow: hidden;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.8);
        border: 1px solid rgba(255, 140, 66, 0.2);
        backdrop-filter: blur(5px);
        position: relative;
    }
    
    .submenu::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 1px;
        background: linear-gradient(90deg, transparent, rgba(255, 140, 66, 0.5), transparent);
    }
    
    .submenu-link {
        display: block;
        padding: 14px 25px 14px 60px;
        color: #495057;
        text-decoration: none;
        font-size: 15px;
        font-weight: 500;
        transition: all 0.3s ease;
        position: relative;
        border-left: 3px solid transparent;
    }
    
    /* 僅在非觸控設備上啟用hover效果 */
    @media (hover: hover) and (pointer: fine) {
        .submenu-link:hover {
            color: #ff8c42;
            background: linear-gradient(135deg, rgba(255, 140, 66, 0.1), rgba(255, 107, 26, 0.05));
            padding-left: 68px;
            border-left: 3px solid #ff8c42;
            transform: translateX(5px);
        }
    }
    
    .submenu-link::before {
        content: '';
        position: absolute;
        left: 40px;
        top: 50%;
        transform: translateY(-50%);
        width: 4px;
        height: 4px;
        background: #ff8c42;
        border-radius: 50%;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    /* 僅在非觸控設備上啟用hover效果 */
    @media (hover: hover) and (pointer: fine) {
        .submenu-link:hover::before {
            opacity: 1;
        }
    }
    
    .submenu-divider {
        height: 1px;
        background: #e9ecef;
        margin: 8px 0;
    }
    
    .menu-item.dropdown.active .submenu {
        display: block;
        animation: slideDown 0.3s ease;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* 選單底部 */
    .menu-footer {
        background: #f8f9fa;
        padding: 20px;
        border-top: 1px solid #e9ecef;
        margin-top: auto;
    }
    
    .menu-contact {
        margin-bottom: 15px;
    }
    
    .contact-item {
        display: flex;
        align-items: center;
        margin-bottom: 8px;
        color: #6c757d;
        font-size: 14px;
    }
    
    .contact-item i {
        width: 16px;
        margin-right: 8px;
        color: #ff8c42;
    }
    
    .menu-social {
        display: flex;
        gap: 12px;
    }
    
    .social-link {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
        color: #6c757d;
        border-radius: 12px;
        text-decoration: none;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
        border: 2px solid rgba(255, 140, 66, 0.1);
        position: relative;
        overflow: hidden;
    }
    
    .social-link::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        background: radial-gradient(circle, rgba(255, 140, 66, 0.3) 0%, transparent 70%);
        transition: all 0.4s ease;
        transform: translate(-50%, -50%);
        border-radius: 50%;
    }
    
    .social-link:hover {
        background: linear-gradient(135deg, #ff8c42, #ff6b1a);
        color: white;
        transform: translateY(-3px) scale(1.1);
        box-shadow: 0 8px 25px rgba(255, 140, 66, 0.5), 0 0 20px rgba(255, 107, 26, 0.3);
        border-color: rgba(255, 255, 255, 0.3);
    }
    
    .social-link:hover::before {
        width: 100px;
        height: 100px;
    }
    
    /* 選單遮罩 */
    .menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        z-index: 9999;
        backdrop-filter: blur(2px);
    }
    
    .menu-overlay.active {
        display: block !important;
        animation: fadeIn 0.3s ease;
    }
    
    /* 小螢幕優化 */
    @media (max-width: 480px) {
        .menu-header {
            padding: 20px 15px;
        }
        
        .menu-nav {
            padding: 15px 0;
        }
        
        .menu-footer {
            padding: 15px;
        }
        
        .menu-link {
            padding: 15px 20px;
            font-size: 15px;
        }
        
        .submenu-link {
            padding: 12px 20px 12px 50px;
            font-size: 13px;
        }
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}
