/* Base Styles using Tailwind directives handled via CDN, adding custom overrides here */
/* Global Overflow Fix */
html,
body {
    overflow-x: hidden !important;
    width: 100% !important;
    position: relative;
    margin: 0;
    padding: 0;
}

/* Noise Texture Overlay */
.texture-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Parallax Hero */
.hero-bg {
    background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.8)), url('../assest/italian-food-masliny-sous-pomidory-spetsii-khleb-bazilik.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* Menu Dot Leaders */
.menu-item-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.menu-item-name {
    padding-right: 10px;
    background-color: transparent;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.menu-dots {
    flex-grow: 1;
    border-bottom: 1px dotted #d4af37;
    margin: 0 10px;
    opacity: 0.5;
    position: relative;
    top: -5px;
}

.menu-price {
    padding-left: 10px;
    font-weight: 600;
    color: #d4af37;
}

/* Scroll Animations */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Elegant Button Hover */
.btn-elegant {
    position: relative;
    overflow: hidden;
    transition: color 0.3s;
}

.btn-elegant::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-elegant:hover::before {
    left: 100%;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes widthGrow {
    to {
        opacity: 1;
        width: 6rem;
    }
}

/* Shopping Cart Styles */
#cart-sidebar {
    transition: transform 0.3s ease-in-out;
}

#cart-sidebar.open {
    transform: translateX(0);
}

.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Menu Dot Leaders (Classic Italian Menu Style) */
.menu-item-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.menu-item-name {
    padding-right: 10px;
    background-color: transparent;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.menu-dots {
    flex-grow: 1;
    border-bottom: 2px dotted rgba(212, 175, 55, 0.3);
    margin: 0 10px;
    position: relative;
    top: -5px;
    min-width: 10px;
}

@media (max-width: 640px) {
    .menu-dots {
        margin: 0 5px;
        top: -4px;
    }

    .menu-item-name {
        padding-right: 5px;
        max-width: 65%;
        /* Give more space to the name */
    }
}

.menu-price {
    padding-left: 10px;
    font-weight: 600;
    color: #d4af37;
    white-space: nowrap;
}

/* Italian Tricolor Border Gradient */
.italian-border-bottom {
    position: relative;
}

.italian-border-bottom::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, #008c45 33%, #ffffff 33%, #ffffff 66%, #c8102e 66%);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Hero & Responsive Optimizations */
@media (max-width: 768px) {
    .hero-bg {
        padding-bottom: 120px;
        background-attachment: scroll;
        /* Fix for parallax shaking on mobile */
    }

    .hero-btns {
        margin-bottom: 2rem;
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100vw;
        gap: 1rem;
        padding: 0 1.5rem;
        box-sizing: border-box;
    }

    .hero-btns a {
        width: 100%;
        text-align: center;
        margin: 0 !important;
    }

    /* Scaling for large titles */
    h1 {
        font-size: clamp(2.5rem, 10vw, 4rem) !important;
        line-height: 1.1 !important;
        word-break: break-word;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2.2rem !important;
    }

    .section-padding {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

.scroll-indicator {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.scroll-indicator:hover {
    opacity: 1;
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease forwards;
}

.animate-fadeOut {
    animation: fadeOut 0.3s ease forwards;
}

.animate-slideUp {
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Custom Form Styles */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: white;
    -webkit-box-shadow: 0 0 0px 1000px #000 inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* Hide floating cart button when sidebar is open */
body.cart-open .floating-cart {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #c8102e;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.animate-fadeIn {
    animation: fadeIn 0.4s ease-out forwards;
}

.animate-slideUp {
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Modal Detail Refinements */
#product-modal .animate-fadeIn {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#product-modal {
    z-index: 100;
}

/* Custom scrollbar for modal and cart */
#modal-product-description::-webkit-scrollbar,
#cart-items::-webkit-scrollbar {
    width: 4px;
}

#modal-product-description::-webkit-scrollbar-track,
#cart-items::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

#modal-product-description::-webkit-scrollbar-thumb,
#cart-items::-webkit-scrollbar-thumb {
    background: #d4af37aa;
    border-radius: 10px;
}

/* Ensure price and button alignment on mobile */
@media (max-width: 640px) {
    .menu-price-mobile {
        font-size: 1.1rem;
    }

    .add-btn-mobile {
        padding: 0.6rem 1.25rem;
    }
}

/* Custom Scrollbar for Modal */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.5);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}