/* Этот файл содержит кастомные стили для шрифта. */

*, *::before, *::after, input, textarea, button, select {
    font-family: 'Handjet', sans-serif !important;
    box-sizing: border-box; /* Гарантирует правильный расчет ширины с учетом padding */
}

::placeholder {
    font-family: 'Handjet', sans-serif !important;
}

body {
    font-weight: 350; /* Основной текст сайта (обычная толщина) */
    /* 
      ГЛАВНАЯ НАСТРОЙКА РАЗМЕРА ШРИФТА
      Измените значение ниже, чтобы поменять размер шрифта на всем сайте.
    */
    font-size: 18px; 
}

/* 1. Заголовки сайта и категорий (H1, H2) */
h1, h2, .utils-category-title {
    font-weight: 800;          /* Очень жирный */
    letter-spacing: 3px;       /* Расстояние между буквами */
    text-transform: uppercase; /* Все буквы заглавные (можно убрать эту строку) */
}

/* 2. Текст внутри карточек */
.book-card, .util-card {
    /* Размер шрифта в карточках (1rem = размеру шрифта body) */
    font-size: 1rem; 
    line-height: 1.4;
    font-weight: 400;
}

/* 3. Кнопки */
button, .btn, .download-btn, .dropbtn, #backBtn {
    font-weight: 700;          /* Жирный шрифт для кнопок */
    letter-spacing: 2px;       /* Немного раздвигаем буквы в кнопках */
}

/* 4. Заголовки внутри карточек */
.book-title, .util-name {
    font-size: 1.3em;          /* Размер заголовка */
    font-weight: 800;          /* Жирность заголовка */
    letter-spacing: 0.5px;
}

/* 5. Адаптивность шрифтов */
@media (max-width: 768px) {
    body {
        font-size: 16px; /* Уменьшаем базовый размер шрифта для планшетов */
    }
    h1, h2, .utils-category-title {
        letter-spacing: 2px; /* Уменьшаем расстояние между буквами в заголовках */
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px; /* Еще уменьшаем для телефонов */
    }
}

/* Единый стиль хедера для всех страниц */
header {
    background: transparent !important;
    border-bottom: none !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    position: relative !important;
    padding: 15px 0;
}

/* Анимация ссылок в навигации */
.nav-links a {
    position: relative;
    text-decoration: none;
    color: #f8fafc;
    transition: transform 0.3s ease, color 0.3s ease;
    display: inline-block;
}

.nav-links a:hover {
    color: #6366f1 !important;
    transform: scale(1.1);
}

/* Единый стиль футера */
footer {
    background: rgba(15, 23, 42, 0.8) !important;
    padding: 20px 0;
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 80px 20px 60px;
    margin-bottom: 20px;
}

.hero-section p {
    font-size: 1.6rem; 
    color: #f8fafc;    /* Возвращаем чистый светлый цвет */
    margin: 0 auto;
    max-width: 900px;
    line-height: 1.4;
    letter-spacing: 1px;
    font-weight: 700;  /* Делаем шрифт более жирным */
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8), 0 0 25px rgba(99, 102, 241, 0.5);
}

/* Ряд подзаголовка с переключателем вида */
.hero-subtitle-row {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 20px;
    gap: 15px;
}

@media (max-width: 768px) {
    .hero-subtitle-row {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    .hero-section p {
        font-size: 1.2rem;
    }
}

/* Hub Grid */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 60px;
}

.hub-card {
    width: 100%;
    min-height: 280px;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(99, 102, 241, 0.15) 0%, rgba(15, 23, 42, 0.65) 100%);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.2),
        inset 0 0 20px rgba(255, 255, 255, 0.02);
}

.hub-card:hover {
    transform: translateY(-12px) scale(1.02);
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(99, 102, 241, 0.3);
    background: rgba(15, 23, 42, 0.8);
}

.hub-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        transparent,
        rgba(99, 102, 241, 0.05),
        transparent
    );
    opacity: 0;
    transition: opacity 0.5s;
    z-index: 0;
}

