* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft JhengHei', '微軟正黑體', Arial, sans-serif;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    position: relative;
    overflow-x: hidden;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.top-gradient-section {
    position: relative;
    padding: 60px 20px 100px;
    text-align: center;
    flex-shrink: 0;
    overflow: hidden;
    min-height: 300px;
}

.animated-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    will-change: transform;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.4) 0%, rgba(59, 130, 246, 0.2) 50%, transparent 100%);
    top: -150px;
    left: -150px;
    animation: orb-move-1 25s ease-in-out infinite;
    filter: blur(100px);
}

.orb-2 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(30, 64, 175, 0.5) 0%, rgba(96, 165, 250, 0.3) 50%, transparent 100%);
    bottom: -100px;
    right: -100px;
    animation: orb-move-2 30s ease-in-out infinite;
    filter: blur(120px);
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.4) 0%, rgba(30, 64, 175, 0.2) 50%, transparent 100%);
    top: 30%;
    left: 60%;
    transform: translate(-50%, -50%);
    animation: orb-move-3 35s ease-in-out infinite;
    filter: blur(90px);
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(96, 165, 250, 0.6), 0 0 30px rgba(59, 130, 246, 0.4);
    will-change: transform, opacity;
    animation-timing-function: ease-in-out;
}

.particle-1 {
    top: 20%;
    left: 10%;
    animation: particle-float-1 15s ease-in-out infinite;
    animation-delay: 0s;
}

.particle-2 {
    top: 60%;
    left: 20%;
    animation: particle-float-2 18s ease-in-out infinite;
    animation-delay: -3s;
}

.particle-3 {
    top: 30%;
    right: 15%;
    animation: particle-float-3 20s ease-in-out infinite;
    animation-delay: -6s;
}

.particle-4 {
    bottom: 25%;
    left: 30%;
    animation: particle-float-4 22s ease-in-out infinite;
    animation-delay: -9s;
}

.particle-5 {
    top: 15%;
    right: 30%;
    animation: particle-float-5 16s ease-in-out infinite;
    animation-delay: -2s;
}

.particle-6 {
    bottom: 40%;
    right: 25%;
    animation: particle-float-6 19s ease-in-out infinite;
    animation-delay: -5s;
}

@keyframes orb-move-1 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(150px, 100px) scale(1.2);
    }
    50% {
        transform: translate(300px, 50px) scale(0.9);
    }
    75% {
        transform: translate(150px, -50px) scale(1.1);
    }
}

@keyframes orb-move-2 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(-120px, -80px) scale(1.15);
    }
    50% {
        transform: translate(-250px, -30px) scale(0.85);
    }
    75% {
        transform: translate(-120px, 60px) scale(1.05);
    }
}

@keyframes orb-move-3 {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
    33% {
        transform: translate(-40%, -60%) scale(1.1) rotate(120deg);
    }
    66% {
        transform: translate(-60%, -40%) scale(0.9) rotate(240deg);
    }
}

@keyframes particle-float-1 {
    0%, 100% {
        transform: translate(0, 0);
        opacity: 0.6;
    }
    50% {
        transform: translate(100px, -150px);
        opacity: 1;
    }
}

@keyframes particle-float-2 {
    0%, 100% {
        transform: translate(0, 0);
        opacity: 0.5;
    }
    50% {
        transform: translate(-80px, -120px);
        opacity: 0.9;
    }
}

@keyframes particle-float-3 {
    0%, 100% {
        transform: translate(0, 0);
        opacity: 0.7;
    }
    50% {
        transform: translate(-120px, 100px);
        opacity: 1;
    }
}

@keyframes particle-float-4 {
    0%, 100% {
        transform: translate(0, 0);
        opacity: 0.6;
    }
    50% {
        transform: translate(150px, -100px);
        opacity: 1;
    }
}

@keyframes particle-float-5 {
    0%, 100% {
        transform: translate(0, 0);
        opacity: 0.5;
    }
    50% {
        transform: translate(-100px, -80px);
        opacity: 0.9;
    }
}

@keyframes particle-float-6 {
    0%, 100% {
        transform: translate(0, 0);
        opacity: 0.7;
    }
    50% {
        transform: translate(90px, 130px);
        opacity: 1;
    }
}

/* 浮動形狀樣式 */
.floating-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.shape {
    position: absolute;
    opacity: 0.1;
    will-change: transform;
}

.shape-1 {
    width: 80px;
    height: 80px;
    background: linear-gradient(45deg, rgba(96, 165, 250, 0.3), rgba(59, 130, 246, 0.3));
    border-radius: 20px;
    top: 15%;
    left: 15%;
    animation: shape-float-1 20s ease-in-out infinite;
    transform: rotate(45deg);
}

