: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, var(--primary-color) 0%, var(--secondary-color) 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;
}

.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: 1400px;
    z-index: 1;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    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: 40px;
    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.2rem;
    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.85rem;
    opacity: 0.9;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 500;
}

.motto-area {
    text-align: center;
    margin-bottom: 40px;
    padding: 25px 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.2rem;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.6;
}

.motto-en {
    font-size: 0.8rem;
    opacity: 0.8;
    font-style: italic;
}

.benefits {
    animation: fadeIn 0.8s ease-out 0.6s both;
}

.benefits-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    font-size: 0.95rem;
}

.benefit-icon {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: bold;
}

/* ============ 右側表單區 ============ */
.form-section {
    padding: 60px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: white;
    max-height: 95vh;
    overflow-y: auto;
}

/* 自訂滾動條 */
.form-section::-webkit-scrollbar {
    width: 8px;
}

.form-section::-webkit-scrollbar-track {
    background: var(--bg-light);
}

.form-section::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

.form-container {
    width: 100%;
    max-width: 550px;
    margin: 0 auto;
}

.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-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 30px 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary-color);
}

.form-section-title:first-child {
    margin-top: 0;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.form-group {
    flex: 1;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.9rem;
}

.required {
    color: var(--error-color);
}

/* ── <input> 樣式（適用於 Django 渲染的 {{ form.x }} ） ── */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: 'Noto Sans TC', sans-serif;
    transition: all 0.3s ease;
    background: white;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 4px rgba(0, 153, 176, 0.1);
}

/* ── 提示文字 ── */
.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-gray);
}

/* Django 後端驗證錯誤（紅色）*/
.form-hint.field-error {
    color: var(--error-color);
    font-weight: 500;
}

/* ── input-wrapper（包裹 input + toggle 按鈕） ── */
.input-wrapper {
    position: relative;
}

.input-wrapper input[type="password"],
.input-wrapper input[type="text"] {
    /* 確保 input 裡面也套用上面的樣式（某些 Django render 會套在這個 div 內）*/
    width: 100%;
    padding: 14px 44px 14px 16px;
    /* 右邊留空給開關鈕 */
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.95rem;
    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);
}

/* 密碼開關鈕 */
.toggle-password {
    position: absolute;
    right: 4px;
    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);
}

/* ── 密碼強度指示器 ── */
.password-strength {
    margin-top: 8px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-bar.weak {
    width: 33%;
    background: #ef4444;
}

.strength-bar.medium {
    width: 66%;
    background: #f59e0b;
}

.strength-bar.strong {
    width: 100%;
    background: #10b981;
}

/* ── Checkbox ── */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 0.9rem;
    line-height: 1.6;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-top: 2px;
}

.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;
}

.checkbox-label a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
}

.checkbox-label a: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;
    margin-top: 10px;
}

.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;
    text-decoration: none;
    /* <a> 也用這個 class 所以要加 */
    color: #333;
}

.btn-social:hover {
    border-color: var(--text-gray);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ── 登入連結 ── */
.signin-link {
    text-align: center;
    color: var(--text-gray);
    font-size: 0.9rem;
}

.signin-link a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
    transition: color 0.3s ease;
}

.signin-link a:hover {
    color: var(--primary-color);
}

/* ============ 響應式 ============ */
@media (max-width: 968px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .info-section {
        padding: 40px 30px;
    }

    .form-section {
        max-height: none;
    }
}

@media (max-width: 640px) {
    body {
        padding: 10px;
    }

    .form-section {
        padding: 30px 20px;
    }

    .form-title {
        font-size: 1.75rem;
    }

    .form-row {
        flex-direction: column;
        gap: 20px;
    }

    .app-title {
        font-size: 1.8rem;
    }
}