.hub-card:hover::before {
    opacity: 1;
}

.hub-icon {
    position: relative;
    z-index: 1;
    font-size: 2.5rem;
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.5s ease;
}

.hub-card:hover .hub-icon {
    transform: scale(1.1) rotate(5deg);
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.2);
    filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.4));
}

.hub-card-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.hub-card h3 {
    font-size: 1.3rem;
    margin: 0;
    line-height: 1.1; /* Уплотнили заголовок для лучшего вида */
    letter-spacing: 1px;
}

.hub-card p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.4; /* Добавили немного пространства между строками описания */
    color: #94a3b8;
}

@media (max-width: 768px) {
    .hub-grid { 
        grid-template-columns: 1fr;
        gap: 15px; 
    }
    .hub-card { padding: 30px 20px; min-height: 220px; }
    .hub-card h3 { font-size: 1.4rem; }
    .hub-card p { font-size: 0.9rem; }
    .hub-icon { width: 60px; height: 60px; font-size: 2rem; }
}

/* Поиск в хедере */
.header-search {
    flex: 1;
    max-width: 450px; 
    margin: 0 30px;
    position: relative;
}

.header-search input {
    width: 100%;
    padding: 12px 45px 12px 45px; /* Увеличили высоту и отступы для большего размера */
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-search input:focus {
    background: rgba(30, 41, 59, 0.9);
    border-color: #6366f1;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.clear-search-btn {
    position: absolute;
    right: 12px; /* Теперь кнопка четко прижата к правому краю поисковика */
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(148, 163, 184, 0.6);
    cursor: pointer;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 2;
}

.clear-search-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #6366f1;
}

.header-search .search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    transition: color 0.3s ease;
}

.header-search input:focus + .search-icon {
    color: #6366f1;
}

/* Выпадающий список поиска */
.search-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    max-height: 350px;
    overflow-y: auto;
    z-index: 2000;
    display: none;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    animation: dropdownFadeIn 0.3s ease-out;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.search-result-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-result-item:hover {
    background: rgba(99, 102, 241, 0.15);
}

.search-highlight {
    background: rgba(99, 102, 241, 0.4);
    color: #fff;
    border-radius: 2px;
    padding: 0 2px;
}

