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

/* ================================================================
   SECTION 1: CSS VARIABLES (used by all pages)
   ================================================================ */
:root {
    --font-main: 'Inter', sans-serif;
    --color-primary: #0f172a;
    --color-secondary: #64748b;
    --color-accent: #3b82f6;
    --bg-body:
        radial-gradient(circle at top right, rgba(248, 252, 255, 0.22), transparent 34%),
        linear-gradient(135deg, #f9fcff 0%, #ffffff 52%, #f9fcff 100%);
    --bg-surface: #ffffff;
    --radius-pill: 50rem;
    --radius-card: 1rem;
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.05);
}

/* ================================================================
   SECTION 2: BASE ELEMENTS (used by all 12 pages)
   ================================================================ */
html {
    scroll-behavior: auto;
}

* {
    scroll-behavior: auto !important;
}

body {
    font-family: var(--font-main);
    background: var(--bg-body);
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
    color: var(--color-primary);
    overflow-x: hidden;
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
}

body.auth-gradient-page {
    background:
        radial-gradient(ellipse at 82% 7%,
            rgba(147, 197, 253, 0.20) 0%,
            rgba(219, 234, 254, 0.10) 32%,
            transparent 58%
        ),
        radial-gradient(ellipse at 14% 16%,
            rgba(224, 242, 254, 0.32) 0%,
            rgba(239, 246, 255, 0.15) 34%,
            transparent 62%
        ),
        radial-gradient(ellipse at 66% 34%,
            rgba(191, 219, 254, 0.16) 0%,
            rgba(239, 246, 255, 0.10) 30%,
            transparent 58%
        ),
        radial-gradient(ellipse at 88% 72%,
            rgba(186, 230, 253, 0.18) 0%,
            rgba(224, 242, 254, 0.09) 34%,
            transparent 64%
        ),
        radial-gradient(ellipse at 18% 86%,
            rgba(191, 219, 254, 0.18) 0%,
            rgba(239, 246, 255, 0.12) 36%,
            transparent 66%
        ),
        radial-gradient(ellipse at 48% 92%,
            rgba(224, 242, 254, 0.14) 0%,
            rgba(255, 255, 255, 0.30) 38%,
            transparent 68%
        ),
        linear-gradient(135deg, #ffffff 0%, #ffffff 42%, #f8fbff 100%) !important;

    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
}
@media (max-width: 575.98px) {
    body.auth-gradient-page {
        background:
            radial-gradient(ellipse at 88% 5%,
                rgba(147, 197, 253, 0.18) 0%,
                rgba(219, 234, 254, 0.10) 34%,
                transparent 62%
            ),
            radial-gradient(ellipse at 8% 20%,
                rgba(224, 242, 254, 0.30) 0%,
                rgba(239, 246, 255, 0.15) 36%,
                transparent 66%
            ),
            radial-gradient(ellipse at 76% 58%,
                rgba(186, 230, 253, 0.16) 0%,
                rgba(224, 242, 254, 0.09) 36%,
                transparent 66%
            ),
            radial-gradient(ellipse at 18% 92%,
                rgba(191, 219, 254, 0.17) 0%,
                rgba(239, 246, 255, 0.12) 38%,
                transparent 68%
            ),
            linear-gradient(135deg, #ffffff 0%, #ffffff 48%, #f8fbff 100%) !important;

        background-attachment: scroll;
        background-repeat: no-repeat;
        background-size: cover;
    }
}

body > main {
    flex: 1;
}

body > footer {
    flex-shrink: 0;
}

/* ================================================================
   SECTION 3: NAVIGATION (used by all 12 pages via base.html)
   ================================================================ */
header.sticky-top {
    z-index: 1030 !important;          /* выше любых других элементов */
    background: transparent !important; /* чтобы фон управлялся через .navbar-floating */
    pointer-events: auto;              /* сохраняем кликабельность */
}

.navbar-floating {
    background: rgba(255, 255, 255, 0.96); /* почти сплошной белый */
    backdrop-filter: blur(8px);            /* лёгкое размытие, но подложка не видна */
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border-radius: 60px !important;
    padding: 0.4rem 1rem;
    min-height: 50px;
    transition: all 0.3s ease;
}

/* Preserve oval shape when menu is open */
.navbar-collapse.show,
.navbar-collapse.collapsing {
    border-radius: 60px !important;
}

@media (max-width: 991.98px) {
    .navbar-collapse {
        padding: 1rem 0;
    }

    #navContent.show,
    #navContent.collapsing {
        padding-bottom: 1.5rem;
    }
}

@media (min-width: 992px) {
    .navbar-floating .container-fluid {
        flex-wrap: nowrap;
        gap: 0.4rem;
    }

    .navbar-brand,
    .navbar-floating .d-lg-flex {
        flex: 0 0 auto;
    }

    #navContent {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: flex-end;
        padding-right: 0.25cm;
    }

    .base-nav-list {
        flex-wrap: nowrap;
        justify-content: center;
    }

    .base-nav-list .nav-link {
        white-space: nowrap;
        padding-left: 0.35rem;
        padding-right: 0.35rem;
        font-size: 0.86rem;
    }
}

