:root {
    --gradient-start: #1e88e5;
    --gradient-end: #64b5f6;
    --dark-blue: #1565c0;
    --light-blue: #90caf9;
}

/* 頁首樣式 */
.gradient-header {
    background: linear-gradient(
        135deg,
        var(--gradient-start) 0%,
        var(--gradient-end) 70%,
        var(--gradient-end) 100%
    );
    padding: 0.8rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.2);
    width: 100%;
    box-sizing: border-box;
    max-width: 100vw;
    overflow: visible;
    position: relative;
    z-index: 1000;
    min-height: 60px;
}

.gradient-header .logo {
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
}

.gradient-header .logo img {
    height: 40px;
    width: auto;
    padding: 2px 0;
}

.gradient-header .nav-links {
    display: flex;
    gap: 0.3rem;
    flex-wrap: nowrap;
    align-items: center;
    flex-shrink: 0;
    min-width: 0;
}

.gradient-header .nav-links a {
    color: white;
    text-decoration: none;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    display: inline-block;
}

.gradient-header .nav-links a:hover {
    background-color: var(--dark-blue);
}

/* 頁尾樣式 */
.gradient-footer {
    background: linear-gradient(
        135deg,
        var(--gradient-end) 0%,
        var(--gradient-start) 70%,
        var(--gradient-start) 100%
    );
    color: white;
    padding: 1rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.2);
    width: 100%;
    box-sizing: border-box;
    max-width: 100vw;
    overflow: hidden;
    position: relative;
    z-index: 1000;
}

.gradient-footer .footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

.gradient-footer .footer-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.gradient-footer .copyright {
    color: white;
    font-size: 0.9rem;
    text-align: center;
    width: 100%;
    margin-top: 0.25rem;
}

.gradient-footer a {
    color: white;
    text-decoration: none;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s;
    font-size: 0.9rem;
    white-space: nowrap;
}

.gradient-footer a:hover {
    background-color: var(--dark-blue);
}

/* 響應式樣式 */
/* 小屏到中屏過渡：451px-576px - 使用漢堡選單 */
@media (max-width: 576px) and (min-width: 451px) {
    .gradient-header {
        padding: 0.65rem 0.9rem;
        flex-wrap: nowrap;
        justify-content: space-between;
        position: relative;
    }
    
    .gradient-header .logo {
        font-size: 1.25rem;
        max-width: 70%;
    }
    
    .gradient-header .logo img {
        max-height: 34px;
        width: auto;
    }
    
    /* 桌面版導航隱藏 */
    .gradient-header .nav-links-desktop {
        display: none !important;
    }
    
    /* 漢堡按鈕顯示 */
    .mobile-menu-btn {
        display: flex !important;
        margin-left: auto;
    }
}

/* 小屏幕：450px以下 - 使用漢堡選單 */
@media (max-width: 450px) {
    .gradient-header {
        padding: 0.6rem 0.8rem;
        flex-wrap: nowrap;
        justify-content: space-between;
        position: relative;
    }
    
    .gradient-header .logo {
        font-size: 1.2rem;
        max-width: 70%;
    }
    
    .gradient-header .logo img {
        max-height: 32px;
        width: auto;
    }
    
    /* 桌面版導航隱藏 */
    .gradient-header .nav-links-desktop {
        display: none !important;
    }
    
    /* 漢堡按鈕顯示 */
    .mobile-menu-btn {
        display: flex !important;
        margin-left: auto;
    }
    
    /* 手機版下拉選單在小屏幕的調整 */
    .mobile-nav-dropdown a {
        padding: 0.8rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .gradient-footer {
        padding: 0.6rem 0.8rem;
    }
    
    .gradient-footer .footer-content {
        padding: 0;
        gap: 0.25rem;
    }
    
    .gradient-footer .copyright {
        font-size: 0.8rem;
        margin-top: 0.15rem;
    }
    
    .gradient-footer a {
        font-size: 0.8rem;
        padding: 0.25rem 0.4rem;
    }
}

/* 超小屏幕：320px-380px - 使用漢堡選單 */
@media (max-width: 380px) {
    .gradient-header {
        padding: 0.5rem 0.8rem;
        position: relative;
    }
    
    .gradient-header .logo {
        max-width: 70%;
        font-size: 1.1rem;
    }
    
    .gradient-header .logo img {
        max-height: 28px;
    }
    
    /* 桌面版導航隱藏 */
    .gradient-header .nav-links-desktop {
        display: none !important;
    }
    
    /* 漢堡按鈕顯示 */
    .mobile-menu-btn {
        display: flex !important;
        margin-left: auto;
        width: 36px;
        height: 36px;
    }
    
    .hamburger-line {
        width: 20px;
        height: 2px;
    }
    
    /* 手機版下拉選單在超小屏幕的調整 */
    .mobile-nav-dropdown a {
        padding: 0.7rem 1rem;
        font-size: 0.85rem;
    }
    
    .gradient-footer .copyright {
        font-size: 0.75rem;
    }
}

/* 漢堡按鈕樣式 */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    position: relative;
    z-index: 10000;
    margin-left: auto;
}

