/* =============================================
   AUTH MODAL CSS – The Code Munk  (Redesign)
   ============================================= */

/* ─── Overlay ─────────────────────────────── */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
}

.auth-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ─── Modal box ───────────────────────────── */
.auth-modal {
    background: #fff;
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    padding: 0;
    position: relative;
    transform: translateY(18px) scale(.97);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 24px 80px rgba(0,0,0,.16);
    overflow: hidden;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

.auth-overlay.active .auth-modal {
    transform: translateY(0) scale(1);
}

/* ─── Scrollable body ─────────────────────── */
.auth-modal-body {
    overflow-y: auto;
    padding: 0 28px 28px;
    flex: 1;
}

/* ─── Brand strip ─────────────────────────── */
.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 28px 0;
    margin-bottom: 20px;
}

.auth-brand-img {
    height: 34px;
    width: auto;
    filter: grayscale(100%) brightness(0);
}

/* ─── Close button ────────────────────────── */
.auth-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #888;
    transition: .15s;
    z-index: 2;
}

.auth-close:hover { background: #f5f5f5; color: #111; }

/* ─── View ────────────────────────────────── */
.auth-view { display: none; }
.auth-view.active { display: block; }

/* ─── View header ─────────────────────────── */
.auth-view-header {
    margin-bottom: 20px;
}

.auth-heading {
    font-size: 20px;
    font-weight: 800;
    color: #111;
    letter-spacing: -.4px;
    margin-bottom: 4px;
    line-height: 1.2;
}

.auth-subheading {
    font-size: 13px;
    color: #888;
    line-height: 1.5;
    margin: 0;
}

/* ─── Google button ───────────────────────── */
.auth-google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 11px 18px;
    border: 1.5px solid #e5e5e5;
    border-radius: 12px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
}

.auth-google-btn:hover { border-color: #bbb; background: #fafafa; }

.auth-google-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ─── Divider ─────────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
}

