.habits-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    color: var(--text-color);
    padding: 10px;
}

#habits-list-group {
    flex: 0.97;
    min-height: 0; 
    overflow-y: hidden;
    scrollbar-gutter: stable;
}

#habits-list-group:hover {
    overflow-y: auto;
    /* Показать скролл при наведении */
}

#habits-list-group::-webkit-scrollbar {
    width: 2px;
}

#habits-list-group::-webkit-scrollbar-track {
    background: rgba(var(--text-color), 0.1);
    border-radius: 3px;
}

#habits-list-group::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

.habits-date {
    display: flex;
    flex-direction: row;
    /* border: 1px solid white; */
}

.habits-mounth {
    display: flex;
    justify-content: center;
    width: 32%;
    /* border: 1px solid white; */
    /* margin: px; */
    font-size: 23px;
    font-weight: 500;
    color: var(--secondary-text-color);
}

.habits-days {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    width: 68%;
    margin: 3px;
    margin-left: 19px;
    color: var(--secondary-text-color);
}

.habits-day {
    font-size: 18px;
    font-weight: 700;
}

.habits {
    display: flex;
    flex-direction: column;
    /* border: 1px solid white; */
    height: 100%;
    width: 100%;
    /* justify-content: center; */
    /* align-items: center; */
    margin-left: 5px;
    margin-top: 5px;
}

.habit {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    padding: 5px;
}

.habit-name {
    display: flex;
    justify-content: start;
    width: 35%;
    max-width: 105px;
    overflow: hidden;
    white-space: nowrap;
    transition: 0.3s;
    font-size: 10px;
    align-items: center;
    font-weight: 400;
}

.habit-name-inner {
    display: inline-block;
    padding-right: 100%;
    transition: 0.3s;
}

.habit-name:hover .habit-name-inner {
    animation: full-marquee 8s linear;
    animation-delay: 0.5s;
}

@keyframes full-marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(calc(-100% + 105px));
    }
}

.habit-name:hover {
    z-index: 1;
}

.habit-checkboxes {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    width: 65%;
    /* gap: 12px; */
}

.habit-ring {
    width: 20px;
    height: 20px;
    /* Делаем высоту равной ширине */
    border-radius: 3px;
    /* Вместо круглой формы */
    background: var(--habit-ring-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
}

/* Стили для отмеченного состояния */
.habit-ring:has(input:checked) {
    background: var(--habit-checked-gradient);
}

.habit-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 1px;
    background-color: #333;
    transition: background-color 0.2s;

    transition: all 0.3s;
}

.habit-checkbox:hover {
    box-shadow: 0 4px 15px rgba(var(--accent-color-back), 0.5);
}

/* Скрытие нативного чекбокса */
.habit-ring input {
    position: absolute;
    opacity: 0;
    height: 0;
    width: 0;
}

.habit-ring:has(input:checked) {
    background: var(--habit-checked-gradient);
}

.habit-ring:has(input:checked) .habit-checkbox {
    background-color: var(--checkbox-checked-bg);
}

