:root {
    --primary-color: #5b7dbd;
    --secondary-color: #f8f9fa;
    --card-bg: #ffffff;
    --border-radius: 12px;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    --danger-color: #dc3545;
    --success-color: #4CAF50;
    --text-color: #333;
    --text-secondary: #4e4e4e;
    --border-color: #e2e8f0;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f7fa;
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent; /* для Chrome, Safari */
}

ul {
    list-style-type: none;
    padding-left: 0;
}

h2 {
    margin-top: 0;
}

.container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    flex: 1;
}

header {
    background-color: var(--secondary-color);
    padding: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-menu {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.header-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    padding: 8px 12px;
    border-radius: 6px;
}

.header-btn:hover {
    background: #f1f5f9;
}

.header-icon {
    width: 18px;
    height: 18px;
}

.logout-btn:hover {
    color: var(--danger-color);
}

.logo-header-icon {
    width: auto;
    height: 60px;
}

.top-nav {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    gap: 15px;
    flex-wrap: wrap;
}

.user-stats {
    display: flex;
    gap: 15px;
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    align-items: center;
}

.user-stats .icon {
    width: 18px;
    height: 18px;
    stroke: var(--primary-color);
    margin-right: 5px;
}

.token-balance, .user-rating {
    display: flex;
    align-items: center;
    background: #eef2ff;
    padding: 6px 12px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(91, 125, 189, 0.1);
    transition: all 0.2s;
}

.header-stat-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 16px;
}

.header-stat-card {
    display: flex;
    flex-direction: column;
    height: 52px;
    align-items: center;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(91, 125, 189, 0.1);
    border-radius: 12px;
    padding: 8px 14px;
    min-width: 70px;
    transition: transform 0.2s ease;
    white-space: nowrap;
}

.header-stat-icon svg {
    width: 16px;
    height: 16px;
    fill: #10b981;
}

.header-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #065f46;
    margin-bottom: 2px;
    line-height: 1;
}

.header-stat-label {
    font-size: 11px;
    color: #047857;
    line-height: 1;
}

.header-main-menu {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 25px;
}

