:root {
    --color-cta-blue-light: #2563EB;
    --color-cta-blue-dark: #1D4ED8;
    --shadow-cta: 0 4px 6px rgba(37, 99, 235, 0.3);
    --shadow-cta-hover: 0 7px 14px rgba(37, 99, 235, 0.4);
    --gradient-cta: linear-gradient(to right, var(--color-cta-blue-light), var(--color-cta-blue-dark));
}

/* Импортируем переменные из header.css */

html,
body {
    box-sizing: border-box; /* Применяем box-sizing ко всему */
    overflow-x: hidden !important; /* Убираем горизонтальную прокрутку */
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f4f7f6; /* Фоновый цвет для демонстрации */
    /* overflow-x: hidden; */ /* Это правило теперь избыточно, так как оно применено к html и body */
}

.profile-inner {
    display: flex; /* Используем flexbox для управления сайдбаром и основным контентом */
    width: 100%;
}

/* Базовые стили для сайдбара (Десктоп) */
.sidebar-container {
    width: 300px;
    background-color: var(--color-bg-secondary);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 72px); /* Высота за вычетом высоты шапки */
    position: fixed;
    left: 0;
    top: 72px;
    overflow-y: auto;
    border-radius: var(--radius-lg);
    z-index: 999;
    transform: translateX(0);
    transition: transform 0.3s ease-in-out;
    padding-bottom: 1rem;
    border: 1px solid var(--color-border-subtle);
}

/* Стили для скрытого состояния меню на десктопе */
body.sidebar-hidden .sidebar-container {
    transform: translateX(-300px);
}

.sidebar-nav {
    flex-grow: 1;
    padding: 1rem;
}

.sidebar-nav a {
    display: block;
    margin-bottom: 0.75rem;
    text-decoration: none;
}

.sidebar-nav button {
    width: 100%;
    display: flex;
    justify-content: flex-start; /* Изменено с center на flex-start */
    align-items: center;
    padding: 0.8rem 1.2rem;
    background: var(--gradient-cta);
    color: #FFFFFF;
    font-weight: 600;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    margin-top: auto;
    box-shadow: var(--shadow-cta);
    position: relative;
    overflow: hidden;
    outline: none;
    font-size: 1rem;
}

.sidebar-nav button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.sidebar-nav button:focus {
    outline: none; /* Убираем стандартный фокус */
}

.sidebar-nav button i {
    margin-right: 0.75rem;
    width: 1.25rem;
    text-align: center;
    color: #FFFFFF; /* Иконки тоже белые */
}

.sidebar-nav button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-cta-hover);
}

.sidebar-nav button:hover::before {
    left: 100%;
}

.sidebar-nav button.active {
    background: linear-gradient(to right, #1a3a8a, #0f2352); /* Еще более темный градиент для активной кнопки */
    box-shadow: var(--shadow-cta-hover);
    transform: translateY(-3px);
    font-weight: 700;
}

/* Стили для блока с курсами (Десктоп) */
.rates-section {
    padding: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--color-border-subtle);
    text-align: left;
    font-size: 0.9rem;
    color: var(--color-text-medium);
}

.rates-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text-light);
}

.rate-item {
    margin-bottom: 0.3rem;
}

.rate-item strong {
    color: var(--color-accent-blue-light);
}

/* Стили для кнопки переключения меню (Десктоп) */
.sidebar-toggle {
    position: fixed;
    top: 72px;
    left: 0;
    width: 40px;
    background-color: var(--color-accent-blue-dark);
    color: var(--color-text-light);
    border: none;
    padding: 1rem 0.5rem;
    cursor: pointer;
    z-index: 1000;
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    transition: left 0.3s ease-in-out;
    outline: none;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    text-align: center;
    white-space: nowrap;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
}

body:not(.sidebar-hidden) .sidebar-toggle {
    left: 300px;
}

.sidebar-toggle:focus {
    outline: 2px solid var(--color-accent-blue-light);
    outline-offset: 2px;
}

.sidebar-toggle i {
    display: none; /* Скрыто на десктопе */
}

/* Стили для пользовательского тултипа, следующего за курсором */
.custom-tooltip {
    position: fixed;
    background-color: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    z-index: 1001;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-in-out;
    max-width: 250px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    top: 0;
    left: 0;
}

/* Основное содержимое */
.main-content {
    flex-grow: 1; /* Позволяет основному контенту занимать все доступное пространство */
    padding: 1.5rem; /* Базовый отступ */
    margin-left: 340px; /* Ширина сайдбара (300px) + ширина кнопки (40px) */
    transition: margin-left 0.3s ease-in-out;
    max-width: 100%;
    overflow-x: hidden; /* Защита от «выпрыгивания» внутренних элементов */
}

body.sidebar-hidden .main-content {
    margin-left: 55px; /* Ширина кнопки (40px) + небольшой отступ */
}