/* Кнопка прокрутки наверх */
.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: rgba(99, 102, 241, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s, visibility 0.4s, transform 0.4s, background 0.4s, bottom 0.2s ease-out;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.scroll-top-btn.show {
    opacity: 1;
    visibility: visible;
}

.scroll-top-btn:hover {
    background: rgba(99, 102, 241, 1);
    transform: translateY(-5px);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Современный дизайн переключателя языков */
footer {
    overflow: visible !important; /* Чтобы выпадающее меню не обрезалось */
}

.footer-info-group {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-lang .dropbtn {
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 10px !important;
    padding: 6px 12px !important;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #94a3b8 !important; /* Цвет как у текста футера */
    font-size: 0.9rem !important;
    cursor: pointer;
}

.footer-lang .dropbtn:hover {
    background: rgba(99, 102, 241, 0.15) !important;
    border-color: rgba(99, 102, 241, 0.4) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    color: #fff !important;
}

.lang-flag {
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: opacity 0.3s ease; /* Плавный переход для прозрачности */
}

.lang-chevron {
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.footer-lang:hover .lang-chevron,
.footer-lang.open .lang-chevron {
    transform: rotate(180deg);
    opacity: 1;
    color: #6366f1;
}

.footer-lang .dropdown-content {
    top: auto !important;
    bottom: calc(100% + 12px) !important;
    transform: translateY(15px) !important;
    left: auto;
    right: 0;
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important;
    padding: 8px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6) !important;
    min-width: 150px !important;
}

.footer-lang.open .dropdown-content,
.footer-lang:hover .dropdown-content {
    transform: translateY(0) !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.footer-lang .dropdown-content a {
    padding: 10px 14px !important;
    border-radius: 10px !important;
    margin-bottom: 4px;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    color: #94a3b8 !important;
    font-size: 0.9rem !important;
    text-decoration: none !important;
}

.footer-lang .dropdown-content a:hover {
    background: rgba(99, 102, 241, 0.2) !important;
    color: #fff !important;
}

.footer-lang .dropdown-content a.selected {
    background: rgba(99, 102, 241, 0.1) !important;
    color: #6366f1 !important;
    font-weight: 700;
}

/* Анимация появления элементов футера */
.footer-container > * {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.footer-container.reveal-visible > * {
    opacity: 1;
    transform: translateY(0);
}

/* Поочередная задержка для элементов (эффект лесенки) */
.footer-container.reveal-visible > *:nth-child(1) { transition-delay: 0.1s; }
.footer-container.reveal-visible > *:nth-child(2) { transition-delay: 0.2s; }
.footer-container.reveal-visible > *:nth-child(3) { transition-delay: 0.3s; }


/* Адаптивность для поиска */
@media (max-width: 768px) {
    .header-search {
        display: none; /* Скрываем в шапке на мобилках, чтобы не теснить логотип */
    }
}

/* Анимированный фон в углу */
.bg-animation-corner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 300px;
    height: 300px;
    background-image: url('https://i.gifer.com/NRI0.gif');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom left;
    z-index: -2; /* Ниже снега и контента */
    pointer-events: none; /* Чтобы нельзя было случайно кликнуть по картинке */
    opacity: 0.5; /* Делаем чуть прозрачным, чтобы не отвлекало */
}

@media (max-width: 768px) {
    .bg-animation-corner {
        width: 150px;
        height: 150px;
        opacity: 0.4;
    }
}

/* Стили для карточек авторизации и форм */
#auth-containers, #profile-box {
    max-width: 450px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#register-box, #login-box, #profile-box, #todo-form {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    text-align: center;
    transition: border-color 0.3s ease, transform 0.3s ease;
}

#register-box:hover, #login-box:hover, #profile-box:hover, #todo-form:hover {
    border-color: rgba(99, 102, 241, 0.5);
}

#register-box h3, #login-box h3, #profile-box h3 {
    margin-top: 0;
    margin-bottom: 25px;
    color: #fff;
    font-size: 1.5rem;
    letter-spacing: 1px;
}

#auth-containers input, #todo-form input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 15px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

#auth-containers input:focus, #todo-form input:focus {
    border-color: #6366f1;
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

#auth-containers button, #todo-form button, #logout-btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    background: #6366f1;
    color: white;
}

#auth-containers button:hover, #todo-form button:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
}

#logout-btn {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.4);
    margin-top: 15px;
}

#logout-btn:hover {
    background: #ef4444;
    color: white;
}

/* Стили для кнопки "Сменить аккаунт" */
#changeAccountBtn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    border: 1px solid rgba(99, 102, 241, 0.4); /* Немного другой цвет рамки */
    transition: all 0.3s ease;
    background: rgba(99, 102, 241, 0.2); /* Более светлый фон */
    color: #6366f1; /* Цвет текста */
    margin-top: 10px; /* Отступ от кнопки "Выйти" */
}
#changeAccountBtn:hover {
    background: #6366f1; /* При наведении становится как основная кнопка */
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
}

#auth-containers hr {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.1), transparent);
    margin: 10px 0;
}

/* Splash Screen эффект для модального окна авторизации */
.auth-splash-content {
    background: radial-gradient(circle at center, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 1) 100%) !important;
    border: 1px solid rgba(99, 102, 241, 0.3) !important;
    box-shadow: 0 0 100px rgba(99, 102, 241, 0.2) !important;
    transform: scale(0.8);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.show .auth-splash-content {
    transform: scale(1);
}

#headerLoginBtn {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.auth-toggle-text {
    margin-top: 20px;
    font-size: 0.9rem;
    color: #94a3b8;
}

.auth-toggle-text a {
    color: #6366f1;
    text-decoration: none;
    font-weight: 700;
    margin-left: 5px;
    transition: color 0.3s ease;
}

.auth-toggle-text a:hover {
    color: #818cf8;
    text-decoration: underline;
}