/* ════════════════════════════════════════════════════════════
   AUTH MODAL SYSTEM — แปะต่อท้ายไฟล์ style.css
   Login / Register Modal + Navbar Button + Contact Form Lock
════════════════════════════════════════════════════════════ */

/* ── Navbar: AUTH Button ────────────────────────────────── */
.nav-pill--auth {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--green-dark);
    border: none;
    font-family: "Barlow Condensed", sans-serif;
}

.nav-pill--auth:hover {
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(0, 122, 51, 0.25);
}

/* สถานะ Logged-in: เปลี่ยนสีปุ่มเป็นส้ม */
.nav-pill--auth.is-logged-in {
    background: var(--orange);
}

.nav-pill--auth.is-logged-in:hover {
    background: #cc7000;
    box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.25);
}

/* ── Auth Modal Backdrop ────────────────────────────────── */
.auth-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-modal.active {
    display: flex;
}

.auth-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: authOverlayIn 0.2s ease forwards;
}

@keyframes authOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Auth Box ───────────────────────────────────────────── */
.auth-box {
    position: relative;
    z-index: 1;
    background: var(--white);
    border-radius: 20px;
    width: min(440px, 100%);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0,0,0,0.06);
    overflow: hidden;
    animation: authBoxIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes authBoxIn {
    from { opacity: 0; transform: scale(0.9) translateY(16px); }
    to   { opacity: 1; transform: scale(1)   translateY(0);    }
}

/* ── Auth Header ────────────────────────────────────────── */
.auth-box__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.5rem 0;
}

.auth-logo {
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 900;
    font-size: 1.3rem;
    color: var(--green);
    letter-spacing: 0.08em;
}

.auth-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    border-radius: 6px;
    transition: color var(--transition), background var(--transition);
    display: flex;
    align-items: center;
}

.auth-close:hover {
    color: var(--text-dark);
    background: var(--off-white);
}

/* ── Auth Tabs ──────────────────────────────────────────── */
.auth-tabs {
    display: flex;
    gap: 0;
    padding: 1rem 1.5rem 0;
    border-bottom: 2px solid var(--off-white);
    position: relative;
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    cursor: pointer;
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-light);
    padding: 0.6rem 0.5rem;
    position: relative;
    transition: color var(--transition);
}

.auth-tab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--green);
    transform: scaleX(0);
    transition: transform 0.25s ease;
    border-radius: 2px 2px 0 0;
}

.auth-tab--active {
    color: var(--green);
}

.auth-tab--active::after {
    transform: scaleX(1);
}

/* ── Auth Panels (Slider) ───────────────────────────────── */
.auth-panels {
    overflow: hidden;
    position: relative;
}

.auth-panel {
    padding: 1.5rem;
    display: none;
    animation: panelSlideIn 0.25s ease forwards;
}

.auth-panel--active {
    display: block;
}

@keyframes panelSlideIn {
    from { opacity: 0; transform: translateX(18px); }
    to   { opacity: 1; transform: translateX(0);    }
}

.auth-panel__title {
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 900;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    color: var(--text-dark);
    margin-bottom: 0.2rem;
    letter-spacing: 0.01em;
}

.auth-panel__sub {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 1.25rem;
}

/* ── Auth Form Fields ───────────────────────────────────── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.auth-field label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-icon {
    position: absolute;
    left: 0.9rem;
    width: 16px;
    height: 16px;
    color: var(--text-light);
    pointer-events: none;
    flex-shrink: 0;
}

.auth-input-wrap input {
    width: 100%;
    padding: 0.72rem 1rem 0.72rem 2.6rem;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    font-family: Barlow, Sarabun, sans-serif;
    font-size: 0.9rem;
    background: #fafafa;
    color: var(--text-dark);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.auth-input-wrap input:focus {
    border-color: var(--green);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 122, 51, 0.12);
}

.auth-input-wrap input.input-error {
    border-color: #e53e3e;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.12);
}

/* Show/hide password eye button */
.auth-eye {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color var(--transition);
}

.auth-eye:hover {
    color: var(--green);
}

/* ── Error Message ──────────────────────────────────────── */
.auth-error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    font-size: 0.83rem;
    color: #c53030;
    font-weight: 500;
}

/* ── Submit Button ──────────────────────────────────────── */
.auth-submit {
    background: var(--green);
    color: white;
    border: none;
    border-radius: 999px;
    padding: 0.82rem 1.5rem;
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    margin-top: 0.25rem;
}

.auth-submit:hover {
    background: var(--green-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 122, 51, 0.3);
}

.auth-submit:active {
    transform: translateY(0);
}

.auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ── Switch Link ────────────────────────────────────────── */
.auth-switch {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-light);
    padding-bottom: 0.25rem;
}

.auth-switch__link {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--green);
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color var(--transition);
}

.auth-switch__link:hover {
    color: var(--green-dark);
}

/* ── Contact Form: Locked State (Guest) ─────────────────── */
.contact-form--locked {
    position: relative;
}

.contact-form--locked::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.01);
    cursor: pointer;
    z-index: 2;
}

.contact-lock-notice {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #fffbeb;
    border: 1.5px solid #fde68a;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: #92400e;
    font-weight: 600;
    margin-bottom: var(--gap);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.contact-lock-notice:hover {
    background: #fef3c7;
    border-color: #f59e0b;
}

.contact-lock-notice svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #f59e0b;
}

/* ── Contact Form: Logged-in Auto-fill Fields ───────────── */
.auth-filled-field {
    position: relative;
}

.auth-filled-badge {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--green);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: "Barlow Condensed", sans-serif;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    pointer-events: none;
}

/* ── Logged-in User Badge on Navbar ────────────────────── */
.auth-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 700;
    letter-spacing: 0.04em;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 639px) {
    .auth-box {
        border-radius: 16px;
    }

    .auth-panel {
        padding: 1.25rem;
    }

    .nav-pill--auth {
        font-size: 0.8rem;
        padding: 0.5rem 0.9rem;
    }
}


/* ── Google Sign-In Button ───────────────────────────────── */
.auth-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid #dadce0;
    border-radius: 10px;
    background: #fff;
    color: #3c4043;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, box-shadow 0.18s, border-color 0.18s;
    margin-bottom: 0;
}

.auth-google-btn:hover {
    background: #f8f9fa;
    border-color: #bbb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.auth-google-btn:active {
    background: #f0f1f3;
}

/* ── Divider "หรือ" ─────────────────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    color: #9aa0a6;
    font-size: 0.82rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

/* ── Google badge ใน filled fields ──────────────────────── */
.auth-filled-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 99px;
    background: #e8f5e9;
    color: #2e7d32;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}
