@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;700;800&family=Merriweather:ital,wght@0,300;0,400;0,700;1,300;1,400&subset=latin-ext&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #1a1a1a;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    font-family: 'Merriweather', serif;
    background-image: radial-gradient(circle at center, #333 0%, #111 100%);
}

.scene {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1500px; /* 3D derinlik algısı */
}

.book {
    position: relative;
    width: 1000px;
    height: 700px;
    transform-style: preserve-3d;
    transition: transform 1s ease;
}

/* Sayfaların Genel Yapısı */
.page {
    position: absolute;
    top: 5px;
    right: 0;
    width: 500px; /* Kitabın yarısı genişliğinde (Düz dururken sağda) */
    height: 690px;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform 1.2s cubic-bezier(0.645, 0.045, 0.355, 1); /* Gerçekçi sayfa çevirme dinamiği */
    cursor: pointer;
}

/* Yüzlerin (Ön ve Arka) Ayarları */
.front, .back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    padding: 30px;
    background-color: #f5f3e9; /* Eski sararmış kitap sayfası rengi */
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1); /* Kağıt dokusu hissiyatı */
    color: #332b22;
    overflow: hidden;
}

/* Sayfaların ön yüzeyinde kitabın cilt gölgesi (sol tarafta karanlık) */
.front {
    transform: rotateY(0deg);
    background-image: linear-gradient(to right, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0) 10%);
}

/* Sayfaların arka yüzeyinde kitabın cilt gölgesi (çevrildiğinde cilt sağda kalır) */
.back {
    transform: rotateY(180deg);
    background-image: linear-gradient(to left, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0) 10%);
}

/* Çevrilen durum (Sola yatık) */
.page.flipped {
    transform: rotateY(-180deg);
}


/* -- Özel Kapak Tasarımları -- */
.cover {
    top: 0;
    width: 505px; /* Kapaklar sayfalardan azıcık büyüktür */
    height: 700px;
    border-radius: 2px 10px 10px 2px;
}

.cover .front, .cover .back {
    background-color: #4a2e1b;
    color: #e2c076;
    border: 2px solid #361f10;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
}

.cover .front {
    border-radius: 0 10px 10px 0;
    background-image: url('https://www.transparenttextures.com/patterns/leather.png'); /* Kapak dokusu efekti */
}

.cover .back {
    border-radius: 10px 0 0 10px;
}

.cover.front-cover {
    z-index: 10;
}

.front-cover .front {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.front-cover h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.8);
}

.front-cover p {
    font-style: italic;
    opacity: 0.8;
}

/* Kitap Sırtı Efekti (Deri kapaklarda görünen cilt kalınlığı) */
.book-spine {
    position: absolute;
    top: 0;
    left: 0;
    width: 25px;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0.4) 100%);
    box-shadow: 2px 0 5px rgba(0,0,0,0.5);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.back-cover .back {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-image: url('https://www.transparenttextures.com/patterns/leather.png');
}

.back-cover .right-spine {
    left: auto;
    right: 0;
    background: linear-gradient(to left, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0.4) 100%);
}


/* -- İçerik Tasarımı -- */
.page h2 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    margin-top: 5px;
    text-align: center;
    border-bottom: 2px solid rgba(0,0,0,0.1);
    padding-bottom: 8px;
}

.page p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 12px;
    text-align: justify;
}

.page-number {
    position: absolute;
    bottom: 20px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    color: #666;
    margin: 0 !important;
}

/* Sağ vərəq (front) - səhifə nömrəsi sağda */
.front .page-number {
    right: 30px;
    left: auto;
}

/* Sol vərəq (back) - səhifə nömrəsi solda */
.back .page-number {
    left: 30px;
    right: auto;
}

/* Kapağı açarken sayfaların görünümünü derinleştiren 3D Efekt için ekstra kalınlık simülasyonu */
.page::after {
    content: '';
    position: absolute;
    top: 0;
    right: -1px;
    width: 1px;
    height: 100%;
    background-color: #d8d3bf;
}
  