.navbar-brand {
    font-size: 1.1rem;
}

.navbar-toggler:focus,
.navbar-toggler:focus-visible {
    outline: none;
    box-shadow: none;
}

.nav-link {
    font-size: 0.9rem;
}

/* ================================================================
   SECTION 4: BUTTONS (used by all 12 pages)
   ================================================================ */
.btn-pill {
    border-radius: var(--radius-pill);
    padding: 0.6rem 1.5rem;
    font-weight: 600;
}

.btn-primary-custom {
    background-color: var(--color-primary);
    color: white;
    border: none;
}

.btn-primary-custom:hover {
    background-color: var(--color-accent);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* ================================================================
   SECTION 5: CARDS (used by 4 pages: dashboard, profile, pay, 404)
   ================================================================ */
.card-hover {
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-card);
    background: var(--bg-surface);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
    border-color: var(--color-accent);
}

/* ================================================================
   SECTION 6: TYPOGRAPHY (used by 2 pages: landing, 404)
   ================================================================ */
.display-title {
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--color-primary);
}

.text-gradient {
    background: linear-gradient(135deg, #2563eb 0%, #9333ea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ================================================================
   SECTION 7: AUTH COMPONENTS (used by 5-6 pages)
   ================================================================ */
.auth-card {
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
}

.auth-bg-side {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    padding: 2rem;
}

.auth-bg-side::before {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 50%;
    top: -50px;
    right: -50px;
    filter: blur(40px);
}

.auth-bg-side::after {
    content: '';
    position: absolute;
    width: 120px;
    height: 120px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 50%;
    top: -30px;
    left: -30px;
    filter: blur(30px);
}

.login-choice-card {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.login-choice-card:hover {
    border-color: #3b82f6;
}

/* ================================================================
   SECTION 8: HERO (used by 1 page: landing)
   ================================================================ */
/* .hero-section {
    position: relative;
    padding: 3rem 0 5rem;
    background: radial-gradient(circle at top right, #e0f2fe 0%, transparent 40%);
} */
 .hero-section {
    min-height: 100vh;
    padding-top: 7rem;
    padding-bottom: 5rem;
    background: transparent;
}

/* ================================================================
   SECTION 9: SHARED FORM ELEMENTS (used by 2 pages: profile, dashboard)
   ================================================================ */
.interest-checkbox-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.interest-checkbox-card:hover {
    border-color: var(--color-accent);
    background: #eff6ff;
}

.interest-checkbox-card input:checked + span {
    color: var(--color-accent);
    font-weight: 700;
}

/* ================================================================
   SECTION 10: UTILITIES
   ================================================================ */
.min-vh-80 {
    min-height: 80vh;
}

.min-vh-70 {
    min-height: 70vh;
}

.mx-w-600 {
    max-width: 600px;
}

.cursor-pointer {
    cursor: pointer;
}

.auth-centered-main {
    flex: 0 0 auto;
    min-height: auto;

    display: flex;
    align-items: flex-start;
}

.auth-centered-main > .login-choice-page {
    width: 100%;
    transform: none;
}

.login-choice-page {
    width: 100%;
    padding: 1.5rem 0 2.5rem;
}

/* Десктоп: footer ниже первого экрана, блок визуально по центру */
@media (min-width: 992px) {
    .auth-centered-main {
        min-height: 100vh;
        align-items: center;
    }

    .auth-centered-main > .login-choice-page {
        transform: translateY(-1.8rem);
    }

    .login-choice-page {
        padding: 2rem 0 2.5rem;
    }
}


.login-choice-shell {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
}

.login-choice-header {
    margin-bottom: 2rem;
}

.login-school-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;

    padding: 0.45rem 0.9rem;
    margin-bottom: 1.25rem;

    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.28);

    color: #2563eb;
    font-size: 1.05rem;
    font-weight: 700;

    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
    backdrop-filter: blur(10px);
}

.login-choice-title {
    margin-bottom: 0.75rem;

    font-size: clamp(2.1rem, 4vw, 3.2rem);
    line-height: 1.05;
    letter-spacing: -0.045em;
    font-weight: 800;

    color: #0f172a;
}

.login-choice-subtitle {
    max-width: 620px;
    margin: 0 auto;

    color: #64748b;
    font-size: 1.05rem;
    line-height: 1.65;
}

.login-choice-card-main {
    padding: 1rem;

    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 28px;

    box-shadow:
        0 24px 70px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);

    backdrop-filter: blur(14px);
}