.edit-habits {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ball-habit-1 {
    width: 160px;
    height: 160px;
    background: rgba(var(--accent-color-back), 0.3);
    /* Розовый неоновый цвет */
    filter: blur(50px);
    top: 10%;
    left: 10%;
}

.ball-habit-2 {
    width: 80px;
    height: 80px;
    background: rgba(var(--accent-color-back), 0.3);
    /* Голубой неоновый цвет */
    filter: blur(50px);
    top: 40%;
    left: 60%;
}

.ball-habit-3 {
    width: 50px;
    height: 50px;
    background: rgba(var(--accent-color-back), 0.3);
    /* Желтый неоновый цвет */
    filter: blur(50px);
    top: 70%;
    left: 50%;
}

.ball-habit-4 {
    width: 50px;
    height: 50px;
    background: rgba(var(--accent-color-back), 0.3);
    /* Желтый неоновый цвет */
    filter: blur(50px);
    top: 80%;
    left: 30%;
}

.box.left-habits:hover .habit-settings-btn {
    opacity: 1;
}

.habit-settings-btn {
    padding: 12px;
    border: 1px solid rgba(var(--accent-color), 0.3);
    border-radius: 6px;
    background: rgba(var(--accent-color), 0.1);
    color: var(--accent-color);
    cursor: pointer;
    transition: all 0.3s;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    font-size: 18px;
    line-height: 1;
    font-family: Arial, sans-serif;

    /* Новые стили для позиционирования */
    position: absolute; /* Абсолютное позиционирование */
    bottom: 10px;      /* Отступ от нижнего края родителя */
    right: 45%;       /* Отступ от правого края родителя */
    z-index: 10;       /* Уровень поверх других элементов */
}

.habit-settings-btn:hover {
    background: rgba(var(--accent-color), 0.2);
    border-color: var(--accent-color);
}

.habit-empty {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
}

/* Модальное окно */
.habit-container {
    display: flex;
    width: 95%;
    height: 90%;
}

.habit-first-container {
    margin: 5px;
    width: 50%;
    /* border: 1px solid green; */
}

.habit-second-container {
    margin: 5px;
    width: 50%;
    /* border: 1px solid green; */
}

.habit-form {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.habit-name-div {
    width: 35%;
}

.habit-name-input {
    padding: 8px 12px;
    border: 1px solid rgba(var(--accent-color), 0.3);
    border-radius: 6px;
    background: transparent;
    color: var(--text-color);
    font-size: 12px;
    width: 90%;
}

.habit-name-input:focus {
    outline: none;
    /* Убирает стандартную браузерную обводку */
}

.habit-description-div {
    width: 40%;
}

.habit-description-input {
    padding: 8px 12px;
    border: 1px solid rgba(var(--accent-color), 0.3);
    border-radius: 6px;
    background: transparent;
    color: var(--text-color);
    font-size: 12px;
    width: 90%;
}

.habit-description-input:focus {
    outline: none;
    /* Убирает стандартную браузерную обводку */
}

.habit-add-div {
    width: 20%;
}

.habit-add-btn {
    padding: 8px 12px;
    border: 1px solid rgba(var(--accent-color), 0.3);
    border-radius: 6px;
    background: rgba(var(--accent-color), 0.1);
    color: var(--text-color);
    cursor: pointer;
    height: 100%;
    width: 100%;
}

.list-group-habits {
    max-height: 45vh;
    width: 100%;
    padding: 0px;
    overflow-y: hidden;
    scrollbar-gutter: stable;
}

.list-group-habits:hover {
    overflow-y: auto;
}

.list-group-habits::-webkit-scrollbar {
    width: 2px;
}

.list-group-habits::-webkit-scrollbar-track {
    background: rgba(var(--text-color), 0.1);
    border-radius: 3px;
}

.list-group-habits::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

.list-group-habit {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(var(--text-color), 0.03);
    border: 1px solid rgba(var(--accent-color), 0.1);
    margin-top: 8px;
    border-radius: 8px;
    width: 92%;
}

.list-habit-title {
    color: var(--text-color);
    width: 27%;
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
}

.list-habit-descriprion {
    color: rgba(var(--accent-color));
    width: 50%;
    font-size: 10px;
}

.habit-delete-btn {
    padding: 8px 12px;
    border: 1px solid rgba(var(--accent-color), 0.3);
    border-radius: 6px;
    background: rgba(var(--accent-color), 0.1);
    color: var(--text-color);
    cursor: pointer;
    height: 100%;
}

/* .trash-icon {
    width: 16px;
    height: 16px;
    filter: invert(0.8);
    transition: all 0.3s ease;
} */

/* Новости привычек */

/* Общие стили блока */
.habit-news {
    /* border: 1px solid white; */
    margin-left: 40px;
    margin-top: 0px;
    padding: 15px;
    height: 100%;
    width: 100%;
}

/* Шапка блока */
.news-header {
    /* position: relative; */
    margin-bottom: 20px;
    margin-top: 0px;
    color: var(--text-color);
    text-align: center;
    font-size: 16px;
    font-weight: 700;
}

.news-decor-line {
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(var(--accent-color), 0.4) 50%, 
        transparent 100%);
    margin: 10px 0;
}

/* Список советов */
.news-list {
    overflow-y: hidden;
    scrollbar-gutter: stable;
    width: 100%;
    height: 41vh;
}

.news-list:hover {
    overflow-y: auto;
}

/* Кастомизация скролла */
.news-list::-webkit-scrollbar {
    width: 2px;
}

.news-list::-webkit-scrollbar-thumb {
    background: rgba(var(--accent-color), 0.5);
    border-radius: 3px;
}

.news-list::-webkit-scrollbar-track {
    background: rgba(var(--text-color), 0.05);
}

/* Карточка совета */
.news-card {
    background: rgba(var(--primary-color), 0.1);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.news-card:hover {
    background: rgba(var(--primary-color), 0.15);
}

.news-icon {
    font-size: 1.6em;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-content h4 {
    color: var(--success-light);
    margin: 0 0 5px 0;
    font-size: 12px;
}

.news-content p {
    color: var(--text-color);
    /* color: rgba(var(--text-color), 0.8); */
    margin: 0;
    font-size: 10px;
    line-height: 1.4;
}

.error-message {
    color: var(--success-light);
    margin-top: 2px;
}

/* Мобильные стили */
@media (max-width: 768px) {
    .modal-content {
        width: 90% !important;
        height: 90% !important;
        margin: 5% auto !important;
        padding: 10px;
        max-width: 95vw; /* Важное дополнение */
    }

    .habit-container {
        flex-direction: column;
        width: 100%;
        height: auto;
    }

    .habit-first-container,
    .habit-second-container {
        width: 100% !important;
        margin: 5px 0 !important;
    }

    .habit-form {
        flex-direction: column;
        gap: 10px;
    }

    .habit-name-div,
    .habit-description-div,
    .habit-add-div {
        width: 100% !important;
    }

    .habit-name-input,
    .habit-description-input {
        width: 93% !important;
    }

    .habit-add-btn {
        width: 100%;
        padding: 10px;
    }

    .list-group-habits {
        max-height: 30vh;
    }

    .list-group-habit {
        flex-direction: column;
        align-items: flex-start;
        width: 94%;
        padding: 10px;
    }

    .list-habit-title,
    .list-habit-descriprion {
        width: 100% !important;
        margin-bottom: 5px;
    }

    .habit-news {
        margin-left: 0;
        padding: 10px;
    }

    .news-list {
        height: 30vh;
    }

    .news-card {
        flex-direction: column;
        align-items: flex-start;
        margin-right: 15px;
    }

    .news-icon {
        margin-bottom: 10px;
    }
}

@media (max-width: 768px) {
    .modal-content {
        width: 95vw !important;
        max-width: 100vw;
        margin: 5vh auto !important;
        left: 0;
        right: 0;
        transform: none;
        box-sizing: border-box;
        padding: 15px;
    }

    .habit-container {
        flex-direction: column;
        width: 100%;
        min-width: 0; /* Важно для flex-элементов */
    }

    .habit-form, 
    .list-group-habit,
    .news-card {
        min-width: 0; /* Предотвращает "распухание" */
    }

    /* Принудительный перенос длинных слов */
    .list-habit-title, 
    .list-habit-descriprion,
    .news-content p {
        overflow-wrap: break-word;
        word-break: break-word;
    }
}