.learn-button {
    position: relative;
    height: 60px;
    padding: 0 28px 0 28px;
    border-radius: 16px;
    background: linear-gradient(135deg, #ff4e50, #f9bc23);
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    color: #fff;
    font-weight: 600;
    font-size: 18px;
    transition: all 0.3s ease;
    cursor: pointer;
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    overflow: hidden;
    border: none;
}

.learn-button::after {
    content: "";
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: rgba(255, 255, 255, 0.25);
    transform: skewX(-25deg);
    transition: all 0.5s ease;
    z-index: 1;
}

.learn-button:hover::after {
    left: 150%;
}

.learn-button:hover {
    transform: translateY(-3px) scale(1.03);
}

.learn-button svg {
    flex-shrink: 0;
    transition: transform 0.3s ease;
    fill: #fff;
    z-index: 2;
}

.learn-button:hover svg {
    transform: scale(1.15);
}

.learn-button span {
    z-index: 2;
    position: relative;
}

.card {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.profile-card {
    position: relative;
}

.back-to {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background-color: #f1f5f9;
    border-radius: 6px;
    color: #334155;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.back-to:hover {
    background-color: #e2e8f0;
}

.back-to svg {
    width: 16px;
    height: 16px;
}

.back-to + h2 {
   width: calc(100% - 120px);
}

.btn {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: #f8f9fa;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-danger {
    background-color: var(--danger-color);
}

.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.message {
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
    position: relative;
}

.message-success {
    background: var(--success-color);
    color: white;
}

.message-achievement {
    background-color: #fff8e1;
    color: #5b441e;
    border-left: 5px solid #ffc107;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.message-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 5px solid #ffc107;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.message-error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 5px solid #f44336;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.message-info {
    background-color: #e3f2fd;
    color: #0d47a1;
    border-left: 5px solid #2196f3;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.message-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    margin-left: 15px;
}

.message-success .message-close {
    color: white;
}

.message-warning .message-close,
.message-info .message-close,
.message-achievement .message-close {
    color: #333;
}

.message-error .message-close {
    color: #840000;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 12px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.achievement-header {
    margin-bottom: 15px;
}

.achievement-body {
    margin-bottom: 20px;
}

.achievement-body img {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    display: block;
}

.rewards {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.footer-copyright {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.user-dropdown {
    position: relative;
    display: inline-block;
}

.profile-buttons-wrap {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
}

.profile-button {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0 0.4rem 1rem;
    height: 52px;
    border: none;
    cursor: pointer;
    background: none;
    color: var(--text-secondary);
    font-size: 14px;
    position: relative;
}

.avatar-point-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
}

.profile-button .avatar-point {
    width: 16px;
    height: 16px;
}

.profile-button:hover .avatar-point {
    width: 20px;
    height: 20px;
}

.profile-menu {
    display: none;
    position: absolute;
    top: 60px;
    right: 0;
    background-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
    z-index: 1000;
    min-width: 180px;
}

.profile-menu a {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    text-decoration: none;
    color: #334155;
    font-size: 14px;
}

.profile-menu a:hover {
    background-color: #f8fafc;
}

.logout-link {
    color: var(--danger-color);
}

.menu-divider {
    height: 1px;
    background-color: #e2e8f0;
    margin: 6px 0;
}

.course-header-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    line-height: 0;
}

.avatar-header-icon {
    height: 42px;
    width: 42px;
    border-radius: 50%;
    object-fit: cover;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes achievementPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(255, 215, 0, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0);
    }
}

.message-achievement {
    animation: slideIn 0.3s ease-out, achievementPulse 1.5s 0.3s;
}


.avatar-vip .avatar-src {
    outline: 2px solid #00d8d8;
    box-shadow: 0 0 12px rgba(0, 216, 216, 0.2);
    background: linear-gradient(135deg, #00f2fe, #4facfe);
    outline-offset: 4px;
    border-radius: 50%;
}

.avatar-premium .avatar-src {
    outline: 3px solid #ffb800;
    box-shadow: 0 0 12px rgba(255, 184, 0, 0.2);
    background: linear-gradient(135deg, #ffe066, #f4c430);
    outline-offset: 5px;
    border-radius: 50%;
}

.avatar-src .icon-avatar-st0 {
    fill: rgba(136, 136, 136, 0.67);
}

.avatar-vip .avatar-src .icon-avatar-st0 {
    fill: #00D8D8B2;
}

.avatar-premium .avatar-src .icon-avatar-st0 {
    fill: #FFB80099;
}


.nav-link {
    position: relative;
    display: inline-block;
}

.badge {
    position: absolute;
    top: 4px;
    right: -25px;
    background: red;
    color: white;
    font-size: 10px;
    font-weight: bold;
    border-radius: 20px;
    padding: 2px 4px;
    line-height: 1;
    min-width: 20px;
    text-align: center;
}

.avatar-wrap {
    position: relative;
    display: inline-flex;
}

.avatar-wrap.has-new-achievement::after {
    content: "";
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background-color: red;
    border-radius: 50%;
    border: 3px solid white;
}

.avatar-vip .avatar-wrap.has-new-achievement::after {
    top: -4px;
    right: -4px;
}

.avatar-premium .avatar-wrap.has-new-achievement::after {
    top: -5px;
    right: -5px;
}


/* === FOOTER (светлый) === */
.site-footer {
    background: #f9f9fb;
    color: #333;
    padding: 20px 0 0 0;
    font-size: 0.95rem;
    border-top: 1px solid #e5e5e5;
}

.footer-columns {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-tagline {
    margin-top: 0;
}

.footer-col {
    flex: 1;
    min-width: 240px;
}

.footer-col div a {
    margin-top: 0;
}

/* Лого */
.footer-logo {
    height: 50px;
}

/* --- Текстовые ссылки --- */
.footer-link {
    display: inline-block;
    color: #444;
    text-decoration: none;
    margin: 0.4rem 0;
    position: relative;
    transition: color 0.3s;
    padding-bottom: 3px;
}

.footer-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    background: #0077cc;
    transition: width 0.3s;
    border-bottom: 3px solid #0077cc;
}

.footer-link:hover {
    color: #0077cc;
}

.footer-link:hover::after {
    width: 60%;
}

/* --- Соцсети --- */
.footer-socials {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: hidden;
    padding: 0.6rem 1rem;
    border-left: 4px solid #0077cc;
    background: #fdfdfd;
}

.footer-heading {
    margin: 0 10px 0 0;
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
    text-wrap: nowrap;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none; /* точно убираем подчёркивание */
}

.social-link img {
    display: block;
    width: 42px;
    height: 42px;
    transition: transform 0.2s;
}

.social-link:hover img {
    opacity: 1;
    transform: scale(1.2);
}


/* Копирайт */
.footer-copy {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #777;
    border-top: 1px solid #e5e5e5;
    padding-top: 0.8rem;
}


/* === Нижняя навигация === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.bottom-nav a {
    flex: 1;
    text-align: center;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.bottom-nav a svg {
    width: 20px;
    height: 20px;
}

.bottom-nav a.active,
.bottom-nav a:hover {
    color: var(--primary-color);
}

.bottom-nav svg {
    height: 28px;
    width: 28px;
    stroke: currentColor;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 310px;
    background: var(--secondary-color);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Логотип в шапке */
.sidebar-header {
    background: var(--secondary-color); /* такой же фон, как у хедера */
    padding: 20px 20px 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color); /* лёгкая линия, как у хедера */
}

.sidebar-header img {
    margin-left: 10px;
    max-height: 42px;
    max-width: 180px;
}

/* Основные пункты */
.sidebar-menu {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
    padding: 20px 16px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 16px;
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}

.sidebar-menu a:not(.smaller):hover {
    background: rgba(0, 0, 0, 0.05);
}

.sidebar-menu a:hover {
    color: var(--primary-color);
}

.sidebar-menu a svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Нижние ссылки (из футера) */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
}

.sidebar-footer a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    margin: 6px 0;
    transition: color 0.2s;
}

