/* ==========================================================================
   1bit Unified Authentication (Login & Register) Stylesheet — 1bit Insight
   ========================================================================== */

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --text-primary: #0f172a;
    --text-heading: #0d1537;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-input: #dce3f0;
    --bg-card: #ffffff;

    /* Ba hợp phần (Three Core Components) */
    --manage-color: #9333ea;
    --manage-border: #b47cf0;
    --manage-bg: rgba(147, 51, 234, 0.09);

    --analytics-color: #2563eb;
    --analytics-border: #7cb8f7;
    --analytics-bg: rgba(37, 99, 235, 0.09);

    --insight-color: #059669;
    --insight-border: #6ee7b7;
    --insight-bg: rgba(5, 150, 105, 0.09);

    /* Nút hành động chính (Gradient) */
    --btn-gradient: linear-gradient(90deg, #b829e3 0%, #7c3aed 48%, #365cf5 100%);
    --btn-gradient-hover: linear-gradient(90deg, #a61fd0 0%, #6d28d9 48%, #254ce8 100%);
    --btn-shadow: 0 10px 24px -6px rgba(114, 59, 237, 0.45);
}

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

html, body {
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--text-primary);
    background-color: #f6f5ff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Pastel Mesh & Organic Wave Background ── */
body.onebit-auth-page {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 36px 20px 28px;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 8% 12%, rgba(226, 198, 255, 0.48) 0%, rgba(226, 198, 255, 0) 34%),
        radial-gradient(circle at 92% 14%, rgba(186, 208, 255, 0.55) 0%, rgba(186, 208, 255, 0) 36%),
        radial-gradient(circle at 14% 88%, rgba(214, 176, 255, 0.52) 0%, rgba(214, 176, 255, 0) 38%),
        radial-gradient(circle at 88% 85%, rgba(199, 215, 255, 0.48) 0%, rgba(199, 215, 255, 0) 40%),
        linear-gradient(135deg, #fbf9ff 0%, #f3f4ff 50%, #f8faff 100%);
}

.bg-decor {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-decor::before {
    content: '';
    position: absolute;
    left: -6%;
    bottom: -12%;
    width: 440px;
    height: 440px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(233, 206, 255, 0.55) 0%, rgba(196, 148, 255, 0.28) 100%);
    filter: blur(2px);
}

.bg-decor::after {
    content: '';
    position: absolute;
    right: -8%;
    top: -14%;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    background: linear-gradient(160deg, rgba(182, 205, 255, 0.52) 0%, rgba(210, 224, 255, 0.16) 100%);
    filter: blur(2px);
}

.bg-wave-left {
    position: absolute;
    left: -10%;
    bottom: -5%;
    width: 65%;
    height: 52%;
    border-top-right-radius: 100% 80%;
    background: linear-gradient(180deg, rgba(237, 223, 255, 0.35) 0%, rgba(224, 198, 255, 0.18) 100%);
}

.bg-wave-right {
    position: absolute;
    right: -12%;
    bottom: -10%;
    width: 58%;
    height: 46%;
    border-top-left-radius: 100% 90%;
    background: linear-gradient(180deg, rgba(212, 225, 255, 0.38) 0%, rgba(190, 208, 255, 0.22) 100%);
}

/* ── Main Wrapper ── */
.auth-stage {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 860px;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* ── Auth Card ── */
.auth-card {
    position: relative;
    width: 100%;
    max-width: 468px;
    background: var(--bg-card);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow:
        0 22px 54px -12px rgba(102, 85, 175, 0.13),
        0 4px 18px -2px rgba(15, 23, 42, 0.04);
    padding: 40px 38px 36px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.auth-card.auth-card-register {
    max-width: 540px;
}

/* ── Logo 1bit ── */
.auth-logo-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 14px;
}

.auth-logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.auth-logo-img {
    height: 46px;
    width: auto;
    object-fit: contain;
    display: block;
}

/* ── Tiêu đề trang (Đăng nhập / Đăng ký) ── */
.auth-heading {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-heading);
    letter-spacing: -0.025em;
    line-height: 1.25;
    margin-bottom: 18px;
}

/* ── Ba hợp phần Pills: Manage · Analytics · Insight ── */
.component-pills {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.component-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 106px;
    height: 35px;
    padding: 0 20px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    background: #ffffff;
    transition: all 0.18s ease;
    cursor: pointer;
    user-select: none;
}

/* Pill 1: Manage */
.component-pill.pill-manage {
    color: var(--manage-color);
    border: 1.25px solid var(--manage-border);
}
.component-pill.pill-manage:hover {
    background: var(--manage-bg);
}
.component-pill.pill-manage.active,
.component-pill.pill-manage:active {
    background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
    border-color: #7e22ce;
    color: #ffffff;
    box-shadow: 0 6px 16px -3px rgba(147, 51, 234, 0.42);
    font-weight: 700;
}

/* Pill 2: Analytics */
.component-pill.pill-analytics {
    color: var(--analytics-color);
    border: 1.25px solid var(--analytics-border);
}
.component-pill.pill-analytics:hover {
    background: var(--analytics-bg);
}
.component-pill.pill-analytics.active,
.component-pill.pill-analytics:active {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-color: #1d4ed8;
    color: #ffffff;
    box-shadow: 0 6px 16px -3px rgba(37, 99, 235, 0.42);
    font-weight: 700;
}

/* Pill 3: Insight */
.component-pill.pill-insight {
    color: var(--insight-color);
    border: 1.25px solid var(--insight-border);
}
.component-pill.pill-insight:hover {
    background: var(--insight-bg);
}
.component-pill.pill-insight.active,
.component-pill.pill-insight:active {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
    border-color: #047857;
    color: #ffffff;
    box-shadow: 0 6px 16px -3px rgba(5, 150, 105, 0.42);
    font-weight: 700;
}

/* ── Thông báo (Alert / Flash Message) ── */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    margin-bottom: 18px;
    line-height: 1.45;
}

