/* =================================================================
   GLOBAL STYLESHEET FOR BOOKZ STORE
   ================================================================= */

/* --- 1. ROOT VARIABLES & BASIC SETUP --- */
:root {
    --primary: #0f172a;
    --accent: #d4af37;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: 1px solid rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --blur-amt: 16px;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--primary);
    background: linear-gradient(to bottom, #e0e8f0, #ffffff);
    overflow-x: hidden;
    position: relative;
}

h1,
h2,
h3,
h4,
h5 {
    font-family: 'Playfair Display', serif;
}

.bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 10% 10%, rgba(212, 175, 55, 0.15), transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(15, 23, 42, 0.1), transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.8), transparent 100%);
}

/* --- 2. COMPONENTS --- */

/* --- Preloader --- */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f0f4f8;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.75s ease, visibility 0.75s ease;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(15, 23, 42, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Glass Panel (General Purpose) --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-amt));
    -webkit-backdrop-filter: blur(var(--blur-amt));
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* --- Navbar --- */
.header-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1030;
    transition: all 0.4s ease;
    padding: 0;
}

.header-container.scrolled {
    padding-top: 15px;
    padding-left: 2.5%;
    padding-right: 2.5%;
}

.navbar {
    transition: all 0.4s ease;
    padding: 15px 0;
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50px;
}

.navbar {
    width: 100%;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 0;
}

.navbar-brand span {
    font-weight: 800;
    letter-spacing: -0.5px;
    font-size: 1.6rem;
}

.nav-link {
    font-weight: 600;
    color: var(--primary) !important;
    position: relative;
    padding: 10px 15px !important;
    border-radius: 8px;
    transition: all 0.3s;
}

.nav-link:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--accent) !important;
}

.nav-link::after {
    display: none;
}

/* --- Search Bar Hover Effect --- */
.search-form-hover {
    display: flex;
    align-items: center;
    transition: all 0.4s ease;
    position: relative;
}

.search-form-hover .search-input {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%) scaleX(0);
    transform-origin: right;
    width: 200px;
    border: none;
    border-bottom: 2px solid var(--primary);
    background-color: transparent;
    outline: none;
    font-size: 1rem;
    color: var(--primary);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding: 8px 10px;
}

.search-form-hover .search-button {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--primary);
    cursor: pointer;
    padding: 8px;
}

.search-form-hover:hover .search-input {
    transform: translateY(-50%) scaleX(1);
}

/* --- Buttons --- */
.btn-primary-glass {
    background: var(--primary);
    color: white;
    border-radius: 50px;
    padding: 10px 30px;
    font-weight: 600;
    transition: 0.3s;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.2);
    border: none;
}

.btn-primary-glass:hover {
    background: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(212, 175, 55, 0.3);
}

/* --- Modals (Login/Register) --- */
.modal-content {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* --- Footer --- */
footer {
    margin-top: 80px;
    background: linear-gradient(to top, #0f172a 0%, #1e293b 100%);
    color: white;
    padding: 60px 0 20px;
    position: relative;
    overflow: hidden;
}

.footer-wave {
    position: absolute;
    top: -50px;
    left: 0;
    width: 100%;
    line-height: 0;
}

.footer-link:hover {
    color: white !important;
    padding-left: 5px;
    transition: all 0.3s ease;
}

.social-icon {
    transition: color 0.3s ease, transform 0.3s ease;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.social-name {
    font-size: inherit;
    font-weight: 600;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.4s ease-out, opacity 0.3s ease, margin-left 0.4s ease-out;
    white-space: nowrap;
    margin-left: 0;
}

.social-icon:hover .social-name {
    max-width: 100px;
    opacity: 1;
    margin-left: 0.5em;
}

.social-icon:hover {
    transform: scale(1.2);
}

.social-icon-facebook:hover {
    color: #1877F2 !important;
}

.social-icon-instagram:hover {
    color: #E4405F !important;
}

.social-icon-twitter:hover {
    color: #1DA1F2 !important;
}

.social-icon-youtube:hover {
    color: #FF0000 !important;
}

.social-icon-pinterest:hover {
    color: #E60023 !important;
}

.social-icon-tiktok:hover {
    color: #000000 !important;
}

.footer-logos-section {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-logo-group h6 {
    color: var(--accent);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.footer-logo-item img {
    max-height: 30px;
    max-width: 60px;
    object-fit: contain;
    transition: all 0.3s ease;
}

.footer-logo-item:hover img {
    transform: scale(1.15);
}

/* --- Scroll to Top Button --- */
#scrollTopBtn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    z-index: 1000;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    text-decoration: none;
    opacity: 0;
    transform: translateY(20px);
    visibility: hidden;
}

#scrollTopBtn.show {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

#scrollTopBtn:hover {
    background: var(--accent);
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(212, 175, 55, 0.3);
}

/* --- Snow Effect --- */
.snowflake {
    position: fixed;
    top: -10px;
    background: white;
    border-radius: 50%;
    opacity: 0.7;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #b0e0e6;
    animation: fall linear infinite;
}

@keyframes fall {
    to {
        transform: translateY(105vh);
    }
}

/* --- Swiper (Carousel) --- */
.swiper-button-next,
.swiper-button-prev {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    color: var(--primary) !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.swiper-button-next:hover,
.swiper-button-prev:hover {
    background: var(--primary);
    color: white !important;
}

.swiper-button-next::after,
.swiper-button-prev::after {
    font-size: 1.2rem !important;
}

/* --- 3. PAGE-SPECIFIC & REUSABLE BLOCKS --- */

/* --- Hero Section (index.php) --- */
.hero-wrapper {
    padding-top: 120px;
    padding-bottom: 50px;
}

.hero-slider {
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* --- Promo Cards (index.php, deals.php) --- */
.promo-card {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: 0.3s;
}

.promo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.promo-icon {
    font-size: 2rem;
    color: var(--primary);
    margin-right: 15px;
}

/* --- Category Cards (index.php) --- */
.category-glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: 0.3s;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.category-glass-card:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* --- Book Card Style 1 (index.php new arrivals) --- */
.book-card-glass {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 15px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.book-card-glass:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border-color: var(--accent);
}

.book-img-wrapper {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;
    aspect-ratio: 2/3;
}

.book-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.5s;
}

.book-card-glass:hover .book-img-wrapper img {
    transform: scale(1.1);
}

.action-overlay {
    position: absolute;
    bottom: -50px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 10px;
    transition: 0.3s;
    padding-bottom: 10px;
}

.book-card-glass:hover .action-overlay {
    bottom: 10px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    transition: 0.3s;
    text-decoration: none;
}

.btn-icon:hover {
    background: var(--accent);
    transform: rotate(90deg);
}

/* --- Badge Styles (New, Hot, Sale) --- */
.badge-glass {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 120px;
    height: 120px;
    overflow: hidden;
    z-index: 3;
}

.badge-glass span {
    position: absolute;
    display: block;
    width: 160px;
    padding: 8px 0;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    color: #fff;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    font-size: 0.8rem;
    transform: rotate(-45deg) translateY(-20px);
    left: -40px;
    top: 32px;
}

.badge-new span {
    background: linear-gradient(45deg, #3b82f6, #60a5fa);
}

.badge-hot span {
    background: linear-gradient(45deg, #ef4444, #f87171);
}

.badge-sale span {
    background: linear-gradient(45deg, #f59e0b, #fcd34d);
}

.badge-best span {
    background: linear-gradient(45deg, var(--accent), #e7c86a);
    color: var(--primary) !important;
}


/* --- Book Card Style 2 (Product.php) --- */
.product-card {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border: var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
    z-index: 2;
}

.card-img-top-wrapper {
    position: relative;
    overflow: hidden;
    padding-top: 150%;
    /* Aspect Ratio 2:3 */
}

.card-img-top-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.product-card:hover .card-img-top-wrapper img {
    transform: scale(1.08);
}

.card-actions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 10px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3;
}

.product-card:hover .card-actions {
    opacity: 1;
    top: 50%;
}

.btn-action {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: white;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: 0.2s;
    text-decoration: none;
}

.btn-action:hover {
    background: var(--primary);
    color: var(--accent);
    transform: scale(1.1);
}

.card-body-glass {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.book-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    margin-bottom: 5px;
}

.book-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 5px;
    line-height: 1.3;
}

.book-author {
    font-size: 0.9rem;
    color: #64748b;
}

.price-wrapper {
    margin-top: auto;
    padding-top: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.current-price {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

.old-price {
    text-decoration: line-through;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-left: 5px;
}

/* --- Pagination (Product.php) --- */
.pagination .page-link {
    border: none;
    background: rgba(255, 255, 255, 0.5);
    color: var(--primary);
    margin: 0 5px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    color: var(--accent);
    box-shadow: 0 5px 15px rgba(15, 23, 42, 0.3);
}

/* --- Bestsellers Section (index.php) --- */
.bestseller-section {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.1));
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    padding: 60px 0;
    margin-top: 60px;
}

.bestseller-card {
    background: transparent;
    padding: 10px;
}

.rank-number {
    font-size: 4rem;
    font-weight: 900;
    color: rgba(15, 23, 42, 0.1);
    position: absolute;
    top: -20px;
    right: 0;
    z-index: 0;
    line-height: 1;
}

/* --- Deals Section (index.php) --- */
.deal-wrapper {
    background: linear-gradient(135deg, var(--primary), #1e293b);
    border-radius: 30px;
    overflow: hidden;
    position: relative;
    color: white;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
}

.deal-content {
    padding: 50px;
    z-index: 2;
    position: relative;
}

.deal-timer-box {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    padding: 10px 20px;
    border-radius: 10px;
    margin: 0 5px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.deal-timer-number {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
    color: var(--accent);
}

.deal-timer-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.deal-image-container {
    position: relative;
    height: 100%;
    min-height: 400px;
}

.deal-image {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 90%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(-20px 20px 30px rgba(0, 0, 0, 0.5));
    transform: scale(1.1) translateY(20px);
}

/* --- News Section (index.php) --- */
.news-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    transition: 0.3s;
    border: 1px solid rgba(0, 0, 0, 0.05);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.news-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

.news-img {
    height: 200px;
    object-fit: cover;
    width: 100%;
}

.news-body {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.news-date {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.news-title {
    font-weight: 700;
    margin-bottom: 10px;
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
}

.read-more-link {
    margin-top: auto;
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.read-more-link:hover {
    color: var(--accent);
}

/* --- 4. THIRD-PARTY LIBRARY STYLES --- */

/* --- noUiSlider (Price Range Slider) --- */
.noUi-target {
    background: #e9ecef;
    border-radius: 5px;
    border: none;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.noUi-connect {
    background: var(--primary);
}
.noUi-handle {
    border: 3px solid white;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: grab;
}
.noUi-handle:focus {
    outline: none;
}
.noUi-handle.noUi-active {
    cursor: grabbing;
}