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

:root {
    --bg-a: #0f172a;
    --bg-b: #1d4ed8;
    --bg-c: #7c3aed;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --border: #d7e0ec;
    --primary-a: #3b82f6;
    --primary-b: #7c3aed;
    --success-a: #10b981;
    --success-b: #059669;
    --danger: #dc2626;
    --shadow: 0 24px 70px rgba(2, 10, 34, 0.38);
}

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

body.auth-page {
    min-height: 100vh;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 18%, rgba(56, 189, 248, 0.24), transparent 35%),
        radial-gradient(circle at 88% 10%, rgba(167, 139, 250, 0.28), transparent 37%),
        radial-gradient(circle at 50% 90%, rgba(45, 212, 191, 0.2), transparent 44%),
        linear-gradient(140deg, var(--bg-a) 0%, var(--bg-b) 56%, var(--bg-c) 100%);
    overflow-x: hidden;
}

.auth-wrapper {
    position: relative;
    background: var(--surface);
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
    width: min(980px, 100%);
    min-height: 680px;
    max-width: 100%;
}

.auth-form-box {
    position: absolute;
    top: 0;
    height: 100%;
    transition: all 0.6s ease-in-out;
}

.login-form-box {
    left: 0;
    width: 50%;
    z-index: 2;
}

.auth-wrapper.panel-active .login-form-box {
    transform: translateX(100%);
}

.register-form-box {
    left: 0;
    width: 50%;
    opacity: 0;
    z-index: 1;
}

.auth-wrapper.panel-active .register-form-box {
    transform: translateX(100%);
    opacity: 1;
    z-index: 5;
    animation: showPanel 0.6s;
}

@keyframes showPanel {
    0%, 49.99% {
        opacity: 0;
        z-index: 1;
    }

    50%, 100% {
        opacity: 1;
        z-index: 5;
    }
}

.auth-form-inner {
    height: 100%;
    overflow-y: auto;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    padding: clamp(20px, 2.8vw, 34px);
}

.auth-form-inner::-webkit-scrollbar {
    width: 6px;
}

.auth-form-inner::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #cbd5e1;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #334155;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.brand-link:hover {
    color: #2563eb;
}

.auth-title {
    font-size: clamp(28px, 2.2vw, 34px);
    line-height: 1.08;
    font-weight: 700;
    margin-bottom: 8px;
    color: #0b1324;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    font-size: 13px;
    line-height: 1.6;
    color: var(--muted);
    margin-bottom: 16px;
}

.error-box,
.alert-box {
    display: none;
    border-radius: 12px;
    padding: 11px 12px;
    font-size: 13px;
    margin-bottom: 12px;
}

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

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.form-group input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 11px 13px;
    font-size: 14px;
    color: #0f172a;
    background: rgba(255, 255, 255, 0.96);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
    transform: translateY(-1px);
}

.form-group input.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.input-error-text {
    display: none;
    color: var(--danger);
    font-size: 12px;
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 50px;
}

.password-toggle-btn {
    position: absolute;
    top: 50%;
    right: 7px;
    transform: translateY(-50%);
    border: 0;
    background: #eef2ff;
    color: #1e3a8a;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
}

.password-toggle-btn:hover {
    background: #dbeafe;
}

.btn {
    border: 0;
    border-radius: 13px;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

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

.btn:disabled,
.btn[disabled] {
    opacity: 0.68;
    cursor: not-allowed;
    transform: none;
}

.btn.wide {
    width: 100%;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(130deg, var(--primary-a), var(--primary-b));
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28);
}

.btn-success {
    color: #fff;
    background: linear-gradient(130deg, var(--success-a), var(--success-b));
    box-shadow: 0 10px 24px rgba(16, 185, 129, 0.24);
}

.btn-dark {
    color: #fff;
    background: #0f172a;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.24);
}

.btn-outline {
    color: #334155;
    background: #eef2f7;
    border: 1px solid #d5deeb;
}

.btn-link {
    border: 0;
    background: transparent;
    color: #2563eb;
    padding: 0;
    font-weight: 600;
    box-shadow: none;
}

.btn-link:hover {
    transform: none;
    text-decoration: underline;
}

.login-inline-links {
    margin-top: -2px;
    margin-bottom: 2px;
    text-align: right;
}

.btn-link-inline {
    font-size: 12px;
}

.auth-modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.56);
    backdrop-filter: blur(5px);
    z-index: 1400;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.auth-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.auth-modal-card {
    position: relative;
    width: min(460px, 100%);
    max-height: min(84vh, 760px);
    overflow-y: auto;
    border-radius: 16px;
    border: 1px solid #d6e1ee;
    padding: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
    transform: translateY(8px) scale(0.985);
    transition: transform 0.2s ease;
}

.auth-modal-overlay.active .auth-modal-card {
    transform: translateY(0) scale(1);
}

.auth-modal-card h3 {
    font-size: 20px;
    margin-bottom: 6px;
    color: #0b1324;
}

.auth-modal-card p {
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 10px;
}

.auth-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    color: #0f172a;
    background: #e2e8f0;
    font-size: 16px;
    font-weight: 700;
}

.auth-modal-close:hover {
    background: #cbd5e1;
}

.recovery-message {
    display: none;
    border-radius: 12px;
    padding: 10px 11px;
    font-size: 13px;
    margin-bottom: 10px;
}

.recovery-message.error {
    display: block;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
}