.auth-divider::before,
.auth-divider::after { content: ''; flex: 1; height: 1px; background: #ececec; }

.auth-divider span { font-size: 11px; color: #bbb; font-weight: 600; white-space: nowrap; letter-spacing: .5px; }

/* ─── Tab switcher ────────────────────────── */
.auth-tabs {
    display: flex;
    background: #f5f5f5;
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 18px;
    gap: 3px;
}

.auth-tab-btn {
    flex: 1;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    transition: .15s;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.auth-tab-btn i { font-size: 12px; }

.auth-tab-btn.active {
    background: #fff;
    color: #111;
    box-shadow: 0 1px 6px rgba(0,0,0,.08);
}

/* ─── Form group ──────────────────────────── */
.auth-form-group {
    margin-bottom: 13px;
    position: relative;
}

.auth-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #444;
    margin-bottom: 5px;
}

.auth-form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e8e8e8;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: #111;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    background: #fff;
}

.auth-form-group input:focus {
    border-color: #111;
    box-shadow: 0 0 0 3px rgba(0,0,0,.05);
}

.auth-form-group input::placeholder { color: #ccc; }
.auth-form-group input.error { border-color: #f87171; }

.auth-field-err {
    font-size: 11px;
    color: #ef4444;
    margin-top: 4px;
    display: none;
    font-weight: 500;
}

.auth-form-group.has-error .auth-field-err { display: block; }

/* ─── OTP boxes ───────────────────────────── */
.auth-otp-wrap {
    display: flex;
    gap: 6px;
}

.auth-otp-wrap input {
    flex: 1;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    padding: 10px 4px;
    border: 1.5px solid #e8e8e8;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    color: #111;
    outline: none;
    transition: border-color .15s;
    min-width: 0;
}

.auth-otp-wrap input:focus { border-color: #111; }

/* ─── Input + button ──────────────────────── */
.auth-input-btn-wrap { position: relative; }
.auth-input-btn-wrap input { padding-right: 90px; }

.auth-send-otp-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 12px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: .15s;
    white-space: nowrap;
}

.auth-send-otp-btn:hover { background: #333; }
.auth-send-otp-btn:disabled { background: #ccc; cursor: not-allowed; }

/* ─── Password toggle ─────────────────────── */
.auth-pw-wrap { position: relative; }
.auth-pw-wrap input { padding-right: 42px; }

.auth-pw-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #bbb;
    font-size: 15px;
    padding: 0;
    line-height: 1;
    transition: color .15s;
}

.auth-pw-toggle:hover { color: #555; }

/* ─── Submit button ───────────────────────── */
.auth-submit-btn {
    width: 100%;
    padding: 12px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: .18s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 2px;
}

.auth-submit-btn:hover:not(:disabled) {
    background: #222;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
}

.auth-submit-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }

.auth-btn-spin {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authSpin .7s linear infinite;
    display: none;
}

.auth-submit-btn.loading .auth-btn-spin { display: block; }
.auth-submit-btn.loading .auth-btn-label { display: none; }

@keyframes authSpin { to { transform: rotate(360deg); } }

/* ─── Timer ───────────────────────────────── */
.auth-otp-timer {
    font-size: 12px;
    color: #aaa;
    margin: 10px 0 12px;
    text-align: center;
}

.auth-otp-timer span { color: #111; font-weight: 600; }

/* ─── Links row ───────────────────────────── */
.auth-link-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
}

.auth-text-link {
    font-size: 12px;
    color: #888;
    cursor: pointer;
    text-decoration: none;
    transition: color .15s;
}

.auth-text-link:hover { color: #111; }
.auth-text-link.primary { color: #111; font-weight: 600; }

/* ─── Back button ─────────────────────────── */
.auth-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    padding: 0;
    margin-bottom: 14px;
    transition: color .15s;
}

.auth-back-btn:hover { color: #111; }

/* ─── Terms ───────────────────────────────── */
.auth-terms {
    font-size: 11px;
    color: #ccc;
    text-align: center;
    margin-top: 14px;
    line-height: 1.5;
}

.auth-terms a { color: #aaa; text-decoration: underline; }

/* ─── Success ─────────────────────────────── */
.auth-success {
    text-align: center;
    padding: 12px 0 8px;
}

.auth-success-icon {
    width: 56px;
    height: 56px;
    background: #f0fdf4;
    border: 1.5px solid #bbf7d0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 24px;
    color: #16a34a;
}

.auth-success h3 {
    font-size: 20px;
    font-weight: 800;
    color: #111;
    margin-bottom: 6px;
    letter-spacing: -.4px;
}

.auth-success p {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin: 0;
}

/* ─── Mobile ──────────────────────────────── */
@media (max-width: 480px) {

    .auth-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .auth-modal {
        border-radius: 20px 20px 0 0;
        max-width: 100%;
        max-height: 88vh;
        transform: translateY(30px);
    }

    .auth-overlay.active .auth-modal {
        transform: translateY(0);
    }

    .auth-brand { padding: 18px 20px 0; }
    .auth-modal-body { padding: 0 20px 24px; }

    .auth-heading { font-size: 18px; }
    .auth-subheading { font-size: 12px; }

    .auth-google-btn { font-size: 12px; padding: 10px 14px; }

    .auth-tab-btn { font-size: 11px; padding: 7px 6px; }
    .auth-tab-btn i { display: none; }

    .auth-form-group input { font-size: 13px; padding: 9px 12px; }
    .auth-form-group label { font-size: 11px; }

    .auth-otp-wrap input {
        font-size: 18px;
        padding: 9px 2px;
        border-radius: 8px;
    }

    .auth-otp-wrap { gap: 5px; }

    .auth-submit-btn { font-size: 13px; padding: 11px; border-radius: 10px; }

    .auth-send-otp-btn { font-size: 10px; padding: 5px 10px; }
    .auth-input-btn-wrap input { padding-right: 80px; }

    .auth-text-link { font-size: 11px; }
    .auth-back-btn { font-size: 11px; }
    .auth-terms { font-size: 10px; }
}
