/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Georgia', 'Times New Roman', serif;
}

body {
    background: linear-gradient(135deg, #f9f5e9 0%, #f0e6d2 100%);
    color: #3c2f2f;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
     
    width: 100%;/* Добавьте это свойство */
    margin: 0 auto;
    padding: 0 20px;
    flex: 1;
}

/* Шапка сайта */
header {
    background: #5d4037;
    padding: 15px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 26px;
    font-weight: 700;
    color: #f8f5f0;
    text-decoration: none;
}

.logo i {
    color: #d7ccc8;
}

.logo-text {
    display: inline;
}

.search-bar {
    display: flex;
    flex: 1;
    max-width: 500px;
    margin: 0 30px;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 12px 20px;
    border-radius: 30px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.search-bar input:focus {
    outline: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.search-bar .search-button {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #8d6e63;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-bar .search-button:focus {
    outline: none;
    color: #5d4037;

}

.nav-icons {
    display: flex;
    gap: 22px;
}

.nav-icons a {
    color: #f8f5f0;
    font-size: 22px;
    text-decoration: none;
    position: relative;
    transition: color 0.3s;
}

.nav-icons a:hover {
    color: #d7ccc8;
}

.badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    font-size: 12px;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
}




/* Фильтры и сортировка */
/* вопреки называнию это навигатор и сортировка*/
.filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 15px;
    padding: 0 10px;
}

/* Навигатор */
.breadcrumb {
    font-size: 16px;
    color: #5d4037;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.breadcrumb a {
    color: #8d6e63;
    text-decoration: none;
    transition: color 0.3s;
    display: flex;
    align-items: center;
}

.breadcrumb a:hover {
    color: #5d4037;
    text-decoration: none;
    
    background: rgba(141, 110, 99, 0.1); /* Легкий фон при наведении */
}

.breadcrumb span {
    color: #3c2f2f;
    font-weight: 600;
}

.breadcrumb i {
    margin: 0 5px;
    font-size: 14px;
    color: #8d6e63;
}

 .sort-form {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.sort-label {
    font-size: 16px;
    color: #5d4037;
}

.sort-select {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #d9c7a7;
    background: white;
    font-size: 15px;
    min-width: 200px;
    color: #5d4037;
    cursor: pointer;
    transition: all 0.3s;
}

.sort-select:focus {
    outline: none;
    border-color: #8d6e63;
    box-shadow: 0 0 0 2px rgba(141, 110, 99, 0.2);
}

/* Заголовок страницы. В таком виде мне он не совсем нравится*/
.section-title{
    font-size: 2em;
    margin-top: -10px;
    margin-bottom: 10px;
    padding: 0 10px;
}


/* Сетка книг */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}

.book-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.book-link {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    cursor: pointer;
}

.book-image {
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f5f0;
    position: relative;
    border-bottom: 1px solid #e9e1d5;
}

.book-image img {
    max-height: 95%;
    max-width: 100%;
    /* box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); */
    transition: transform 0.3s;
    border-radius: 12px;
}

.book-card:hover .book-image img {
    transform: scale(1.05);
}

.book-condition {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 2;
}
  

.condition-ideal {
    background: #27ae60;
}

.condition-excelent {
    background: #2ecc71;
}

.condition-very-good {
    background: #f1c40f;
}

.condition-good {
    background: #f39c12;
}

.condition-fair {
    background: #e67e22;
}

.condition-poor {
    background: #e74c3c;
}

.book-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

.book-details-grid {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

.book-author {
    color: #8d6e63;
    font-size: 15px;
    margin-bottom: 5px;
    font-style: italic;
}

.book-title {
    font-size: 18px;
    font-weight: 700;
    color: #4e342e;
    margin-bottom: 10px;
    line-height: 1.3;
    flex-grow: 1;
}

.book-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
    color: #8d6e63;
    font-size: 14px;
}

.book-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.book-meta i {
    font-size: 12px;
}

.book-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    position: relative;
    z-index: 2;
}

.book-price {
    font-size: 20px;
    font-weight: 700;
    color: #4e342e;
    min-width: 100px;
}

.old-price {
    text-decoration: line-through;
    color: #95a5a6;
    font-size: 16px;
    margin-left: 5px;
}

.book-actions {
    display: flex;
    gap: 10px;
}

.btn-cart {
    background: #8d6e63;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 15px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-cart:hover {
    background: #6d4c41;
}

.btn-wishlist {
    width: 36px;
    height: 36px;
    border: 1px solid #d9c7a7;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #8d6e63;
}

.btn-wishlist:hover, .btn-wishlist.active {
    color: #e74c3c;
    border-color: #e74c3c;
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    margin: 30px 0 50px;
    gap: 10px;
}

.page-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #d9c7a7;
    border-radius: 8px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.page-btn:hover, .page-btn.active {
    background: #8d6e63;
    color: white;
    border-color: #8d6e63;
}

/* Стили для страницы книги */
.product-container {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    padding: 30px;
    margin: 30px 0;
}

