/*
 * 現代化登入介面樣式
 * 日期: 2025-01-11
 */

/* =============================================================================
   全域設定和重置
============================================================================= */
* {
    box-sizing: border-box;
}

body.modern-login {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(to right, #1b4aa3 0%, #a6ffcb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* 背景動畫元素 */
body.modern-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    animation: backgroundFloat 15s ease-in-out infinite;
}

@keyframes backgroundFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(1deg); }
}

/* =============================================================================
   主容器設計
============================================================================= */
.modern-login-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.2);
    width: 100%;
    max-width: 420px;
    padding: 40px;
    margin: 20px;
    position: relative;
    transform: translateY(0);
    transition: all 0.3s ease;
    z-index: 10;
}

.modern-login-container:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.3);
}

/* =============================================================================
   標題區域
============================================================================= */
.modern-login-header {
    text-align: center;
    margin-bottom: 30px;
}

.modern-login-title {
    font-size: 28px;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 10px 0;
    background: linear-gradient(to right, #1b4aa3, #a6ffcb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modern-login-subtitle {
    font-size: 14px;
    color: #718096;
    margin: 0;
    font-weight: 400;
}

/* =============================================================================
   表單樣式
============================================================================= */
.modern-form-group {
    position: relative;
    margin-bottom: 25px;
}

.modern-form-input {
    width: 100%;
    padding: 15px 20px 15px 50px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 400;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    outline: none;
    color: #2d3748;
}

.modern-form-input:focus {
    border-color: #062d75;
    box-shadow: 0 0 0 3px rgba(6, 45, 117, 0.1);
    background: rgba(255, 255, 255, 1);
}

.modern-form-input::placeholder {
    color: #a0aec0;
    font-weight: 400;
}

/* 輸入框圖示 */
.modern-form-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 18px;
    transition: color 0.3s ease;
    z-index: 2;
}

.modern-form-group:focus-within .modern-form-icon {
    color: #062d75;
}

/* =============================================================================
   語言選擇按鈕
============================================================================= */
.modern-language-group {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    justify-content: center;
}

.modern-language-btn {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #4a5568;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.modern-language-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.modern-language-btn:hover::before {
    left: 100%;
}

.modern-language-btn:hover {
    border-color: #062d75;
    transform: translateY(-1px);
}

.modern-language-btn.active {
    background: linear-gradient(to right, #1b4aa3, #a6ffcb);
    color: white;
    border-color: #062d75;
    box-shadow: 0 4px 15px rgba(51, 122, 183, 0.3);
}

.modern-language-btn input[type="radio"] {
    display: none;
}

/* =============================================================================
   reCAPTCHA 容器
============================================================================= */
.modern-recaptcha-container {
    margin: 25px 0;
    display: flex;
    justify-content: center;
    padding: 10px;
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.8);
}

/* =============================================================================
   登入按鈕
============================================================================= */
.modern-login-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(to right, #1b4aa3 0%, #a6ffcb 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modern-login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.modern-login-btn:hover::before {
    left: 100%;
}

.modern-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(51, 122, 183, 0.4);
}

.modern-login-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(51, 122, 183, 0.3);
}

/* 載入狀態 */
.modern-login-btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.modern-login-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: modernSpin 1s linear infinite;
}

@keyframes modernSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =============================================================================
   裝飾元素
============================================================================= */
.modern-decorative-circles {
    position: absolute;
    top: -50px;
    right: -50px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(6, 45, 117, 0.1), rgba(27, 74, 163, 0.1));
    animation: decorativeFloat 8s ease-in-out infinite;
}

.modern-decorative-circles::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(6, 45, 117, 0.2), rgba(27, 74, 163, 0.2));
    animation: decorativeFloat 6s ease-in-out infinite reverse;
}

@keyframes decorativeFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-10px, -10px) rotate(180deg); }
}

/* =============================================================================
   響應式設計
============================================================================= */
@media (max-width: 480px) {
    .modern-login-container {
        margin: 10px;
        padding: 30px 25px;
        border-radius: 16px;
    }
    
    .modern-login-title {
        font-size: 24px;
    }
    
    .modern-form-input {
        padding: 14px 18px 14px 45px;
        font-size: 15px;
    }
    
    .modern-language-btn {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .modern-login-btn {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* =============================================================================
   輸入驗證狀態
============================================================================= */
.modern-form-input.error {
    border-color: #f56565;
    box-shadow: 0 0 0 3px rgba(245, 101, 101, 0.1);
}

.modern-form-input.success {
    border-color: #48bb78;
    box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.1);
}

/* =============================================================================
   載入效果
============================================================================= */
.modern-page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, #1b4aa3 0%, #a6ffcb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: all 0.5s ease;
}

.modern-page-loader.hide {
    opacity: 0;
    visibility: hidden;
}

.modern-loader-content {
    text-align: center;
    color: white;
}

.modern-loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: modernSpin 1s linear infinite;
    margin: 0 auto 20px;
}

.modern-loader-text {
    font-size: 18px;
    font-weight: 600;
    opacity: 0.9;
}

/* =============================================================================
   動畫效果
============================================================================= */
.modern-fade-in {
    animation: modernFadeIn 0.6s ease;
}

@keyframes modernFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.modern-slide-up {
    animation: modernSlideUp 0.5s ease;
}

@keyframes modernSlideUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================================================
   深色模式支援
============================================================================= */
@media (prefers-color-scheme: dark) {
    body.modern-login {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d3748 100%);
    }
    
    .modern-login-container {
        background: rgba(45, 55, 72, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .modern-login-title {
        color: #f7fafc;
    }
    
    .modern-login-subtitle {
        color: #a0aec0;
    }
    
    .modern-form-input {
        background: rgba(45, 55, 72, 0.8);
        border-color: #4a5568;
        color: #f7fafc;
    }
    
    .modern-form-input:focus {
        background: rgba(45, 55, 72, 1);
        border-color: #062d75;
    }
    
    .modern-language-btn {
        background: rgba(45, 55, 72, 0.8);
        border-color: #4a5568;
        color: #f7fafc;
    }
    
    .modern-recaptcha-container {
        background: rgba(45, 55, 72, 0.5);
    }
}

/* =============================================================================
   無障礙功能
============================================================================= */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .modern-login-container:hover {
        transform: none;
    }
    
    .modern-login-btn:hover {
        transform: none;
    }
}

/* 高對比度支援 */
@media (prefers-contrast: high) {
    .modern-form-input {
        border-width: 3px;
    }
    
    .modern-login-btn {
        border: 2px solid #4a5568;
    }
    
    .modern-language-btn {
        border-width: 3px;
    }
}