/* Auth Modal Container */
#authModal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    padding: 16px;
}

#authModal.is-open {
    display: flex;
}

#authModal .auth-modal-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 32px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: authModalIn 0.2s ease-out;
}

@keyframes authModalIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Auth Modal Logo (inside body) */
#authModal .auth-logo {
    display: block;
    height: 30px;
    width: auto;
    margin: 0 auto;
}

/* Close button: absolute top-right of the card */
#authModal .auth-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: #526572;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

#authModal .auth-close-btn:hover {
    background: #F4F4F4;
    color: #1C1C1C;
}

/* Auth Modal Body */
#authModal .auth-modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 36px 40px;
}

@media (max-width: 768px) { 
    #authModal .auth-modal-body {
        padding: 30px 20px;
    }
}

/* Screens */
#authModal .auth-screen {
    display: none;
}

#authModal .auth-screen.is-active {
    display: block;
}

/* Welcome Screen */
#authModal .welcome-icon-wrap {
    display: flex;
    justify-content: center;
    margin: 28px 0 24px;
}

@media (max-width: 768px) { 
    #authModal .welcome-icon-wrap {
        margin: 24px 0 20px;
    }
}

#authModal .welcome-icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #F6F2E4;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #97740B;
}

#authModal .welcome-title {
    font-size: 30px;
    font-weight: 700;
    color: #082E42;
    text-align: center;
    line-height: 1.18;
    margin-bottom: 16px;
    letter-spacing: -0.75px;
}

@media (max-width: 768px) { 
    #authModal .welcome-title {
        font-size: 28px;
        letter-spacing: -0.675px;
    }
}

#authModal .welcome-subtitle {
    font-size: 16px;
    color: #526572;
    text-align: center;
    line-height: 1.6;
    margin-bottom: 32px;
}

@media (max-width: 768px) { 
    #authModal .welcome-subtitle {
        font-size: 14px;
    }
}

#authModal .welcome-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    width: 100%;
    padding: 14px 20px;
    background: #BE940A;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
    cursor: pointer;
    transition: background 0.2s;
}

#authModal .welcome-cta-btn:hover {
    background: #d39f02;
}

#authModal .welcome-signin-link {
    text-align: center;
    margin: 22px 0 28px;
    font-size: 14px;
    color: #526572;
    line-height: 1.7;
}

@media (max-width: 768px) { 
    #authModal .welcome-signin-link {
        font-size: 12px;
    }
}

#authModal .welcome-signin-link a {
    color: #082E42;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

#authModal .welcome-notnow {
    display: block;
    width: 100%;
    text-align: center;
    background: transparent;
    border-top: 1px solid #E2E7E8;
    color: #526572;
    font-size: 14px;
    text-decoration: underline;
    cursor: pointer;
    padding: 30px 20px 10px;
}

#authModal .welcome-notnow:hover {
    color: #1f2937;
}

/* Form Screen Common */
#authModal .form-title {
    font-size: 28px;
    font-weight: 700;
    color: #082E42;
    margin: 24px 0 10px;
    text-align: center;
    line-height: 1.2;
    letter-spacing: -0.7px;
}

@media (max-width: 768px) { 
    #authModal .form-title {
        margin: 20px 0 10px;
        font-size: 26px;
        letter-spacing: -0.625px;
    }
}

#authModal .form-switch-line {
    font-size: 14px;
    color: #526572;
    text-align: center;
    line-height: 1.5;
    margin-bottom: 30px;
}

#authModal .form-switch-line a {
    color: #082E42;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

#authModal .auth-field {
    margin-bottom: 16px;
}

#authModal .auth-field-label {
    display: block;
    font-size: 14px;
    color: #082E42;
    margin-bottom: 7px;
    line-height: 1.5;
}

#authModal .auth-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #B9C7CD;
    border-radius: 4px;
    font-size: 14px;
    color: #082E42;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

#authModal .auth-input:focus {
    outline: none;
    border-color: #B68A00;
}

#authModal .auth-input.has-error {
    border-color: #AD392E;
}

#authModal .auth-field-error {
    color: #AD392E;
    font-size: 12px;
    margin-top: 7px;
    line-height: 1.4;
    display: block;
}

#authModal .auth-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

#authModal .auth-password-wrap {
    position: relative;
}

#authModal .auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #082E42;
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
    padding: 4px 6px;
    text-decoration: underline;
}

#authModal .auth-password-toggle:hover {
    color: #1C1C1C;
}

#authModal .auth-link-row {
    display: flex;
    justify-content: flex-end;
    margin: -4px 0 14px;
}

#authModal .auth-link-row a {
    color: #082E42;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
}

#authModal .auth-checkbox-group {
    margin-bottom: 23px;
}

#authModal .auth-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: #082E42;
    margin-bottom: 14px;
    cursor: pointer;
    line-height: 1.5;
}

#authModal .auth-checkbox input {
    margin-top: 5px;
    accent-color: #B68A00;
    cursor: pointer;
}

#authModal .auth-checkbox a {
    text-decoration: underline;
}

#authModal .auth-submit-btn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    background: #927000;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
    cursor: pointer;
    transition: background 0.2s;
}

#authModal .auth-submit-btn:hover:not(:disabled) {
    background: #d39f02;
}

#authModal .auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#authModal .auth-footer-text {
    font-size: 12px;
    color: #526572;
    text-align: left;
    margin-top: 16px;
    line-height: 1.65;
}

#authModal .auth-footer-text a {
    text-decoration: underline;
}

/* Resend Screen */
#authModal .resend-banner {
    background: #FDF2E9;
    border: 1px solid #f9d5b4;
    border-radius: 6px;
    padding: 12px 14px;
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    align-items: flex-start;
}

#authModal .resend-banner-icon {
    color: #8B1538;
    flex-shrink: 0;
    margin-top: 2px;
}

#authModal .resend-banner-text {
    color: #8B1538;
    font-size: 13px;
    line-height: 1.45;
}

#authModal .resend-banner-text a {
    color: #8B1538;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
}

#authModal .resend-divider {
    border-top: 1px solid #e5e7eb;
    margin: 18px 0 12px;
}

#authModal .resend-alt-link {
    display: block;
    text-align: center;
    color: #082E42;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
}

/* Inline Toast (success/error) */
#authModal .auth-toast {
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 12px;
    display: none;
}

#authModal .auth-toast.is-show {
    display: block;
}

#authModal .auth-toast.toast-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

#authModal .auth-toast.toast-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Verification code section (register flow) */
#authModal .auth-verify-section {
    display: none;
    margin-bottom: 12px;
}

#authModal .auth-verify-section.is-show {
    display: block;
}

#authModal .auth-verify-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: stretch;
}

#authModal .auth-send-code-btn {
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #B68A00;
    color: #B68A00;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

#authModal .auth-send-code-btn:hover:not(:disabled) {
    background: #B68A00;
    color: #fff;
}

#authModal .auth-send-code-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Password rules (collapsible) */
#authModal .auth-password-rules {
    display: none;
    background: #F6F7F7;
    border: none;   
    padding: 10px 12px;
    margin-bottom: 17px;
    font-size: 12px;
    color: #526673;
    line-height: 1.45;
}

#authModal .auth-password-rules.is-show {
    display: block;
}

#authModal .auth-password-rules li {
    margin: 4px 0;
}

#authModal .auth-password-rules li.valid {
    display: none;
}

#authModal .auth-password-rules li.invalid {
    color: #b91c1c;
}