:root {
    --navy: #2d4068;
    --navy-dark: #1e2d4a;
    --bg-page: #edf0f5;
    --bg-card: #ffffff;
    --text: #2d4068;
    --muted: #7a8aaa;
    --border: #d0d8e8;
    --accent-tg: #0088cc;
    --success: #1e8449;
    --error: #c0392b;
}

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

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg-page);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 15% 50%, rgba(45, 64, 104, .06), transparent 50%);
    pointer-events: none;
}

.login-wrap {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100%;
    max-width: 1200px;
    min-height: 680px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 12px 60px rgba(45, 64, 104, .18), 0 4px 12px rgba(45, 64, 104, .12);
    margin: 40px;
    animation: fadeUp .5s ease both;
}

/* ═══ CHAP PANEL ═══ */
.brand-panel {
    width: 440px;
    flex-shrink: 0;
    background: var(--navy);
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    overflow: hidden;
}

.brand-panel::after {
    content: '';
    position: absolute;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .07);
    bottom: -80px;
    right: -80px;
    pointer-events: none;
}

/* ── Logo ── */
.brand-logo {
    display: flex;
    align-items: center;
    gap: 13px;
    animation: fadeRight .5s ease both .1s;
}

.logo-icon {
    width: 46px;
    height: 46px;
    background: rgba(0, 136, 204, .2);
    border: 2px solid rgba(0, 136, 204, .4);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #0088cc;
}

.logo-text .name {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
}

.logo-text .sub {
    font-size: 11px;
    color: rgba(255, 255, 255, .5);
    margin-top: 2px;
    letter-spacing: .4px;
}

/* ── Brand body ── */
.brand-body {
    animation: fadeRight .5s ease both .2s;
}

.brand-body h2 {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    line-height: 1.35;
    margin-bottom: 10px;
}

.brand-body p {
    font-size: 12.5px;
    color: rgba(255, 255, 255, .55);
    line-height: 1.7;
}

/* ═══ FEATURE GURUHLARI ═══ */
.feat-group {
    animation: fadeRight .5s ease both .3s;
}

.feat-group-title {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, .4);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.feat-item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 10px 13px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 10px;
    margin-bottom: 6px;
    transition: background .2s, border-color .2s;
}

.feat-item:hover {
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .12);
}

.feat-item > i {
    font-size: 13px;
    color: rgba(255, 255, 255, .85);
    width: 15px;
    text-align: center;
    margin-top: 2px;
    flex-shrink: 0;
}

.feat-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.feat-content strong {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, .88);
}

.feat-content span {
    font-size: 11px;
    color: rgba(255, 255, 255, .42);
    line-height: 1.4;
}

/* ═══ O'NG PANEL ═══ */
.form-panel {
    flex: 1;
    background: var(--bg-card);
    padding: 64px 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.form-head {
    margin-bottom: 30px;
    animation: fadeUp .5s ease both .1s;
}

.form-head h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 5px;
}

.form-head p {
    font-size: 13px;
    color: var(--muted);
}

/* ── Alerts ── */
.alert {
    border-radius: 10px;
    padding: 11px 15px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 9px;
    animation: fadeUp .4s ease both;
}

.alert-err {
    background: #fdecea;
    color: var(--error);
    border: 1px solid rgba(192, 57, 43, .2);
}

.alert-ok {
    background: #eafaf1;
    color: var(--success);
    border: 1px solid rgba(30, 132, 73, .2);
}

/* ── Telegram widget wrapper ── */
.tg-widget-wrap {
    padding: 20px;
    background: rgba(0, 136, 204, .04);
    border: 1.5px solid rgba(0, 136, 204, .16);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    animation: fadeUp .5s ease both .2s;
}

.tg-widget-hint {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-tg);
    display: flex;
    align-items: center;
    gap: 7px;
}

.tg-widget-hint i {
    font-size: 16px;
}

#telegram-login-container {
    display: flex;
    justify-content: center;
    min-height: 48px;
}

/* ── Back link ── */
.form-footer {
    margin-top: 22px;
    text-align: center;
    animation: fadeUp .5s ease both .35s;
}

.back-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color .2s;
}

.back-link:hover {
    color: var(--navy);
}

/* ── Language selector ── */
.lang-selector {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-bottom: 20px;
    animation: fadeUp .5s ease both .05s;
}

.lang-btn {
    padding: 6px 12px;
    background: rgba(45, 64, 104, .05);
    border: 1px solid rgba(45, 64, 104, .15);
    border-radius: 6px;
    font-family: 'Nunito', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: all .2s;
}

.lang-btn:hover {
    background: rgba(45, 64, 104, .1);
    border-color: rgba(45, 64, 104, .25);
    color: var(--text);
}

.lang-btn.active {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

/* ── Loading spinner ── */
.loading {
    display: none;
    padding: 16px;
    text-align: center;
    color: var(--accent-tg);
    font-size: 14px;
    animation: fadeUp .3s ease both;
}

.loading.active {
    display: block;
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 136, 204, .3);
    border-top-color: var(--accent-tg);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

/* ── Animations ── */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeRight {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .login-wrap {
        max-width: 1000px;
        min-height: 620px;
        margin: 32px;
        flex-direction: column;
    }

    .brand-panel {
        width: 100%;
        padding: 32px 28px;
        gap: 12px;
    }

    .form-panel {
        padding: 40px 32px;
    }

    .form-head h1 {
        font-size: 20px;
    }

    .form-head p {
        font-size: 12px;
    }

    .brand-body h2 {
        font-size: 18px;
    }

    .brand-body p {
        font-size: 12px;
    }
}

@media (max-width: 680px) {
    .brand-panel {
        display: none;
    }

    .form-panel {
        padding: 40px 28px;
    }

    .login-wrap {
        margin: 16px;
        min-height: auto;
        border-radius: 16px;
    }

    .lang-selector {
        flex-wrap: wrap;
    }

    .lang-btn {
        flex: 1;
        min-width: 60px;
    }

    .form-head {
        margin-bottom: 24px;
    }

    .form-head h1 {
        font-size: 18px;
    }

    .tg-widget-wrap {
        padding: 16px 12px;
    }
}
