/* ============================================================
   RAYAS Bookstore — Custom Styles
   ============================================================ */

/* --- Base & Typography --- */
html {
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Header Scroll Shadow --- */
.header-scrolled {
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

/* --- Search Overlay Transitions --- */
.search-overlay-enter {
    animation: slideDown 0.3s ease-out forwards;
}

.search-overlay-leave {
    animation: slideUp 0.2s ease-in forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-100%);
    }
}

/* --- Cart Badge Pulse --- */
.cart-badge-pulse {
    animation: badgePulse 0.4s ease-out;
}

@keyframes badgePulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* --- Mobile Menu Slide --- */
.mobile-drawer {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Book Card Hover Effects --- */
.book-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.book-card .book-cover {
    transition: transform 0.3s ease;
    overflow: hidden;
}

.book-card:hover .book-cover img {
    transform: scale(1.03);
}

/* --- Discount Badge --- */
.discount-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 4px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
    letter-spacing: 0.02em;
}

/* --- Price Display --- */
.price-original {
    text-decoration: line-through;
    color: #9ca3af;
    font-size: 0.85em;
}

.price-discounted {
    color: #dc2626;
    font-weight: 700;
}

/* --- Section Headings --- */
.section-heading {
    position: relative;
    display: inline-block;
    padding-bottom: 8px;
}

.section-heading::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 48px;
    height: 3px;
    background: linear-gradient(90deg, #4f46e5, #818cf8);
    border-radius: 2px;
}

/* --- Horizontal Book Scroll Container --- */
.book-scroll {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c7d2fe transparent;
    padding-bottom: 8px;
}

.book-scroll::-webkit-scrollbar {
    height: 6px;
}

.book-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.book-scroll::-webkit-scrollbar-thumb {
    background: #c7d2fe;
    border-radius: 3px;
}

.book-scroll > * {
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* --- Skeleton Loading Placeholder --- */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Toast Notification --- */
.toast-enter {
    animation: toastIn 0.35s ease-out forwards;
}

.toast-leave {
    animation: toastOut 0.25s ease-in forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-12px) scale(0.96);
    }
}

/* --- Footer Link Hover --- */
.footer-link {
    position: relative;
    transition: color 0.2s ease;
}

.footer-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width 0.25s ease;
}

.footer-link:hover::after {
    width: 100%;
}

/* --- AOS Overrides — prevent horizontal overflow --- */
[data-aos] {
    overflow-anchor: none;
}

body {
    overflow-x: hidden;
}

/* --- Active Nav Indicator --- */
.nav-link-active {
    position: relative;
}

.nav-link-active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}

/* --- Language Toggle --- */
.lang-toggle {
    transition: all 0.2s ease;
}

.lang-toggle:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

/* --- Responsive Image Container --- */
.img-cover {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* --- Custom Focus Ring --- */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
}

/* --- Fade-in Utility --- */
.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