/* -- Kart Dizayni (Kateqoriyalar) -- */  
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 15px; padding-bottom: 20px; }
.category-card { background: #fff; border: 1px solid #e0d9ca; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 15px 10px; transition: transform 0.2s, box-shadow 0.2s; cursor: pointer; }
.category-card:hover { transform: translateY(-5px); box-shadow: 0 6px 12px rgba(0,0,0,0.1); border-bottom: 3px solid #e2c076; }
.category-card .icon { font-size: 2.5rem; margin-bottom: 10px; }  
.category-card .title { font-family: 'Montserrat', sans-serif; font-size: 0.95rem; font-weight: 700; color: #4a2e1b; }  
.category-card .desc { font-size: 0.8rem; color: #777; margin-top: 5px; line-height: 1.3; margin-bottom: 0px; } 
  
/* -- Product Cards -- */
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.product-card { border: 1px solid #ddd; border-radius: 5px; padding: 8px; text-align: center; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.03); cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
.product-card:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); border-color: #e2c076; }
.product-card .img-box { width: 100%; height: 90px; background: #f4f4f4; border-radius: 4px; margin-bottom: 6px; display: flex; align-items: center; justify-content: center; color: #999; border: 1px dashed #ccc; font-size: 0.8rem; }
.product-card h4 { font-size: 0.8rem; font-family: 'Montserrat', sans-serif; color: #4a2e1b; margin-bottom: 3px; }

/* -- Səhifələmə İndikatoru -- */
.pagination-indicator {
    text-align: center;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    color: #888;
    margin-top: 8px;
    padding: 4px 12px;
    background: rgba(74, 46, 27, 0.1);
    border-radius: 12px;
    display: inline-block;
    position: absolute;
    bottom: 75px;
    left: 50%;
    transform: translateX(-50%);
}

/* -- Kataloqa Qayıt Düyməsi -- */
.back-to-catalog-btn {
    position: absolute;
    bottom: 45px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #4a2e1b 0%, #6b4423 100%);
    color: #e2c076;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(74, 46, 27, 0.3);
    z-index: 5;
}

.back-to-catalog-btn:hover {
    background: linear-gradient(135deg, #5a3e2b 0%, #7b5433 100%);
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 46, 27, 0.4);
}

.back-to-catalog-btn .btn-icon {
    font-size: 1rem;
    line-height: 1;
}

/* -- Product Modal -- */
.product-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-modal.active {
    display: flex;
    opacity: 1;
}

.product-modal-content {
    background: #f5f3e9;
    border-radius: 12px;
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.8) translateY(20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.product-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    border: none;
    padding: 0;
    font-size: 2rem;
    line-height: 1;
    color: #666;
    cursor: pointer;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.8);
    transition: all 0.2s;
}

.product-modal-close:hover {
    background: #4a2e1b;
    color: #fff;
}

.product-modal-image {
    width: 100%;
    height: 300px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #e0d9ca;
}

.product-modal-image img {
    max-width: 90%;
    max-height: 280px;
    object-fit: contain;
}

.product-modal-info {
    padding: 25px 30px 30px;
}

.product-modal-info h2 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.4rem;
    color: #4a2e1b;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2c076;
}

.product-modal-info p {
    font-family: 'Merriweather', serif;
    font-size: 1rem;
    line-height: 1.7;
    color: #444;
    margin-bottom: 20px;
}

.product-modal-contact {
    background: #4a2e1b;
    color: #e2c076;
    padding: 12px 20px;
    border-radius: 8px;
    text-align: center;
}

.product-modal-contact p {
    margin: 0;
    color: #e2c076;
    font-size: 0.95rem;
}

/* ======================= */
/* MOBILE RESPONSIVE       */
/* ======================= */

/* Tablet (768px və aşağı) */
@media (max-width: 1024px) {
    .book {
        width: 700px;
        height: 500px;
    }

    .page {
        width: 350px;
        height: 490px;
    }

    .cover {
        width: 355px;
        height: 500px;
    }

    .front, .back {
        padding: 20px;
    }

    .page h2 {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }

    .page p {
        font-size: 0.85rem;
        line-height: 1.5;
        margin-bottom: 8px;
    }

    .front-cover h1 {
        font-size: 2rem;
    }

    .front-cover .front img {
        max-width: 180px !important;
    }

    .card-grid {
        gap: 10px;
    }

    .category-card {
        padding: 10px 8px;
    }

    .category-card .icon {
        font-size: 2rem;
    }

    .category-card .title {
        font-size: 0.8rem;
    }

    .product-card .img-box {
        height: 70px;
    }

    .product-card h4 {
        font-size: 0.7rem;
    }
}

/* Mobil (600px və aşağı) - Tək səhifə görünüşü */
@media (max-width: 600px) {
    body {
        overflow-x: hidden;
        overflow-y: auto;
    }

    .scene {
        perspective: none;
        height: auto;
        min-height: 100vh;
        padding: 10px;
    }

    .book {
        width: 100%;
        max-width: 400px;
        height: auto;
        transform-style: flat;
    }

    .page {
        position: relative;
        width: 100%;
        height: auto;
        min-height: 500px;
        transform-origin: center center;
        transform: none !important;
        margin-bottom: 10px;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    }

    .page.flipped {
        transform: none !important;
    }

    .front, .back {
        position: relative;
        width: 100%;
        height: auto;
        min-height: 480px;
        padding: 20px 15px;
        transform: none !important;
        backface-visibility: visible;
        border-radius: 8px;
    }

    .back {
        display: block;
        border-top: 1px solid #d8d3bf;
    }

    .page.flipped .front {
        display: block;
    }

    .back-cover .front {
        display: none;
    }

    .cover {
        width: 100%;
        height: auto;
        min-height: 300px;
        border-radius: 8px;
    }

    .cover .front, .cover .back {
        min-height: 280px;
        border-radius: 8px;
    }

    .book-spine {
        display: none;
    }

    .front-cover h1 {
        font-size: 1.6rem;
    }

    .front-cover .front img {
        max-width: 150px !important;
    }

    .page h2 {
        font-size: 1.1rem;
        margin-bottom: 10px;
        padding-bottom: 6px;
    }

    .page p {
        font-size: 0.8rem;
        line-height: 1.5;
        margin-bottom: 8px;
    }

    .page ul {
        margin-left: 15px !important;
    }

    .page li {
        font-size: 0.8rem !important;
        line-height: 1.4 !important;
    }

    .page h3 {
        font-size: 1rem !important;
    }

    .page-number {
        bottom: 10px;
        font-size: 0.7rem;
    }

    .front .page-number {
        right: 15px;
    }

    .back .page-number {
        left: 15px;
    }

    /* Kataloqa qayıt düyməsi - mobil */
    .back-to-catalog-btn {
        position: absolute;
        bottom: 35px;
        left: 50%;
        transform: translateX(-50%);
        padding: 10px 20px;
        font-size: 0.8rem;
        width: auto;
    }

    .back-to-catalog-btn:hover {
        transform: translateX(-50%) translateY(-2px);
    }

    /* Kateqoriya kartları */
    .card-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 10px;
    }

    .category-card {
        padding: 12px 8px;
    }

    .category-card .icon {
        font-size: 1.8rem;
        margin-bottom: 6px;
    }

    .category-card .title {
        font-size: 0.7rem;
    }

    /* Məhsul kartları */
    .product-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .product-card {
        padding: 6px;
    }

    .product-card .img-box {
        height: 60px;
    }

    .product-card h4 {
        font-size: 0.65rem;
        margin-top: 6px !important;
    }

    /* Mobil Modal */
    .product-modal-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 10px;
    }

    .product-modal-image {
        height: 200px;
    }

    .product-modal-image img {
        max-height: 180px;
    }

    .product-modal-info {
        padding: 15px 20px 20px;
    }

    .product-modal-info h2 {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }

    .product-modal-info p {
        font-size: 0.9rem;
        line-height: 1.6;
        margin-bottom: 15px;
    }

    .product-modal-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 1.5rem;
    }

    .product-modal-contact {
        padding: 10px 15px;
    }

    .product-modal-contact p {
        font-size: 0.85rem;
    }

    /* Əlaqə səhifəsi */
    .contact-info p {
        font-size: 0.95rem !important;
    }

    .contact-info a {
        font-size: 1.2rem !important;
    }
}

/* Çox kiçik ekranlar (400px və aşağı) */
@media (max-width: 400px) {
    .page {
        min-height: 450px;
    }

    .front, .back {
        min-height: 430px;
        padding: 15px 12px;
    }

    .page h2 {
        font-size: 1rem;
    }

    .page p {
        font-size: 0.75rem;
    }

    .category-card .icon {
        font-size: 1.5rem;
    }

    .category-card .title {
        font-size: 0.65rem;
    }

    .product-card .img-box {
        height: 50px;
    }

    .product-card h4 {
        font-size: 0.6rem;
    }

    .product-modal-image {
        height: 150px;
    }

    .product-modal-info h2 {
        font-size: 1rem;
    }

    .product-modal-info p {
        font-size: 0.85rem;
    }
}