.login-method-card {
    display: flex;
    align-items: center;
    gap: 1.1rem;

    padding: 1.25rem;
    border-radius: 22px;

    text-decoration: none;
    color: inherit;

    background: #ffffff;
    border: 1px solid #e2e8f0;

    transition:
        transform 0.16s ease,
        border-color 0.16s ease,
        box-shadow 0.16s ease,
        background 0.16s ease;
}

.login-method-card + .login-method-card {
    margin-top: 0.85rem;
}

.login-method-card:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.38);
    background: #f8fbff;
    box-shadow: 0 14px 34px rgba(37, 99, 235, 0.10);
}

.login-method-icon {
    width: 58px;
    height: 58px;
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 18px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #2563eb;

    font-size: 1.55rem;
}

.login-method-content {
    flex: 1;
    min-width: 0;
}

.login-method-content h3 {
    margin: 0 0 0.25rem;

    color: #0f172a;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.login-method-content p {
    margin: 0;

    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.45;
}

.login-method-arrow {
    flex-shrink: 0;
    color: #94a3b8;
    font-size: 1.35rem;
    transition: transform 0.16s ease, color 0.16s ease;
}

.login-method-card:hover .login-method-arrow {
    transform: translateX(3px);
    color: #2563eb;
}

.login-choice-note {
    max-width: 560px;
    margin: 1.3rem auto 0;

    color: #64748b;
    font-size: 0.92rem;
    line-height: 1.55;
}

@media (max-width: 575.98px) {

    .auth-centered-main {
        min-height: auto;
        align-items: flex-start;
    }

    .auth-centered-main > .login-choice-page {
        transform: none;
    }

    .login-choice-page {
        padding: 1.25rem 0 2.5rem;
    }

    .login-choice-card-main {
        padding: 0.75rem;
        border-radius: 24px;
    }

    .login-method-card {
        padding: 1rem;
        align-items: flex-start;
    }

    .login-method-icon {
        width: 50px;
        height: 50px;
        border-radius: 16px;
        font-size: 1.35rem;
    }

    .login-method-arrow {
        display: none;
    }
}

.footer-authors {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.15rem 0.28rem;
}

.footer-authors span {
    white-space: nowrap;
}

.footer-authors span:not(:last-child)::after {
    content: ",";
}

@media (max-width: 575.98px) {
    footer {
        padding-top: 1rem !important;
        padding-bottom: 0.75rem !important;
    }

    .footer-authors-block {
        margin-bottom: 0 !important;
    }

    .footer-authors {
        line-height: 1.45;
        justify-content: center;
    }

    footer .container,
    footer .row {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
}

@media (max-width: 575.98px) {
    body.auth-gradient-page .auth-centered-main {
        flex: 0 0 auto;

        /* fallback */
        min-height: calc(100vh - 86px);

        /* нормальный mobile viewport */
        min-height: calc(100svh - 86px);

        display: flex;
        align-items: center;
    }

    body.auth-gradient-page .auth-centered-main > .login-choice-page {
        width: 100%;
        transform: none;
    }

    body.auth-gradient-page .login-choice-page {
        padding: 1rem 0 2rem;
    }
}

/* ================================================================
   AUTH INLINE FORMS ON CHOOSE PAGE
   ================================================================ */

button.login-method-card {
    width: 100%;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

/* Отступ между двумя основными кнопками.
   Старый .login-method-card + .login-method-card больше не работает,
   потому что между кнопками теперь находится .auth-inline-panel. */
.auth-inline-panel + button.login-method-card {
    margin-top: 0.85rem;
}

.login-method-card.is-active {
    border-color: rgba(59, 130, 246, 0.55);
    background: #f8fbff;
    box-shadow: 0 14px 34px rgba(37, 99, 235, 0.10);
}

.login-method-card.is-active .login-method-arrow {
    transform: rotate(90deg);
    color: #2563eb;
}

/* Панель без transform и blur, чтобы не было эффекта "смазанной камеры" */
.auth-inline-panel {
    max-height: 0;
    overflow: hidden;

    opacity: 0;
    margin: 0;

    transition:
        max-height 0.28s ease,
        opacity 0.18s ease,
        margin 0.18s ease;
}

.auth-inline-panel.is-open {
    max-height: 720px;
    opacity: 1;
    margin: 0.85rem 0 1rem;
}

.auth-inline-card {
    padding: 1.2rem;
    border-radius: 22px;

    background:
        radial-gradient(ellipse at 50% 18%,
            rgba(219, 234, 254, 0.16) 0%,
            rgba(255, 255, 255, 0.34) 42%,
            transparent 72%
        ),
        radial-gradient(ellipse at 18% 84%,
            rgba(224, 242, 254, 0.10) 0%,
            transparent 58%
        ),
        radial-gradient(ellipse at 86% 78%,
            rgba(219, 234, 254, 0.09) 0%,
            transparent 56%
        ),
        linear-gradient(135deg,
            rgba(255, 255, 255, 0.97) 0%,
            rgba(248, 251, 255, 0.96) 48%,
            rgba(255, 255, 255, 0.98) 100%
        );

    border: 1px solid rgba(219, 234, 254, 0.72);

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.98),
        0 12px 30px rgba(15, 23, 42, 0.04);
}

.auth-inline-card .form-control {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.98)) !important;

    border: 1px solid rgba(203, 213, 225, 0.72) !important;
    color: #0f172a;

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        0 4px 14px rgba(15, 23, 42, 0.025);

    transition:
        border-color 0.16s ease,
        box-shadow 0.16s ease,
        background 0.16s ease;
}