.sidebar-footer a:hover {
    color: var(--primary-color);
}

/* Активное состояние */
.sidebar.active {
    transform: translateX(0);
}

.sidebar .footer-socials {
    border-left: 0;
}

.bottom-nav button.menu-toggle {
    flex: 1;
    text-align: center;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: color 0.2s;
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
}

.bottom-nav button.menu-toggle svg {
    width: 20px;
    height: 20px;
}

.bottom-nav button.menu-toggle:hover,
.bottom-nav button.menu-toggle:focus {
    color: var(--primary-color);
}


.bottom-nav a.go-link:first-child {
    position: relative;
    color: #fff;
}

.bottom-nav a.go-link:first-child::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background-color: #ff7f35;
    border-radius: 50%;
    z-index: -1;
}




.sidebar-stats {
    padding: 10px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.sidebar-stats .header-stat-value {
    font-size: 14px;
}

.sidebar-stats .header-stat-card {
    padding: 6px 12px;
    height: 48px;
}

/* Overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 1100;
  opacity: 0;
  transition: background 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}

.sidebar-overlay.active {
  background: rgba(0, 0, 0, 0.4);
  opacity: 1;
  pointer-events: all;
}

.sidebar-menu .smaller {
    display: flex;
    padding: 7px 12px;
    font-size: 14px;
}

.sidebar-menu a.smaller svg {
    width: 16px;
    height: 16px;
}

.bottom-nav-menu-btn {
    position: relative;
}

.bottom-nav-menu-btn.has-new-achievement::after {
    content: "";
    position: absolute;
    top: -2px;
    right: -6px;
    width: 6px;
    height: 6px;
    background-color: red;
    border-radius: 50%;
}









.go-button-link {
    position: relative;
    border-radius: 12px;
    background: linear-gradient(135deg, #ff4e50, #f9bc23);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    text-decoration: none;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    transition: transform 0.3s ease;
    cursor: pointer;
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    overflow: hidden;
}

.go-button-link::after {
    content: "";
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: rgba(255, 255, 255, 0.25);
    transform: skewX(-25deg);
    transition: all 0.5s ease;
}

.go-button-link:hover::after {
    left: 150%;
}

.go-button-link:hover {
    transform: translateY(-3px) scale(1.03);
}

.go-button-link svg {
    flex-shrink: 0;
    transition: transform 0.3s ease;
    fill: #fff;
    z-index: 2;
}

.ach-wrp {
    font-weight: 500;
    padding: 1px 8px 3px 8px;
    border-radius: 26px;
    background-color: #fff;
    color: #333;
    white-space: nowrap;
}

.message-link-ach {
    display: block;
    text-decoration: none;
    color: inherit;
}

.cta-login {
    padding: 7px 16px;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 500;
    color: #666b75;
    background: #f9fafb;
    text-decoration: none;
    border: 1px solid #e5e7eb;
    transition: background 0.15s ease, border-color 0.15s ease;
    letter-spacing: .7px;
}

.cta-login:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}



/* === Медиа-запросы === */
@media (max-width: 767.98px) {
    body {
        font-size: 14px; /* основной текст */
    }

    body.auth {
        padding-bottom: 60px;
    }

    body.auth header, body.auth footer {
        display: none;
    }

    .back-to:not(.all) {
        display: none;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    h4 {
        font-size: 1rem;
    }

    .top-bar {
        display: flex;
    }

    .bottom-nav {
        display: flex;
    }

    .container, .bottom-nav {
        min-width: 340px;
    }

    .message-container {
        max-width: 290px;
    }

    .logo-header-icon {
        height: 50px;
    }

    .footer-logo {
        height: 40px;
    }

    .footer-tagline {
        font-size: 0.9rem;
    }

    .footer-link {
        font-size: 0.9rem;
        margin-bottom: 0.2rem;

    }

    .footer-link::after {
        border-bottom: 0;
        transition: none;
    }

    .back-to + h2 {
       width: 100%;
    }

}

@media (max-width: 575.98px) {
    .container {
        padding: 10px;
    }

    .card {
        padding: 16px;
    }

    h1 {
        font-size: 1.3rem;
    }

    h2 {
        font-size: 1.1rem;
    }

    h3 {
        font-size: 0.9rem;
    }

    h4 {
        font-size: 0.8rem;
    }

}

/* Десктоп */
@media (min-width: 767.98px) {
    .bottom-nav, .sidebar-overlay, .sidebar, .sidebar-overlay.active {
        display: none; /* на десктопе их не показываем */
    }
}
