@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
    --blue: #1a56db;
    --blue-dark: #1441b5;
    --blue-light: #3b82f6;
    --blue-pale: #eff4ff;
    --blue-glow: rgba(26, 86, 219, 0.22);

    --bg: #eef2f9;
    --bg-blob1: #cbd8f5;
    --bg-blob2: #dce7fb;

    /* Liquid glass card */
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-border: rgba(255, 255, 255, 0.85);
    --glass-shadow: rgba(26, 86, 219, 0.10);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --input-bg: rgba(255, 255, 255, 0.70);
    --input-border: rgba(148, 163, 184, 0.40);
    --input-focus: rgba(26, 86, 219, 0.18);

    --error: #dc2626;
    --error-bg: #fef2f2;
    --error-border: rgba(220, 38, 38, 0.2);
    --success: #059669;
    --success-bg: #ecfdf5;
    --success-border: rgba(5, 150, 105, 0.22);

    --radius-card: 24px;
    --radius-input: 11px;
    --radius-btn: 11px;
    --t: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html,
body {
    height: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    position: relative;
    overflow-x: hidden;
}

/* Soft background blobs give depth */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(80px);
    opacity: 0.75;
}

body::before {
    width: 560px;
    height: 560px;
    background: var(--bg-blob1);
    top: -140px;
    right: -120px;
}

body::after {
    width: 480px;
    height: 480px;
    background: var(--bg-blob2);
    bottom: -120px;
    left: -100px;
}

/* ─── Liquid Glass Card ─── */
.card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 430px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius-card);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.04),
        0 12px 40px -4px var(--glass-shadow),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    padding: 38px 34px 34px;
    animation: cardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(28px) scale(0.97);
    }

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

/* ─── Logo ─── */
.logo {
    text-align: center;
    margin-bottom: 26px;
}

.logo-img-wrapper {
    display: inline-block;
    width: 80px;
    height: 80px;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 13px;
    box-shadow:
        0 4px 16px var(--blue-glow),
        0 0 0 1px rgba(255, 255, 255, 0.9);
}

.logo-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.logo-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.logo-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 3px;
    font-weight: 400;
}

/* ─── Tabs ─── */
.tabs {
    display: flex;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 13px;
    padding: 4px;
    margin-bottom: 26px;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    padding: 9px 0;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--t);
}

.tab-btn.active {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 2px 10px var(--blue-glow);
}

.tab-btn:not(.active):hover {
    color: var(--text-secondary);
    background: rgba(148, 163, 184, 0.15);
}

/* ─── Panels ─── */
.panel {
    display: none;
}

.panel.active {
    display: block;
    animation: fadeSlide 0.28s ease both;
}

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

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

/* ─── Form ─── */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 7px;
    letter-spacing: 0.15px;
}

.input-wrapper {
    position: relative;
}

.field-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    stroke: var(--text-muted);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
    transition: stroke var(--t);
}

.input-wrapper input {
    width: 100%;
    padding: 11px 13px 11px 38px;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-input);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: var(--t);
    /* subtle inner glass sheen */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(255, 255, 255, 0.7) inset;
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-wrapper input:focus {
    border-color: var(--blue);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 0 0 3px var(--input-focus), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

.input-wrapper input:focus+.field-icon {
    stroke: var(--blue);
}

/* Password toggle */
.toggle-password {
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: color var(--t);
}

.toggle-password:hover {
    color: var(--text-secondary);
}

.toggle-password svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.input-wrapper input.has-toggle {
    padding-right: 40px;
}

/* ─── Forgot ─── */
.forgot-link {
    text-align: right;
    margin-top: -9px;
    margin-bottom: 17px;
}

.forgot-link a {
    font-size: 0.77rem;
    color: var(--blue);
    text-decoration: none;
    font-weight: 500;
}

.forgot-link a:hover {
    color: var(--blue-dark);
}

/* ─── Button ─── */
.btn-submit {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: var(--radius-btn);
    background: var(--blue);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.1px;
    box-shadow: 0 4px 16px var(--blue-glow), 0 1px 0 rgba(255, 255, 255, 0.15) inset;
    transition: var(--t);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
}

.btn-submit:hover {
    background: var(--blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(26, 86, 219, 0.3);
}

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

.btn-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    display: none;
    width: 17px;
    height: 17px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn-submit.loading .btn-spinner {
    display: block;
}

.btn-submit.loading .btn-text {
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ─── Alert ─── */
.alert {
    display: none;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 0.83rem;
    margin-bottom: 16px;
    font-weight: 500;
    align-items: flex-start;
    gap: 9px;
    line-height: 1.5;
    animation: alertIn 0.22s ease both;
}

@keyframes alertIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

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

.alert.error {
    display: flex;
    background: var(--error-bg);
    border: 1.5px solid var(--error-border);
    color: var(--error);
}

.alert.success {
    display: flex;
    background: var(--success-bg);
    border: 1.5px solid var(--success-border);
    color: var(--success);
}

.alert svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 1px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ─── Switch tab text ─── */
.switch-tab {
    text-align: center;
    margin-top: 20px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.switch-tab a {
    color: var(--blue);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.switch-tab a:hover {
    color: var(--blue-dark);
}

/* ─── Success State ─── */
.success-state {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.success-state.active {
    display: flex;
    animation: fadeSlide 0.4s ease both;
}

.success-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--success-bg);
    border: 2px solid var(--success-border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.success-icon svg {
    width: 32px;
    height: 32px;
    stroke: var(--success);
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.success-state h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.success-state p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.success-user-info {
    margin-top: 16px;
    background: rgba(148, 163, 184, 0.1);
    border: 1.5px solid rgba(148, 163, 184, 0.22);
    border-radius: 12px;
    padding: 13px 18px;
    width: 100%;
    text-align: left;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.success-user-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

.btn-logout {
    margin-top: 16px;
    padding: 9px 26px;
    border: 1.5px solid rgba(148, 163, 184, 0.35);
    border-radius: 9px;
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--t);
}

.btn-logout:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: var(--blue-pale);
}

/* ─── Divider (optional future use) ─── */
.divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(148, 163, 184, 0.3);
}

/* ─── Mobile ─── */
@media (max-width: 480px) {
    body {
        padding: 16px;
        align-items: flex-start;
        padding-top: 32px;
    }

    .card {
        padding: 28px 20px 26px;
        border-radius: 20px;
    }

    .logo-title {
        font-size: 1.25rem;
    }

    .logo-img-wrapper {
        width: 70px;
        height: 70px;
        border-radius: 17px;
    }
}