.product-header{
    margin-bottom: -40px;
}

.product-category {
    color: #8d6e63;
    font-size: 16px;
    margin-bottom: -40px;
    display: block;
    /*font-style: italic; */
}

.product-category.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 16px;
    color: #5d4037;
}

.product-category.breadcrumb a {
    color: #8d6e63;
    text-decoration: none;
    transition: all 0.3s;
    padding: 3px 8px;
    border-radius: 4px;
}

.product-category.breadcrumb a:hover {
    color: #5d4037;
    background: rgba(141, 110, 99, 0.1);
    text-decoration: none;
}

.product-category.breadcrumb .separator {
    color: #8d6e63;
    font-size: 12px;
    margin: 0 2px;
}

.product-gallery {
    flex: 1;
    min-width: 250px;
    touch-action: pan-y; /* Разрешаем только вертикальную прокрутку */
    user-select: none;   /* Запрещаем выделение изображений */
}

.main-image {
    width: 100%;
    height: 450px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f5f0;
    position: relative;
    border: 1px solid #e9e1d5;
    cursor: zoom-in;
}

.main-image img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    transition: transform 0.3s;
    /*box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);*/
    border-radius: 12px;
    pointer-events: none; /* Отключаем события мыши на картинке */
}

.main-image:hover img {
    transform: scale(1.03);
}

.gallery-controls {
    display: flex;
    justify-content: center;
    margin-top: 15px;
}

.thumbnails {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.thumbnail {
    width: 90px;
    height: 70px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s;
    background: #f8f5f0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.thumbnail:hover, .thumbnail.active {
    border-color: #8d6e63;
    transform: translateY(-5px);
}

.thumbnail img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.dots-container {
    display: none;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d7ccc8;
    cursor: pointer;
    transition: all 0.3s;
}

.dot.active {
    background: #8d6e63;
    transform: scale(1.2);
}

.product-details {
    flex: 1;
    min-width: 300px;
}

.product-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #4e342e;
    font-family: 'Georgia', serif;
}

.product-subtitle {
    font-size: 20px;
    color: #8d6e63;
    margin-bottom: 15px;
    font-style: italic;
}

.product-author {
    font-size: 22px;
    color: #5d4037;
    margin-bottom: 15px;
    font-weight: 600;
}


.condition-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.condition-label {
    font-weight: 600;
    color: #5d4037;
}

.condition-value {
    padding: 6px 15px;
    border-radius: 20px;
    font-weight: 600;
    color: white;
}

.price {
    font-size: 36px;
    font-weight: 700;
    color: #4e342e;
    margin-bottom: 25px;
    font-family: 'Georgia', serif;
}

.description {
    margin-bottom: 25px;
    color: #4e342e;
    line-height: 1.8;
    font-size: 16px;
    text-align: left;
    background: #fcf9f4;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #d7ccc8;
}

.book-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    padding: 12px;
    background: #f8f5f0;
    border-radius: 8px;
    border-left: 3px solid #d7ccc8;
}

.detail-label {
    font-size: 14px;
    color: #8d6e63;
    margin-bottom: 5px;
}

.detail-value {
    font-size: 16px;
    font-weight: 600;
    color: #4e342e;
}

.actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.quantity {
    display: flex;
    align-items: center;
    border: 1px solid #d9c7a7;
    border-radius: 8px;
    overflow: hidden;
}

.quantity-btn {
    width: 40px;
    height: 50px;
    background: #f8f5f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.3s;
    color: #5d4037;
}

.quantity-btn:hover {
    background: #e9e1d5;
}

.quantity-input {
    width: 50px;
    height: 50px;
    text-align: center;
    border: none;
    border-left: 1px solid #d9c7a7;
    border-right: 1px solid #d9c7a7;
    font-size: 18px;
    color: #4e342e;
    background: #fff;
}

.add-to-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
    background: #8d6e63;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0 25px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    height: 50px;
    text-decoration: none;
    text-align: center;
    line-height: +1.1em;
    min-width: 170px;
}

.add-to-cart:hover {
    background: #6d4c41;
    text-decoration: none;
}

.wishlist {
    width: 50px;
    height: 50px;
    border: 1px solid #d9c7a7;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #8d6e63;
}

.wishlist:hover, .wishlist.active {
    color: #e74c3c;
    border-color: #e74c3c;
}

.delivery-info {
    margin-top: 25px;
    background: #f8f5f0;
    border-radius: 8px;
    padding: 20px;
    border-top: 3px solid #d7ccc8;
}

.delivery-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.delivery-item:last-child {
    margin-bottom: 0;
}

.delivery-item i {
    color: #8d6e63;
    font-size: 20px;
    min-width: 24px;
}

.delivery-text {
    color: #5d4037;
}