.auth-inline-card .form-control::placeholder {
    color: #94a3b8;
}

.auth-inline-card .form-control:focus {
    background: #ffffff !important;
    border-color: rgba(59, 130, 246, 0.58) !important;

    box-shadow:
        0 0 0 0.2rem rgba(59, 130, 246, 0.10),
        0 8px 20px rgba(15, 23, 42, 0.04) !important;
}

/* Заголовок внутри раскрытой формы */
.auth-inline-heading {
    margin-bottom: 1rem;
}

.auth-inline-heading h4 {
    margin: 0 0 0.25rem;

    color: #0f172a;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.auth-inline-heading p {
    margin: 0;

    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.45;
}

/* Ошибки и сообщения */
.auth-panel-error {
    margin: 0 0 0.85rem;

    color: #dc2626;
    font-size: 0.875rem;
    font-weight: 600;
}

.auth-panel-success {
    margin: 0 0 0.85rem;

    color: #2563eb;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Переключение шага email/code внутри входа по коду */
.auth-code-step {
    display: none;
}

.auth-code-step.is-visible {
    display: block;
}

/* Поля кода */
.code-input-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;

    max-width: 310px;
    margin: 0 auto;
}

.code-digit-input {
    height: 58px;

    text-align: center;
    font-size: 1.45rem;
    font-weight: 800;

    border-radius: 16px !important;
    background:
        linear-gradient(135deg, #ffffff 0%, #f8fbff 100%) !important;

    border: 1px solid rgba(191, 219, 254, 0.82) !important;

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.98),
        0 5px 14px rgba(15, 23, 42, 0.035);
}

.code-digit-input:focus {
    border-color: rgba(59, 130, 246, 0.65) !important;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.12) !important;
}

/* Действия под кодом */
.auth-code-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.45rem 0.9rem;

    margin-top: 0.95rem;
}

.auth-link-button {
    padding: 0;
    border: 0;
    background: transparent;

    color: #2563eb;
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none;

    cursor: pointer;
}

.auth-link-button:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.auth-link-button:disabled,
.btn:disabled {
    cursor: wait;
    opacity: 0.72;
}

/* Mobile */
@media (max-width: 575.98px) {
    .auth-inline-panel + button.login-method-card {
        margin-top: 0.75rem;
    }

    .auth-inline-panel.is-open {
        max-height: 780px;
        margin: 0.75rem 0 0.9rem;
    }

    .auth-inline-card {
        padding: 0.95rem;
        border-radius: 20px;
    }

    .auth-inline-heading h4 {
        font-size: 1rem;
    }

    .auth-inline-heading p {
        font-size: 0.86rem;
    }

    .code-input-row {
        gap: 0.55rem;
        max-width: 280px;
    }

    .code-digit-input {
        height: 52px;
        font-size: 1.3rem;
        border-radius: 14px !important;
    }
}

.payment-history-filter {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr) auto;
    gap: 0.5rem;
    align-items: center;
}

.payment-history-filter-label {
    color: #475569;
    white-space: nowrap;
}

.payment-history-date {
    min-width: 0;
}

.payment-history-button {
    min-width: max-content;
}

@media (max-width: 575.98px) {
    .payment-history-filter {
        grid-template-columns: 1fr;
    }

    .payment-history-filter-label {
        margin-bottom: -0.25rem;
    }

    .payment-history-button {
        width: 100%;
    }
}

.payment-history-page {
    margin-top: 1.75rem;
}

.payment-history-back-button {
    background: #ffffff;
    color: #334155;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.055);
}

.payment-history-back-button:hover {
    background: #f8fafc;
    color: #0f172a;
    transform: translateY(-1px);
}

@media (max-width: 575.98px) {
    .payment-history-page {
        margin-top: 1rem;
    }

    .payment-history-back-button {
        width: 100%;
        justify-content: center;
    }
}