.shape-2 {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.4), rgba(96, 165, 250, 0.2));
    border-radius: 50%;
    top: 70%;
    right: 20%;
    animation: shape-float-2 25s ease-in-out infinite;
}

.shape-3 {
    width: 100px;
    height: 40px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), rgba(30, 64, 175, 0.3));
    border-radius: 20px;
    top: 40%;
    left: 5%;
    animation: shape-float-3 30s ease-in-out infinite;
    transform: rotate(-30deg);
}

.shape-4 {
    width: 70px;
    height: 70px;
    background: linear-gradient(225deg, rgba(96, 165, 250, 0.25), rgba(59, 130, 246, 0.25));
    border-radius: 15px;
    top: 25%;
    right: 10%;
    animation: shape-float-4 22s ease-in-out infinite;
    transform: rotate(60deg);
}

@keyframes shape-float-1 {
    0%, 100% {
        transform: translate(0, 0) rotate(45deg);
    }
    25% {
        transform: translate(50px, -30px) rotate(90deg);
    }
    50% {
        transform: translate(20px, 40px) rotate(135deg);
    }
    75% {
        transform: translate(-30px, 10px) rotate(180deg);
    }
}

@keyframes shape-float-2 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(-40px, -50px) scale(1.2);
    }
    66% {
        transform: translate(30px, 20px) scale(0.8);
    }
}

@keyframes shape-float-3 {
    0%, 100% {
        transform: translate(0, 0) rotate(-30deg);
    }
    50% {
        transform: translate(80px, -60px) rotate(30deg);
    }
}

@keyframes shape-float-4 {
    0%, 100% {
        transform: translate(0, 0) rotate(60deg);
    }
    25% {
        transform: translate(-20px, 40px) rotate(120deg);
    }
    50% {
        transform: translate(40px, -20px) rotate(180deg);
    }
    75% {
        transform: translate(-10px, -30px) rotate(240deg);
    }
}

.page-title {
    color: #ffffff;
    font-size: 42px;
    font-weight: 700;
    margin: 0;
    text-align: center;
    position: relative;
    z-index: 3;
    text-shadow: 0 4px 20px rgba(30, 64, 175, 0.6), 0 2px 10px rgba(96, 165, 250, 0.4);
    letter-spacing: 1px;
}

.wave-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    overflow: hidden;
    z-index: 2;
}

.wave-divider svg {
    width: 100%;
    height: 100%;
    display: block;
}

.wave-divider path {
    fill: #1e40af !important;
    opacity: 0.8;
}

.login-container {
    width: 100%;
    max-width: 420px;
    margin: 0px auto auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
    animation: fadeIn 0.5s ease-in;
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 40px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(30, 64, 175, 0.3), 0 8px 32px rgba(96, 165, 250, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 40px;
    width: 100%;
    margin-top: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
    display: none;
}

.login-form {
    width: 100%;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #f8f9fa;
    color: #333;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: #2563eb;
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input[type="text"].error:focus,
.form-group input[type="password"].error:focus {
    border-color: #e74c3c !important;
    background: #ffe5e5 !important;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1) !important;
}

.form-group input::placeholder {
    color: #999;
}

.password-input-wrapper {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.toggle-password:hover {
    opacity: 1;
}

.eye-icon {
    font-size: 18px;
    user-select: none;
}

.error-message {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 6px;
    display: none;
    animation: shake 0.3s;
}

.error-message.show {
    display: block;
}

.general-error {
    text-align: center;
    margin-top: 16px;
    padding: 12px;
    background: #fee;
    border-radius: 8px;
    border: 1px solid #fcc;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.form-options {
    margin-bottom: 24px;
    font-size: 14px;
}

.remember-me {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #666;
}

.remember-me input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.login-button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%);
    background-size: 200% 200%;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: buttonGradient 3s ease infinite;
}

.login-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(30, 64, 175, 0.4), 0 6px 20px rgba(96, 165, 250, 0.3);
    animation-duration: 2s;
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.button-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

.button-loader.show {
    display: block;
}

.button-text.hide {
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes buttonGradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 響應式設計 */
@media (max-width: 480px) {
    .top-gradient-section {
        padding: 40px 20px 60px;
    }
    
    .page-title {
        font-size: 28px;
    }
    
    .login-container {
        margin-top: -30px;
    }
    
    .login-box {
        padding: 30px 24px;
        margin-top: 30px;
    }
}

/* 輸入驗證狀態 */
.form-group input.error {
    border-color: #e74c3c !important;
    background: #ffe5e5 !important;
}

.form-group input.success {
    border-color: #27ae60;
}

