/* ==================== 共用樣式 ==================== */

/* 強制隱藏殘留元素 */
.page-loader,
.loader-spinner,
.loader-text {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
    left: -9999px !important;
}

/* ==================== 漢堡選單 (768px 以下) ==================== */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 1001;
    background: none;
    border: none;
    padding: 0;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* 手機版選單 */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: rgba(13, 13, 13, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 80px 2rem 2rem;
        transition: right 0.3s ease;
        z-index: 999;
        border-left: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-menu li {
        margin: 1rem 0;
    }
    
    .nav-menu a {
        font-size: 1.1rem;
        display: block;
        padding: 0.8rem 0;
    }
    
    .nav-right {
        flex-direction: column;
        gap: 1rem;
    }
    
    .lang-switch {
        margin-top: 1rem;
    }
    
    /* 遮罩層 */
    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }
    
    .nav-overlay.active {
        display: block;
    }
}

/* ==================== 返回頂部按鈕 ==================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #c62828, #8e0000);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 900;
    box-shadow: 0 4px 15px rgba(198, 40, 40, 0.4);
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(198, 40, 40, 0.6);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

/* ==================== 頁面載入動畫（已停用）==================== */
.page-loader {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.loader-spinner {
    display: none !important;
}

.loader-text {
    display: none !important;
}

/* ==================== 內容載入中動畫 ==================== */
.content-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    min-height: 300px;
}

.content-loader-icon {
    width: 80px;
    height: 80px;
    position: relative;
    margin-bottom: 1.5rem;
}

/* 齒輪動畫 */
.gear-icon {
    font-size: 3rem;
    color: #1e88e5;
    animation: gearSpin 2s linear infinite;
}

@keyframes gearSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 加工動畫 - 銑刀風格 */
.milling-animation {
    width: 60px;
    height: 60px;
    position: relative;
}

.milling-animation::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #333;
    border-top-color: #c62828;
    border-right-color: #1e88e5;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.milling-animation::after {
    content: '⚙';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

.content-loader-text {
    color: #888;
    font-size: 1rem;
    letter-spacing: 1px;
}

.content-loader-text::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* ==================== 淡入動畫 ==================== */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* 延遲動畫 */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }
