/* ========== АДАПТИВНЫЕ СТИЛИ ========== */

/* Планшеты и маленькие экраны */
@media (max-width: 1024px) {
    .container {
        padding: 0 1rem;
    }

    .hero-content h2 {
        font-size: 2.5rem;
    }

    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 1.5rem;
    }

    .authors-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }

    .genres-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }

    /* Страница книги */
    .book-content {
        grid-template-columns: 1fr;
    }

    .book-cover {
        max-width: 400px;
        margin: 0 auto;
    }

    /* Страница автора */
    .author-header {
        flex-direction: column;
        text-align: center;
    }

    .author-stats {
        justify-content: center;
    }

    /* О нас */
    .mission-content {
        flex-direction: column;
    }

    .contacts-content {
        flex-direction: column;
    }

    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    /* Шапка */
    .header-top {
        flex-direction: column;
        gap: 1rem;
    }

    .header-search {
        width: 100%;
        max-width: none;
    }

    .main-nav ul {
        flex-wrap: wrap;
        gap: 1rem;
        justify-content: center;
    }

    /* Баннер */
    .hero-banner {
        padding: 3rem 0;
    }

    .hero-content h2 {
        font-size: 2rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    /* Секции */
    section {
        padding: 2rem 0;
    }

    .section-title {
        font-size: 1.5rem;
    }

    /* Жанры */
    .genres-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 1rem;
    }

    .genre-card {
        padding: 1.5rem 1rem;
    }

    .genre-icon {
        font-size: 2.5rem;
    }

    /* Книги */
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .book-card-content {
        padding: 1rem;
    }

    .book-card h3 {
        font-size: 1rem;
    }

    /* Авторы */
    .authors-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 1rem;
    }

    .author-card {
        padding: 1.5rem;
    }

    .author-photo-small {
        width: 80px;
        height: 80px;
    }

    /* Подборки */
    .collections-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Футер */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Страница книги */
    .book-main {
        padding: 1.5rem 0;
    }

    .book-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .book-actions button {
        width: 100%;
    }

    .download-formats {
        margin-top: 1.5rem;
    }

    .formats-list {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .format-btn {
        padding: 0.75rem;
        font-size: 0.875rem;
    }

    .details-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .tab-btn {
        flex: 1;
        min-width: calc(50% - 0.25rem);
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    /* Страница автора */
    .author-profile {
        padding: 1.5rem 0;
    }

    .author-photo {
        width: 150px;
        height: 150px;
    }

    .author-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .stat-item {
        padding: 1rem;
    }

    .filter-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .filter-btn {
        flex: 1;
        min-width: calc(50% - 0.25rem);
    }

    /* О нас */
    .about-hero {
        padding: 2rem 0;
    }

    .about-hero h1 {
        font-size: 2rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-card {
        padding: 1.5rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .contact-form-container {
        padding: 1.5rem;
    }

    .social-icons {
        flex-wrap: wrap;
    }

    .faq-item {
        padding: 1.25rem;
    }
}

/* Маленькие мобильные устройства */
@media (max-width: 480px) {
    .hero-content h2 {
        font-size: 1.75rem;
    }

    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .genres-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .btn-primary,
    .btn-secondary {
        padding: 0.75rem 1.5rem;
        font-size: 0.9375rem;
    }

    .section-title {
        font-size: 1.375rem;
    }

    .main-nav ul {
        font-size: 0.9375rem;
        gap: 0.75rem;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Дополнительные адаптивные стили для специфичных элементов */

/* Страница книги - детали */
@media (max-width: 768px) {
    .book-content {
        display: block;
    }

    .book-cover {
        float: none;
        margin: 0 auto 2rem;
        max-width: 300px;
    }

    .book-info {
        width: 100%;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .reviews-list,
    .quotes-list {
        padding: 0;
    }

    .review-card,
    .quote-card {
        margin-bottom: 1rem;
    }
}

/* Страница автора - специфичные стили */
@media (max-width: 768px) {
    .author-header {
        display: block;
    }

    .author-photo {
        margin: 0 auto 1.5rem;
    }

    .author-info {
        text-align: center;
    }

    .author-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .biography-content {
        font-size: 1rem;
    }

    .awards-list {
        grid-template-columns: 1fr;
    }

    .series-list {
        grid-template-columns: 1fr;
    }
}

/* Форма контактов */
@media (max-width: 768px) {
    .contact-form .form-group {
        margin-bottom: 1rem;
    }

    .contact-form input,
    .contact-form textarea {
        padding: 0.875rem;
        font-size: 1rem;
    }

    .contact-item {
        flex-direction: column;
        text-align: center;
    }

    .contact-icon {
        margin: 0 auto 0.75rem;
    }
}

/* Горизонтальная прокрутка для небольших экранов */
@media (max-width: 640px) {
    .details-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .details-tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .filter-buttons {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .filter-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* Улучшение читаемости на больших экранах */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }

    .hero-content h2 {
        font-size: 3.5rem;
    }

    .section-title {
        font-size: 2.5rem;
    }

    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 2.5rem;
    }
}

/* Печать */
@media print {
    .header,
    .footer,
    .breadcrumbs,
    .btn-primary,
    .btn-secondary,
    .download-formats,
    .book-actions {
        display: none;
    }

    body {
        background: white;
    }

    .book-content,
    .author-header {
        display: block;
    }

    .book-cover,
    .author-photo {
        max-width: 300px;
        page-break-inside: avoid;
    }
}

/* Доступность - увеличенные размеры для пользователей с нарушениями зрения */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Темная тема (если браузер поддерживает) */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #f9fafb;
        --text-light: #d1d5db;
        --bg-color: #1f2937;
        --bg-light: #111827;
        --bg-dark: #000000;
        --border-color: #374151;
    }

    body {
        background-color: var(--bg-light);
        color: var(--text-color);
    }

    .header {
        background-color: var(--bg-color);
    }

    .book-card,
    .author-card,
    .genre-card,
    .collection-card {
        background-color: var(--bg-color);
    }

    .header-search input,
    .btn-favorite {
        background-color: var(--bg-light);
        color: var(--text-color);
        border-color: var(--border-color);
    }
}
