/**
 * login.css - 登入頁面專用樣式
 * 從 index.php 中抽取，提升可維護性和快取效能
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0c0c1e 0%, #1a1a3e 50%, #0f0f2d 100%);
    overflow-x: hidden;
    overflow-y: auto;
    padding-block: 20px;
}

body.modal-open {
    overflow: hidden;
}

/* 動態背景 - 漂浮光球 */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.bg-animation .orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: floatOrb 20s infinite ease-in-out;
}

.orb:nth-child(1) {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    top: -10%;
    left: -5%;
    animation-delay: 0s;
}

.orb:nth-child(2) {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #06b6d4, #22d3ee);
    top: 60%;
    right: -10%;
    animation-delay: -5s;
}

.orb:nth-child(3) {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, #f43f5e, #ec4899);
    bottom: -5%;
    left: 30%;
    animation-delay: -10s;
}

.orb:nth-child(4) {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    top: 20%;
    right: 20%;
    animation-delay: -15s;
}

@keyframes floatOrb {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(50px, -50px) scale(1.1);
    }
    50% {
        transform: translate(-30px, 30px) scale(0.95);
    }
    75% {
        transform: translate(30px, 50px) scale(1.05);
    }
}

/* 網格線背景 */
.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
            linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
            linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 1;
}

/* 登入卡片 */
.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
    padding: 20px;
    margin-block: auto;
}

.login-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow:
            0 25px 50px -12px rgba(0, 0, 0, 0.5),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* 標誌區 */
.logo-section {
    text-align: center;
    margin-bottom: 36px;
}

.logo-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    font-size: 36px;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
    animation: pulse 3s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 10px 50px rgba(99, 102, 241, 0.6);
    }
}

.logo-icon svg {
    width: 40px;
    height: 40px;
    fill: white;
}

h1 {
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 15px;
}

/* 錯誤訊息 */
.error-message {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.error-message::before {
    content: "!";
    font-size: 18px;
    font-weight: bold;
}

.notice-message {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.notice-success { background: rgba(16, 185, 129, 0.16); border: 1px solid rgba(16, 185, 129, 0.35); color: #a7f3d0; }
.notice-warning { background: rgba(245, 158, 11, 0.16); border: 1px solid rgba(245, 158, 11, 0.35); color: #fde68a; }
.notice-danger { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; }

/* 表單 */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    width: 100%;
    padding: 16px 20px 16px 50px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.input-wrapper input:focus {
    outline: none;
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.input-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    fill: rgba(255, 255, 255, 0.5);
    transition: fill 0.3s;
}

.input-wrapper input:focus ~ .input-icon {
    fill: #6366f1;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    color: rgba(255,255,255,0.65);
}

.password-toggle:focus-visible,
.forgot-link:focus-visible,
.public-rentals-link:focus-visible,
.cancel-btn:focus-visible {
    outline: 3px solid rgba(129, 140, 248, 0.65);
    outline-offset: 3px;
}

.forgot-link-row {
    text-align: right;
    margin-bottom: 24px;
}

.forgot-link {
    min-height: 44px;
    padding: 8px 0 8px 12px;
    border: 0;
    background: transparent;
    color: rgba(255,255,255,0.72);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.public-rentals-row { margin-top: 16px; }
.public-rentals-link {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 48px;
    width: 100%;
    padding: 13px 18px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.16);
    color: rgba(255,255,255,0.92);
    text-decoration: none;
    background: rgba(255,255,255,0.06);
    font-weight: 700;
    transition: background 0.2s ease, transform 0.2s ease;
}
.public-rentals-link:hover { background: rgba(255,255,255,0.12); transform: translateY(-1px); }

/* 登入按鈕 */
.login-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.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: 0.5s;
}

.login-btn:hover::before {
    left: 100%;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(99, 102, 241, 0.4);
}

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

/* 頁腳連結 */
.footer-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #8b5cf6;
}

.footer-links .developer-link {
    color: #8b5cf6;
    font-weight: 500;
}

/* 系統時間 */
.system-time {
    text-align: center;
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
}

/* RWD */
@media (max-width: 480px) {
    body { align-items: flex-start; padding-block: 0; }
    .login-container { padding: 12px; margin-block: 0; }
    .login-card {
        padding: 28px 20px;
        border-radius: 18px;
    }

    h1 {
        font-size: 24px;
    }

    .logo-icon {
        width: 64px;
        height: 64px;
        font-size: 28px;
    }

    .logo-section { margin-bottom: 26px; }

    .footer-links {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .footer-links a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }
}

@media (max-width: 359px) {
    .login-card { padding-inline: 16px; }
    h1 { font-size: 21px; }
    .subtitle { font-size: 12px; overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