/* Мобильные стили (max-width: 768px) - Унифицированный блок */
@media (max-width: 768px) {
    .sidebar-container {
        display: none !important; /* Полностью скрываем десктопный сайдбар на мобильных */
    }

    .profile-inner {
        flex-direction: column; /* На мобильных располагаем элементы в столбец */
    }

    .sidebar-nav {
        flex-grow: 1 !important;
        padding: 0 !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-around !important;
        align-items: center !important;
        width: 100% !important;
        height: 100% !important;
    }

    .sidebar-nav a {
        flex: 1 1 0 !important;
        margin: 0 !important;
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
    }

    .sidebar-nav button {
        background: none !important;
        border: none !important;
        color: #FFFFFF !important;
        font-size: 1.7rem !important; /* Размер иконки */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        padding: 0 !important;
        font-weight: 400 !important;
    }

    .sidebar-nav button i {
        margin: 0 !important; /* Убираем отступы у иконок */
        width: auto !important;
        text-align: center !important;
    }

    /* Скрываем все текстовые подписи и лишние элементы */
    .sidebar-nav button span,
    .sidebar-nav button .sidebar-label,
    .sidebar-nav button .sidebar-text {
        display: none !important;
    }

    .sidebar-nav button.active {
        background: linear-gradient(to right, #1a3a8a, #0f2352) !important; /* Темный градиент для активной кнопки */
        color: #FFFFFF !important;
        border: none !important;
        box-shadow: var(--shadow-cta-hover) !important;
        transform: translateY(-3px) !important;
        font-weight: 700 !important;
    }

    /* Скрываем блок с курсами валют */
    .rates-section {
        display: none !important;
    }

    /* Скрываем десктопную кнопку-переключатель сайдбара */
    .sidebar-toggle {
        display: none !important;
    }

    /* Добавляем отступ снизу у тела страницы, чтобы контент не перекрывался нижней панелью */
    body {
        padding-bottom: 60px !important;
    }

    /* Скрываем desktop-only классы, если они вдруг появятся в мобильной версии */
    .desktop-only {
        display: none !important;
    }

    /* Отменяем main-content padding-left на мобильных */
    .main-content {
        margin-left: 0 !important; /* Обнуляем отступ на мобильных */
        padding-top: 72px !important; /* Добавляем отступ сверху, чтобы контент не перекрывался шапкой */
        padding-left: 1rem !important; /* Корректируем отступ для мобильных */
        padding-right: 1rem !important; /* Добавляем отступ справа для мобильных */
    }

    body.sidebar-hidden .main-content {
        margin-left: 0 !important; /* Обнуляем отступ на мобильных */
        padding-left: 1rem !important; /* Корректируем отступ для мобильных */
        padding-right: 1rem !important; /* Добавляем отступ справа для мобильных */
    }

    .mobile-bottom-nav {
        display: flex !important; /* Показываем мобильную навигацию */
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px; /* Высота нижней панели */
        background: var(--gradient-cta); /* Цвет фона, соответствующий неактивным кнопкам десктопной версии */
        box-shadow: 0 -2px 8px rgba(0,0,0,0.15);
        z-index: 99999;
        justify-content: space-around;
        align-items: center;
        padding: 0 10px;
        border-top: 1px solid var(--color-border-subtle);
    }

    .mobile-bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #FFFFFF; /* Цвет иконок и текста по умолчанию - белый */
        font-size: 0.75rem;
        font-weight: 500;
        transition: color 0.2s ease-in-out;
        flex: 1;
        height: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-bottom-nav-item i {
        font-size: 1.5rem; /* Larger icon size */
        margin-bottom: 6px; /* Adjusted margin */
        color: #FFFFFF; /* Default icon color */
        transition: color 0.2s ease-in-out;
    }

    .mobile-bottom-nav-item svg {
        fill: #FFFFFF !important;
        stroke: #FFFFFF !important;
    }

    .mobile-bottom-nav-item.active {
        background: linear-gradient(to right, #1a3a8a, #0f2352) !important; /* Темный градиент для активной кнопки */
        color: #FFFFFF !important;
        border: none !important;
        box-shadow: var(--shadow-cta-hover) !important;
        transform: translateY(-3px) !important;
        font-weight: 700 !important;
    }

    .mobile-bottom-nav-item:hover {
        color: var(--color-accent-blue-light);
    }

    /* Скрываем подписи на очень маленьких экранах, оставляя только иконки */
    @media (max-width: 480px) {
        .mobile-bottom-nav-item .mobile-nav-label {
            display: none;
        }
        .mobile-bottom-nav-item i {
            margin-bottom: 0;
        }
    }
}

/* Дополнительные корректировки для очень маленьких экранов (если нужны) */
@media (max-width: 480px) {
    /* Здесь могут быть дополнительные мелкие корректировки */
}