.mobile-menu-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.hamburger-line {
    width: 24px;
    height: 3px;
    background-color: white;
    margin: 2px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

/* 漢堡按鈕動畫 - 轉換成X */
.mobile-menu-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* 手機版下拉選單樣式 */
.mobile-nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background: linear-gradient(
        135deg,
        var(--gradient-start) 0%,
        var(--gradient-end) 70%,
        var(--gradient-end) 100%
    );
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

.mobile-nav-dropdown.active {
    max-height: 400px !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

.mobile-nav-dropdown a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.3s ease;
    font-size: 1rem;
    line-height: 1.4;
}

.mobile-nav-dropdown a:last-child {
    border-bottom: none;
}

.mobile-nav-dropdown a:hover,
.mobile-nav-dropdown a:active {
    background-color: rgba(255, 255, 255, 0.1);
}

/* 確保手機版選單在所有斷點都能正確顯示 */
@media (max-width: 768px) {
    .gradient-header {
        position: relative;
        overflow: visible !important;
    }
    
    .mobile-nav-dropdown {
        display: block !important;
    }
    
    /* 確保桌面版導航在手機版時隱藏 */
    .nav-links-desktop {
        display: none !important;
    }
    
    /* 確保漢堡按鈕在手機版時顯示 */
    .mobile-menu-btn {
        display: flex !important;
    }
}

/* 特殊處理"開始模擬"按鈕在手機版中的樣式 */
.mobile-nav-dropdown a[href="main_simulation.html"] {
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    font-weight: bold;
    border-left: 4px solid white;
}

.mobile-nav-dropdown a[href="main_simulation.html"]:hover {
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.2));
}

/* 調試用：強制顯示手機版選單 (可在開發時啟用) */
/*
@media (max-width: 768px) {
    .mobile-nav-dropdown {
        max-height: 400px !important;
        opacity: 1 !important;
        visibility: visible !important;
        display: block !important;
        border: 2px solid red;
        background: rgba(30, 136, 229, 0.9) !important;
    }
}
*/

@media (hover: none) {
    .gradient-header .nav-links a:active {
        background-color: var(--dark-blue);
    }
    
    .mobile-menu-btn:active {
        background-color: rgba(255, 255, 255, 0.2);
    }
}

/* 桌面版螢幕：769px以上 */
@media (min-width: 769px) {
    /* 確保桌面版導航顯示 */
    .gradient-header .nav-links,
    .gradient-header .nav-links-desktop {
        display: flex !important;
    }
    
    /* 確保漢堡按鈕隱藏 */
    .mobile-menu-btn {
        display: none !important;
    }
    
    /* 確保手機版選單隱藏 */
    .mobile-nav-dropdown {
        display: none !important;
    }
}

/* 中大寬度屏幕：769px-992px */
@media (max-width: 992px) and (min-width: 769px) {
    .gradient-header .nav-links a {
        padding: 0.5rem 0.8rem;
        font-size: 0.95rem;
    }
}

/* 中等寬度屏幕：577px-768px - 使用漢堡選單 */
@media (max-width: 768px) and (min-width: 577px) {
    .gradient-header {
        padding: 0.7rem 1rem;
        position: relative;
    }
    
    .gradient-header .logo {
        font-size: 1.3rem;
        max-width: 70%;
    }
    
    .gradient-header .logo img {
        max-height: 35px;
    }
    
    /* 桌面版導航隱藏 */
    .gradient-header .nav-links-desktop {
        display: none !important;
    }
    
    /* 漢堡按鈕顯示 */
    .mobile-menu-btn {
        display: flex !important;
        margin-left: auto;
    }
} 
