:root {
    --primary-color: #006170;
    --secondary-color: #0099B0;
    --white: #ffffff;
    --text-dark: #1a1a1a;
    --text-gray: #666666;
    --border-color: #e0e0e0;
    --error-color: #dc2626;
    --success-color: #16a34a;
    --bg-light: #f8f9fa;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background: linear-gradient(135deg, #006170 0%, #0099B0 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-x: hidden;
}

/* 背景裝飾 */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.compass {
    position: absolute;
    width: 800px;
    height: 800px;
    top: -200px;
    right: -200px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    animation: rotate 60s linear infinite;
}

.compass::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 60%;
    background: rgba(255, 255, 255, 0.1);
}

.compass::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    width: 2px;
    height: 60%;
    background: rgba(255, 255, 255, 0.1);
}

.triangle-pattern {
    position: absolute;
    bottom: -100px;
    left: -100px;
    width: 600px;
    height: 600px;
    background-image:
        linear-gradient(45deg, transparent 48%, rgba(255, 255, 255, 0.03) 49%, rgba(255, 255, 255, 0.03) 51%, transparent 52%),
        linear-gradient(-45deg, transparent 48%, rgba(255, 255, 255, 0.03) 49%, rgba(255, 255, 255, 0.03) 51%, transparent 52%);
    background-size: 40px 40px;
    opacity: 0.5;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* 主容器 */
.container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    z-index: 1;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 0;
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 左側資訊區 */
.info-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 60px 40px;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.info-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

.logo-area {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeInDown 0.8s ease-out 0.2s both;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.badge-logo {
    width: 150px;
    height: 150px;
    margin: 0 auto;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.badge-logo img,
.badge-logo svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.app-title {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 8px;
    letter-spacing: 2px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.app-subtitle {
    font-family: 'Righteous', 'Noto Sans TC', sans-serif;
    font-size: 0.9rem;
    opacity: 0.9;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 500;
}

.motto-area {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    position: relative;
    animation: fadeIn 0.8s ease-out 0.4s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.motto-line {
    width: 60px;
    height: 3px;
    background: white;
    margin: 0 auto 20px;
    border-radius: 2px;
}

.motto {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.6;
}

.motto-en {
    font-size: 0.85rem;
    opacity: 0.8;
    font-style: italic;
    font-weight: 400;
}

.features {
    display: flex;
    gap: 20px;
    justify-content: center;
    animation: fadeIn 0.8s ease-out 0.6s both;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.feature-item span {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

/* 右側表單區 */
.form-section {
    padding: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.form-container {
    width: 100%;
    max-width: 420px;
}

.form-title {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-family: 'Righteous', 'Noto Sans TC', sans-serif;
}

.form-subtitle {
    color: var(--text-gray);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

/* 訊息提示 */
.error-message,
.success-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.error-message {
    background: #fee;
    color: var(--error-color);
    border: 1px solid #fcc;
}

.success-message {
    background: #efe;
    color: var(--success-color);
    border: 1px solid #cec;
}

/* 表單樣式 */
.auth-form {
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 14px 16px 14px 46px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Noto Sans TC', sans-serif;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 4px rgba(0, 153, 176, 0.1);
}

/* ── .input-wrapper（用來包裹 input + icon + toggle） ── */
.input-wrapper {
    position: relative;
}

.input-wrapper input[type="text"],
.input-wrapper input[type="email"],
.input-wrapper input[type="password"] {
    width: 100%;
    padding: 14px 46px 14px 46px;
    /* 左右都留空間給icon和toggle */
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Noto Sans TC', sans-serif;
    transition: all 0.3s ease;
    background: white;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 4px rgba(0, 153, 176, 0.1);
}

/* Django 欄位錯誤（紅色）*/
.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-gray);
}

.form-hint.field-error {
    color: var(--error-color);
    font-weight: 500;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-gray);
    pointer-events: none;
}

.toggle-password {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: var(--primary-color);
}

/* 表單選項 */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    font-size: 0.9rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked+.checkbox-custom {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

.checkbox-label input[type="checkbox"]:checked+.checkbox-custom::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.forgot-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.forgot-link:hover {
    color: var(--primary-color);
}

/* 按鈕樣式 */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-family: 'Noto Sans TC', sans-serif;
}

.btn-primary::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;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 97, 112, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-loader {
    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;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 分隔線 */
.divider {
    display: flex;
    align-items: center;
    margin: 30px 0;
    color: var(--text-gray);
    font-size: 0.85rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    padding: 0 16px;
}

/* 社交登入 */
.social-login {
    margin-bottom: 24px;
}

.btn-social {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Noto Sans TC', sans-serif;
    transition: all 0.3s ease;
}

.btn-social:hover {
    border-color: var(--text-gray);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-google {
    color: #333;
}

/* 註冊連結 */
.signup-link {
    text-align: center;
    color: var(--text-gray);
    font-size: 0.9rem;
}

.signup-link a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
    transition: color 0.3s ease;
}

.signup-link a:hover {
    color: var(--primary-color);
}

/* 重新發送驗證信連結 */
.resend-verification {
    text-align: center;
    margin-top: 16px;
}

.resend-verification a {
    color: var(--text-gray);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.3s ease;
}

.resend-verification a:hover {
    color: var(--secondary-color);
}

/* 彈出視窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 16px;
    max-width: 450px;
    width: 90%;
    position: relative;
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-gray);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.modal-content h3 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 1.5rem;
}

.modal-content p {
    color: var(--text-gray);
    margin-bottom: 24px;
}

/* 響應式設計 */
@media (max-width: 968px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .info-section {
        padding: 40px 30px;
    }

    .features {
        flex-direction: column;
        gap: 12px;
    }

    .feature-item {
        flex-direction: row;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    body {
        padding: 10px;
    }

    .form-section {
        padding: 40px 30px;
    }

    .form-title {
        font-size: 1.75rem;
    }

    .app-title {
        font-size: 2rem;
    }
}