:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --text: #1f2937;
    --gray: #6b7280;
}

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

body {
    font-family: 'Prompt', sans-serif;
    background: var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    background: var(--card-bg);
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--gray);
    font-size: 0.9rem;
}

/* --- ส่วนจัดการแท็บ (Tabs) --- */
.tabs {
    display: flex;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e5e7eb;
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background: none;
    font-family: 'Prompt', sans-serif;
    font-size: 1rem;
    color: var(--gray);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* --- การซ่อน/แสดงฟอร์ม (สำคัญ!) --- */
.auth-form {
    display: none;
    /* ซ่อนปกติ */
}

.auth-form.active {
    display: block;
    /* แสดงเมื่อมี class active */
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- ฟอร์ม Input --- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: 'Prompt', sans-serif;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* --- จัดการปุ่ม OTP --- */
.email-group {
    display: flex;
    gap: 10px;
}

.btn-otp {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0 15px;
    cursor: pointer;
    font-family: 'Prompt', sans-serif;
    white-space: nowrap;
    transition: background 0.2s;
}

.btn-otp:hover {
    background: #5a6268;
}

.btn-otp:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* ช่อง OTP (ที่ซ่อนไว้) */
.otp-section {
    display: none;
    /* ซ่อนไว้ก่อน */
    background: #eff6ff;
    padding: 10px;
    border-radius: 8px;
    border: 1px dashed var(--primary);
}

.otp-section input {
    text-align: center;
    letter-spacing: 5px;
    font-weight: bold;
    font-size: 1.2rem;
    border: 2px solid var(--primary);
}

/* ปุ่มยืนยันใหญ่ */
.btn-submit {
    width: 100%;
    padding: 0.85rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Prompt', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 1rem;
}

.btn-submit:hover {
    background: var(--primary-hover);
}

/* --- Mobile Responsibility --- */
@media screen and (max-width: 480px) {
    .login-container {
        padding: 1.5rem;
        /* ลด padding */
        max-width: 90%;
        /* ให้เหลือขอบข้างๆ บ้าง */
        box-shadow: none;
        /* เอาเงาออกเพื่อให้ดู clean บนมือถือ */
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .form-group input {
        font-size: 1rem;
        /* ป้องกันการซูมของ iOS */
    }
}