.recovery-message.success {
    display: block;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.auth-actions {
    display: grid;
    gap: 9px;
    margin-top: 12px;
}

.auth-links {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #dbe4ef;
    display: grid;
    gap: 6px;
    color: #64748b;
    font-size: 13px;
}

.auth-links a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.auth-links a:hover {
    text-decoration: underline;
}

.qr-section {
    display: none;
    margin-top: 12px;
    border: 1px solid #d6e1ee;
    border-radius: 14px;
    padding: 12px;
    background: #ffffff;
}

.qr-section h3 {
    font-size: 16px;
    margin-bottom: 6px;
}

.qr-section p {
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 10px;
}

.qr-box {
    min-height: 220px;
    border-radius: 12px;
    border: 1px dashed #c2d2e9;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #64748b;
    margin-bottom: 10px;
    padding: 8px;
}

.qr-box img {
    width: min(220px, 100%);
    height: auto;
    border-radius: 10px;
}

.qr-status {
    font-size: 13px;
    color: #334155;
    font-weight: 600;
    margin-bottom: 10px;
}

.tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 6px;
    border-radius: 13px;
    background: #e8eef8;
    margin-bottom: 12px;
}

.tab {
    border: 0;
    border-radius: 10px;
    padding: 9px 11px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    background: transparent;
    cursor: pointer;
}

.tab.active {
    background: #fff;
    color: #1d4ed8;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.14);
}

.form-panel {
    display: none;
}

.form-panel.active {
    display: block;
}

.telegram-options {
    display: grid;
    gap: 10px;
}

.option-card {
    width: 100%;
    border: 1px solid #d4dfed;
    border-radius: 13px;
    background: #f8fafc;
    text-align: left;
    padding: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.option-card:hover {
    transform: translateY(-2px);
    border-color: #93c5fd;
    box-shadow: 0 10px 24px rgba(59, 130, 246, 0.14);
}

.option-icon {
    font-size: 20px;
    margin-bottom: 6px;
}

.option-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 3px;
}

.option-desc {
    font-size: 13px;
    color: #64748b;
    line-height: 1.45;
}

.mobile-switch {
    margin-top: 12px;
    display: block;
    text-align: center;
    color: #64748b;
    font-size: 13px;
}

.mobile-switch .btn-link {
    margin-top: 4px;
}

.slide-panel-wrapper {
    position: absolute;
    top: 0;
    left: 50%;
    width: 50%;
    height: 100%;
    overflow: hidden;
    transition: transform 0.6s ease-in-out;
    z-index: 100;
}

.auth-wrapper.panel-active .slide-panel-wrapper {
    transform: translateX(-100%);
}

.slide-panel {
    background: linear-gradient(130deg, #1e3a8a 0%, #4338ca 52%, #7c3aed 100%);
    color: #fff;
    position: relative;
    left: -100%;
    height: 100%;
    width: 200%;
    transform: translateX(0);
    transition: transform 0.6s ease-in-out;
}

.auth-wrapper.panel-active .slide-panel {
    transform: translateX(50%);
}

.slide-panel::before,
.slide-panel::after {
    content: '';
    position: absolute;
    border-radius: 999px;
}

.slide-panel::before {
    width: 260px;
    height: 260px;
    right: -80px;
    top: -90px;
    background: rgba(255, 255, 255, 0.14);
}

.slide-panel::after {
    width: 220px;
    height: 220px;
    left: -70px;
    bottom: -70px;
    background: rgba(45, 212, 191, 0.2);
}

.panel-content {
    position: absolute;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    padding: clamp(24px, 3vw, 42px);
    text-align: left;
    top: 0;
    height: 100%;
    width: 50%;
    transform: translateX(0);
    transition: transform 0.6s ease-in-out;
    z-index: 1;
}

.panel-content-left {
    transform: translateX(-20%);
}

.auth-wrapper.panel-active .panel-content-left {
    transform: translateX(0);
}

.panel-content-right {
    right: 0;
}

.auth-wrapper.panel-active .panel-content-right {
    transform: translateX(20%);
}

.panel-kicker {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.9;
    margin-bottom: 14px;
}

.panel-content h2 {
    font-size: clamp(30px, 3.5vw, 40px);
    line-height: 1.05;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.panel-content p {
    font-size: 14px;
    line-height: 1.7;
    opacity: 0.95;
    margin-bottom: 18px;
}

.panel-list {
    list-style: none;
    display: grid;
    gap: 9px;
    margin-bottom: 20px;
    font-size: 13px;
}

.panel-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
}

.panel-list li::before {
    content: '•';
    font-size: 16px;
    line-height: 1;
    margin-top: 1px;
}

.btn-ghost {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.44);
    box-shadow: none;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.22);
}

@media (max-width: 860px) {
    body.auth-page {
        padding: 10px;
    }

    .auth-wrapper {
        min-height: auto;
        width: 100%;
        border-radius: 16px;
    }

    .auth-form-box {
        position: static !important;
        width: 100% !important;
        transform: none !important;
        opacity: 1 !important;
        height: auto;
    }

    .register-form-box {
        display: none;
    }

    .auth-wrapper.panel-active .register-form-box {
        display: block;
    }

    .auth-wrapper.panel-active .login-form-box {
        display: none;
    }

    .slide-panel-wrapper {
        display: none;
    }

    .auth-form-inner {
        height: auto;
        max-height: none;
        padding: 18px 14px;
    }

    .form-group input,
    .btn {
        font-size: 16px;
    }

    .tabs {
        margin-bottom: 10px;
    }
}