.auth-alert svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    margin-top: 1px;
}

.auth-alert-error {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
}

.auth-alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
}

/* ── Form Controls ── */
.auth-form {
    text-align: left;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
}

.form-col-full {
    grid-column: 1 / -1;
}

.form-group {
    margin-bottom: 16px;
}

.form-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 7px;
}

.form-label {
    display: block;
    font-size: 13.5px;
    font-weight: 700;
    color: #1e293b;
}

.form-label .required {
    color: #ef4444;
    margin-left: 2px;
}

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

.input-icon-left {
    position: absolute;
    left: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    pointer-events: none;
}

.input-icon-left svg {
    width: 17px;
    height: 17px;
}

.form-control {
    width: 100%;
    height: 46px;
    padding: 0 42px 0 42px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text-primary);
    background: #ffffff;
    border: 1px solid var(--border-input);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form-control::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.form-control:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3.5px rgba(139, 92, 246, 0.12);
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    padding: 4px;
    color: #94a3b8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.15s ease;
}

.password-toggle-btn:hover {
    color: #475569;
}

.password-toggle-btn svg {
    width: 18px;
    height: 18px;
}

/* ── Nút Gradient Đăng nhập / Đăng ký ── */
.btn-gradient-primary {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 10px;
    background: var(--btn-gradient);
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: var(--btn-shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    margin-top: 4px;
}

.btn-gradient-primary:hover {
    background: var(--btn-gradient-hover);
    transform: translateY(-1px);
    box-shadow: 0 14px 28px -6px rgba(114, 59, 237, 0.55);
}

.btn-gradient-primary:active {
    transform: translateY(0);
}

/* ── Chân thẻ Card ── */
.card-subfooter {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.card-subfooter a {
    color: #6d28d9;
    font-weight: 600;
    text-decoration: none;
}

.card-subfooter a:hover {
    text-decoration: underline;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    body.onebit-auth-page {
        padding: 32px 14px 20px;
    }
    .auth-card,
    .auth-card.auth-card-register {
        padding: 30px 22px 28px;
    }
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
    .component-pill {
        min-width: 92px;
        padding: 0 14px;
        font-size: 12.5px;
    }
}