.delivery-text strong {
    color: #4e342e;
}

        .book-specs {
            display: flex;
            gap: 15px;
            margin-top: 20px;
            flex-wrap: wrap;
        }
        
        .spec-item {
            background: #f8f5f0;
            padding: 10px 15px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .spec-item i {
            color: #8d6e63;
        }
        
/* Подвал */
footer {
    background: #5d4037;
    color: #d7ccc8;
    padding: 40px 0 20px;
    margin-top: 50px;
}

.footer-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-column h3 {
    color: #f8f5f0;
    font-size: 20px;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.footer-column h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 2px;
    background: #d7ccc8;
}

.footer-column ul {
    list-style: none;
}

.footer-column ul li {
    margin-bottom: 12px;
}

.footer-column ul li a {
    color: #d7ccc8;
    text-decoration: none;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-column ul li a:hover {
    color: white;
}

.footer-column p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.social-links a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    transition: all 0.3s;
}

.social-links a:hover {
    background: #8d6e63;
    transform: translateY(-3px);
}

.copyright {
    text-align: center;
    padding-top: 30px;
    margin-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
    color: #bcaaa4;
}

/* Lightbox для полноэкранного просмотра */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    width: 90%;
    height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.lightbox-close:hover {
    background: #e74c3c;
    transform: rotate(90deg);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 40px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.lightbox-nav:hover {
    background: #8d6e63;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 18px;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 15px;
    border-radius: 20px;
}

/* Адаптивность */
@media (max-width: 900px) {
    .header-container {
        flex-wrap: no-wrap;
    }
    
    .logo {
        max-width: 40%;
    }
    
    .logo-text {
        font-size: 17px;
        line-height: normal;
    }
    
    .search-bar {
        max-width: 60%;
        margin: 15px 0 0;
    }
    
    .nav-icons {
        margin-left: auto;
    }
    
    footer {
        margin-top: 25px;
    } 
}

@media (max-width: 768px) {
    .header-container {
        flex-wrap: wrap;
    }
    .logo {
        max-width: 75%;
    }
    
    .logo-text {
        font-size: 16px;

    }
    .search-bar {
        order: 3;
        flex: 0 0 100%; /* Занимает всю ширину */
        margin-top: 10px;
        max-width: 100%;
    }
    .container {
        margin: 0px 0px;
        padding: 0px 0px;
    }
    
    .product-container {
        flex-direction: column;
        padding: 20px;
        margin: 0px 0px;
        border-radius: 0px;
    }
    
    .product-category.breadcrumb {
        font-size: 14px;
        gap: 5px;
    }
    
    .product-category.breadcrumb.separator {
        font-size: 10px;
    }
    
    .main-image {
        height: 350px;
    }
    
    .product-title {
        font-size: 26px;
    }
    
    .product-author {
        font-size: 20px;
    }
    
    .price {
        font-size: 28px;
    }
    
    .actions {
        /*flex-direction: column;*/
    }
    
    .quantity {
        width: 100%;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        margin-left: 20px;
        margin-right: 20px;
    }
    
    .filters {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .sort-form {
        width: 100%;
        justify-content: space-between;
    }
   
    
    .sort-select {
        flex-grow: 1;
    }
    
    .section-title{
        margin-left:20px;
        font-size: 1.6em;
    }    
    
    /* Замена миниатюр на точки */
    .thumbnails {
        display: none;
    }
    
    .dots-container {
        display: flex;
    }
    
    .thumbnail {
        width: 70px;
        height: 55px;
    }
    
    footer {
        margin-top: 0px;
    }    
}

@media (max-width: 650px) {
    .thumbnail {
        width: 60px;
        height: 45px;
    }
    .product-title {
        font-size: 20px;
    }
}

@media (max-width: 600px) {
    .thumbnail {
        width: 55px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .add-to-cart {
        padding: 0 15px;
        font-size: 16px;
    }
    .nav-icons {
        gap: 15px;
    }
    
    .books-grid {
        grid-template-columns: 1fr;
    }
    
    .main-image {
        height: 300px;
    }
    
    .book-details-grid {
        grid-template-columns: 1fr;
    }
    
    .book-bottom {
        /*flex-direction: column; */
        align-items: flex-start;
        gap: 15px;
    }
    /*
    .book-actions {
        width: 100%;
        justify-content: space-between;
    }*/
    
    .btn-cart {
       /* flex-grow: 1; */
    }
    
    .thumbnails {
        justify-content: center;
    }
    
    header {
        padding: 6px 0;
    }
    
    .logo i {
        font-size: 22px;
    }
    
    .nav-icons a {
        font-size: 16px;
    }
    
    .search-bar {
        margin: 8px 0 0;
    }
    
    .search-bar input {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .product-container {
        padding: 15px;
        /*margin: 15px 0; */
    }
    
    .thumbnail {
        width: 50px;
        height: 35px;
    }
}

@media (max-width: 360px) {
    .nav-icons {
        gap: 10px;
    }
    
    .logo i {
        font-size: 20px;
    }
    
    .badge {
        width: 14px;
        height: 14px;
        top: -6px;
        right: -6px;
    }
    
    .thumbnail {
        width: 45px;
        height: 32px;
    }
 
}