﻿@charset "utf-8";

/* =========================================
           1. Reset and Base Styles
           ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, html {
    height: 100%;
    font-family: "Microsoft JhengHei", "Heiti TC", sans-serif;
    overflow-x: hidden;
}

/* =========================================
           2. Layout Structure (桌面版)
           ========================================= */
.login-page {
    width: 100%;
    height: 100vh;
    background: url('/images/login-bg.jpg') no-repeat center center;
    background-size: cover;
    display: flex;
    justify-content: center;
}

.layout-container {
    position: relative;
    width: 100%;
    max-width: 1400px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 40px;
}

/* =========================================
           3. Logo and Mobile Title
           ========================================= */
.header-logo {
    position: absolute;
    top: 0px;
    left: 40px;
    z-index: 10;
}

    .header-logo img {
        max-width: 250px;
        height: auto;
    }

.mobile-sys-title {
    display: none;
}
/* 桌面版隱藏 */

/* =========================================
           4. Login Box (桌面版)
           ========================================= */
.login-box {
    position: relative;
    width: 100%;
    max-width: 468px;
    background: url('/images/login-block-bg.png') no-repeat top center;
    background-size: 100% 100%;
    padding: 115px 45px 50px 40px;
    margin-left: 0;
    min-height: 360px;
}

/* 多語系切換器 (Desktop) */
.lang-switch {
    position: absolute;
    top: -50px;
    right: 0;
    z-index: 20;
    display: flex;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 4px;
    border-radius: 30px;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.lang-btn {
    border: none;
    background: transparent;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}

    .lang-btn:hover {
        color: #3498db;
    }

    .lang-btn.active {
        background-color: #3498db;
        color: #fff;
        box-shadow: 0 2px 5px rgba(52, 152, 219, 0.3);
    }

/* 表單 Grid 佈局 */
.form-grid {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 15px 12px;
    align-items: center;
}

/* =========================================
           5. Form Elements
           ========================================= */
.form-label {
    text-align: right;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    color: #635045;
    font-weight: bold;
}

.label-zh {
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.label-en {
    font-size: 0.75rem;
    font-family: Arial, sans-serif;
}

.form-control {
    width: 100%;
    height: 42px;
    padding: 5px 10px;
    border: 1px solid #aaa;
    border-radius: 2px;
    font-size: 1rem;
    outline: none;
    background-color: #fff;
    transition: all 0.3s;
}

    .form-control:focus {
        border-color: #f39c12;
        box-shadow: 0 0 5px rgba(243, 156, 18, 0.3);
    }

/* 驗證碼區塊 */
.captcha-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.captcha-input {
    width: 100px;
    height: 42px;
    padding: 5px;
    border: 1px solid #aaa;
    border-radius: 2px;
    text-align: center;
    transition: all 0.3s;
}

    .captcha-input:focus {
        border-color: #3498db;
        box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
    }

.captcha-img {
    background-color: #fff;
    color: #3498db;
    font-weight: bold;
    font-size: 1.25rem;
    letter-spacing: 3px;
    padding: 0 10px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    box-shadow: 0 0 2px rgba(0,0,0,0.1);
    min-width: 90px;
}

.btn-refresh {
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    padding: 0 5px;
    display: flex;
    align-items: center;
    transition: transform 0.3s;
}

    .btn-refresh:active {
        transform: rotate(180deg);
    }

    .btn-refresh img {
        width: 20px;
        height: 20px;
    }

.form-actions {
    grid-column: 2;
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.btn {
    flex: 1;
    height: 45px;
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    letter-spacing: 1px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

    .btn:active {
        transform: scale(0.98);
    }

.btn-forgot {
    background-color: #b0c095;
}

.btn-submit {
    background: linear-gradient(135deg, #fdb900 0%, #f39c12 100%);
    font-weight: bold;
}

/* 桌面版隱藏 */
.welcome-title {
    display: none;
}

/* =========================================
           6. Mobile and Tablet Styles (包含橫向手機)
========================================= */
/* ★ 修改：將斷點提升至 1024px，涵蓋 iPad 與 手機橫向 ★ */
@media (max-width: 1024px) {

    .login-page {
        background-image: none;
        background: linear-gradient(160deg, #e0f7fa 0%, #fff0f1 100%);
        /* 改為 min-height，避免橫向內容被切掉 */
        min-height: 100vh;
        height: auto;
        align-items: center;
        /* 增加上下留白，讓橫向捲動時不會貼邊 */
        padding: 40px 0;
    }

    .layout-container {
        padding: 20px;
        justify-content: center;
        max-width: 100%;
        /* 確保容器高度隨內容撐開 */
        height: auto;
        min-height: 100%;
    }

    .header-logo {
        display: none;
    }

    /* 語系切換器 Mobile */
    .lang-switch {
        top: 20px;
        right: 20px;
        background-color: rgba(240, 240, 240, 0.6);
        box-shadow: none;
    }

    .lang-btn {
        padding: 4px 10px;
        font-size: 0.8rem;
    }

    /* 系統標題 */
    .mobile-sys-title {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-bottom: 30px;
        animation: fadeInUp 0.8s ease-out;
    }

    .sys-school-name {
        font-size: 1.1rem;
        color: #2f3640;
        letter-spacing: 6px;
        font-weight: bold;
        margin-bottom: 8px;
        opacity: 0.7;
        border-bottom: 2px solid rgba(0,0,0,0.05);
        padding-bottom: 2px;
    }

    .sys-line-1 {
        font-size: 2.4rem;
        font-weight: 900;
        letter-spacing: 4px;
        margin-bottom: 10px;
        background: linear-gradient(45deg, #ff6b81, #ff9f43);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        filter: drop-shadow(0px 2px 2px rgba(255, 107, 129, 0.2));
        position: relative;
    }

        .sys-line-1::after {
            content: '';
            display: block;
            width: 60px;
            height: 8px;
            margin: 0 auto;
            margin-top: -5px;
            border-bottom: 4px solid #fdb900;
            border-radius: 50%;
            opacity: 0.8;
        }

    .sys-line-2 {
        font-size: 1.3rem;
        font-weight: bold;
        color: #57606f;
        letter-spacing: 2px;
        margin-top: 8px;
        position: relative;
        padding: 0 10px;
    }

        .sys-line-2::before, .sys-line-2::after {
            content: '';
            display: inline-block;
            width: 6px;
            height: 6px;
            background-color: #a4b0be;
            border-radius: 50%;
            vertical-align: middle;
            margin: 0 8px;
            opacity: 0.6;
        }

    /* 登入卡片 */
    .login-box {
        background: rgba(255, 255, 255, 0.95);
        max-width: 100%;
        width: 100%;
        margin: 0;
        padding: 35px 25px;
        border-radius: 20px;
        box-shadow: 0 15px 35px rgba(0,0,0,0.08);
        min-height: auto;
        overflow: hidden;
        backdrop-filter: blur(10px);
        animation: fadeInUp 1s ease-out 0.2s backwards;
    }

        .login-box::after {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 6px;
            background: linear-gradient(90deg, #ff6b81, #fdb900, #3498db);
        }

        .login-box::before {
            display: none;
        }

    /* 新增 welcome-title 樣式 */
    .welcome-title {
        display: block;
        text-align: center;
        font-size: 1.2rem;
        color: #5a4a42;
        font-weight: bold;
        margin-top: 35px;
        margin-bottom: 25px;
        padding-bottom: 15px;
        border-bottom: 1px solid #eee;
        letter-spacing: 2px;
    }

    .form-grid {
        gap: 20px 10px;
    }

    .form-control, .captcha-input, .btn {
        height: 50px;
        font-size: 16px;
        border-radius: 10px;
    }

    .captcha-wrapper {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .captcha-input {
        width: 100%;
        margin-bottom: 12px;
    }

    .captcha-img {
        height: 42px;
        border-radius: 8px;
        border: 1px solid #eee;
    }

    .btn-refresh {
        padding: 5px 10px;
    }

        .btn-refresh img {
            width: 28px;
            height: 28px;
        }

    .label-captcha {
        align-self: flex-start;
        margin-top: 12px;
    }
}

/* ★ 新增：針對「橫向模式」與「矮螢幕」的特別優化 ★ */
/* 當螢幕寬度小於 900px 但高度小於 500px 時 (典型的橫向手機) */
@media (max-width: 900px) and (max-height: 500px) {
    .login-page {
        padding: 10px 0; /* 減少上下留白 */
    }

    .welcome-title {
        margin-top: 25px;
        margin-bottom: 15px;
        padding-bottom: 10px;
        font-size: 1rem;
    }

    .mobile-sys-title {
        margin-bottom: 15px; /* 縮減標題下方的距離 */
        flex-direction: row; /* 將標題改成橫向排列以節省高度 */
        gap: 15px;
        align-items: baseline;
        flex-wrap: wrap;
        justify-content: center;
    }

    .sys-school-name {
        margin-bottom: 0;
        font-size: 1rem;
    }

    .sys-line-1 {
        font-size: 1.5rem;
        margin-bottom: 0;
    }

        .sys-line-1::after {
            display: none;
        }
    /* 隱藏微笑曲線以節省空間 */
    .sys-line-2 {
        font-size: 1rem;
        margin-top: 0;
    }

    .login-box {
        padding: 20px 25px; /* 縮減卡片內距 */
    }

        .login-box::before {
            margin-bottom: 15px;
            padding-bottom: 10px;
            font-size: 1rem;
        }

    .form-grid {
        gap: 10px;
    }
    /* 縮減表單間距 */
    .form-control, .captcha-input, .btn {
        height: 40px;
    }
    /* 縮小按鈕高度 */

    .captcha-img {
        height: 38px;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 380px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .form-label {
        text-align: left;
        flex-direction: row;
        gap: 10px;
        align-items: baseline;
        margin-bottom: 5px;
        margin-top: 0;
    }

    .form-grid > div[style*="grid-column: 1"] {
        display: none;
    }

    .form-actions {
        grid-column: 1;
        margin-top: 20px;
    }

    .sys-line-1 {
        font-size: 2rem;
    }

    .sys-line-2 {
        font-size: 1.1rem;
    }

    .sys-school-name {
        font-size: 1rem;
        letter-spacing: 4px;
    }
}