/* Основные стили */
html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #1a1a1a;
    color: #fff;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Поиск */
.search-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    background-color: #222;
    margin: 20px auto;
    max-width: 800px;
    width: 90%;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.search-input {
    padding: 10px;
    border: none;
    border-radius: 20px;
    width: 100%;
    background-color: #333;
    color: #fff;
}

.search-select {
    padding: 10px;
    border: none;
    border-radius: 20px;
    background-color: #333;
    color: #fff;
    width: 100%;
}

.search-button {
    padding: 10px 20px;
    background-color: #ffcc00;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.3s;
    width: 100%;
}

.search-button:hover {
    background-color: #e6b800;
    transform: translateY(-2px);
}

/* Список аниме */
/* Основной контейнер списка аниме */
.anime-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* Центрирование по горизонтали */
    gap: 20px;
    padding: 20px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Стили карточки аниме */
.anime-box {
    width: 280px; /* Фиксированная ширина */
    background-color: #2a2a2a;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid #3a3a3a;
}

/* Адаптация для планшетов */
@media (max-width: 900px) {
    .anime-box {
        width: calc(50% - 30px); /* 2 карточки в ряд с отступами */
        max-width: 350px;
    }
}

/* Адаптация для мобильных */
@media (max-width: 600px) {
    .anime-box {
        width: 100%;
        max-width: 400px;
        margin: 0 auto 20px; /* Центрирование и отступ снизу */
    }
    
    .anime-list {
        padding: 10px;
        gap: 15px;
    }
}

/* Дополнительное центрирование для очень маленьких экранов */
@media (max-width: 400px) {
    .anime-box {
        width: 95%;
    }
}
.anime-box:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    border-color: #ffcc00;
}

.anime-box img {
    width: 100%;
    height: 100%;
    object-fit: unset;
    transition: transform 0.5s ease;
}

.anime-box:hover img {
    transform: scale(1.10);
}

.anime-info {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: #2a2a2a;
    z-index: 2;
}

.anime-info h3 {
    margin: 0 0 12px;
    font-size: 1.1em;
    font-weight: 600;
    color: #fff;
    text-align: center;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 3em;
}

.genres {
    margin: 4px 0;
    color: #aaa;
    font-size: 0.85em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.8em;
    line-height: 1.4;
    text-align: center;
}

.status {
    font-size: 0.85em;
    font-weight: 600;
    text-align: center;
    padding: 6px 12px;
    border-radius: 12px;
    display: inline-block;
    max-width: 90%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status.ongoing {
    color: #4caf50;
    background-color: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.status.completed {
    color: #f44336;
    background-color: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.3);
}

/* Стили для рейтинга */
.rating-container {
    margin: 8px 0;
    text-align: center;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stars {
    display: inline-flex;
    font-size: 18px;
    cursor: pointer;
    margin-bottom: 4px;
    justify-content: center;
    gap: 2px;
}

.star {
    color: #444;
    transition: all 0.2s ease;
}

.star:hover,
.star.hover,
.star.active {
    color: #ffcc00;
    transform: scale(1.1);
}

.hidden {
    display: none !important;
}

.register-to-rate {
    color: #aaa;
    font-size: 0.9em;
    margin: 8px 0;
}

.rating-value {
    display: inline-block;
    font-size: 1em;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 12px;
    margin-top: 4px;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.register-to-rate {
    color: #aaa;
    font-size: 0.9em;
    margin: 8px 0;
}

.rating-value {
    display: inline-block;
    font-size: 1em;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 12px;
    margin-top: 4px;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rating-excellent {
    color: #28a745;
    background-color: rgba(40, 167, 69, 0.2) !important;
    border: 2px solid rgba(40, 167, 69, 0.4) !important;
}

.rating-good {
    color: #ffc107;
    background-color: rgba(255, 193, 7, 0.2) !important;
    border: 2px solid rgba(255, 193, 7, 0.4) !important;
}

.rating-average {
    color: #fd7e14;
    background-color: rgba(253, 126, 20, 0.2) !important;
    border: 2px solid rgba(253, 126, 20, 0.4) !important;
}

.rating-poor {
    color: #dc3545;
    background-color: rgba(220, 53, 69, 0.2) !important;
    border: 2px solid rgba(220, 53, 69, 0.4) !important;
}

.watch-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    background: linear-gradient(135deg, #ffcc00 0%, #ff9500 100%);
    color: #000;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    width: auto;
    max-width: 80%;
    box-shadow: 0 2px 8px rgba(255, 204, 0, 0.3);
    position: relative;
    overflow: hidden;
    margin-top: auto;
}

.watch-button::after {
    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;
}

.watch-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 204, 0, 0.4);
}

.watch-button:hover::after {
    left: 100%;
}

/* Кнопка "Вверх" */
.scroll-top {
    position: fixed;
    bottom: 200px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #ffcc00, #e6b800);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s, transform 0.3s, background 0.3s;
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
}

.scroll-top.show {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    background: linear-gradient(135deg, #e6b800, #ffcc00);
    transform: scale(1.1);
}

.scroll-top i {
    font-size: 1.5em;
}

/* Футер */
.site-footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid #444;
    width: 100%;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-footer p {
    margin: 5px 0;
    font-size: 14px;
}

/* Анимация загрузки */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.anime-box {
    animation: fadeIn 0.6s ease forwards;
    opacity: 0;
}

/* Адаптивность */
@media (max-width: 768px) {
    .search-container {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        padding: 15px;
    }

    .anime-box {
        width: calc(50% - 16px);
        height: auto;
        min-height: 480px;
    }
}

@media (max-width: 480px) {
    .anime-box {
        width: 100%;
        max-width: 320px;
        min-height: 460px;
    }
    
    .watch-button {
        padding: 8px 20px;
        font-size: 0.95em;
    }
}