/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    /* Optimize rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Reduce flash on navigation */
    opacity: 1;
    transition: opacity 0.1s ease-in-out;
}

/* Prevent flash during page transitions */
body.loading {
    opacity: 0.98;
}

/* Header Styles */
.header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

/* Logo Styles */
.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
}

.logo-img {
    height: 40px;
    width: auto;
    margin-right: 10px;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #e67f0d;
}

/* Desktop Navigation */
.nav-desktop {
    display: none;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-link {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 10px 15px;
    border-radius: 5px;
    transition: all 0.3s ease;
    will-change: background-color, color;
}

.nav-link:hover {
    background-color: #e67f0d;
    color: white;
}

.nav-link:active {
    transform: scale(0.98);
}

/* Mobile Controls */
.mobile-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Mobile Cart Button */
.mobile-cart-btn {
    display: flex;
    align-items: center;
    position: relative;
    color: #333;
    font-size: 1.2rem;
    text-decoration: none;
    padding: 8px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.mobile-cart-btn:hover {
    color: #e67f0d;
}

.mobile-cart-btn .cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #e67f0d;
    color: white;
    border-radius: 50%;
    padding: 2px 5px;
    font-size: 0.7rem;
    font-weight: 500;
    min-width: 16px;
    text-align: center;
    display: none;
}

.mobile-cart-btn .cart-count.show {
    display: block;
}

.mobile-cart-btn.hidden {
    display: none;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background-color: #333;
    transition: all 0.3s ease;
}

.mobile-menu-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Navigation */
.nav-mobile {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-mobile.active {
    display: block;
}

.nav-mobile-list {
    list-style: none;
    padding: 20px;
}

.nav-mobile-list li {
    margin-bottom: 15px;
}

.nav-mobile-link {
    display: block;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 15px 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-mobile-link:hover {
    background-color: #f0f0f0;
    color: #e67f0d;
}

/* Main Content */
main {
    min-height: calc(100vh - 70px);
}

.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.page-container h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #e67f0d;
}

.page-container p {
    font-size: 1.1rem;
    color: #666;
    line-height: 1.8;
}

/* Desktop Styles */
@media (min-width: 768px) {
    .nav-desktop {
        display: block;
    }

    .mobile-controls {
        display: none;
    }

    .nav-mobile {
        display: none !important;
    }

    .header-container {
        padding: 0 40px;
    }

    .page-container {
        padding: 60px 40px;
    }
}

/* Mobile Search Styles */
@media (max-width: 767px) {
    .search-bar-wrapper {
        padding: 15px;
    }

    .search-results {
        padding: 0 15px 15px;
    }

    .search-result-item {
        padding: 12px;
    }

    .search-result-thumbnail {
        width: 50px;
        height: 50px;
    }
}

/* Cart Count Badge - Available on all pages */
.cart-count {
    background-color: #e67f0d;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.75rem;
    margin-left: 5px;
    display: none;
    font-weight: 500;
    min-width: 16px;
    text-align: center;
}

.cart-count.show {
    display: inline-block;
}

/* Cart badge update animation */
@keyframes cartBadgeFlash {
    0% { background-color: #e67f0d; }
    50% { background-color: #888; }
    100% { background-color: #e67f0d; }
}

.cart-count.flash {
    animation: cartBadgeFlash 0.8s ease-in-out;
}

/* Search Icon Button */
.search-icon-btn {
    background: none;
    border: none;
    color: #333;
    font-size: 1.1rem;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-icon-btn:hover {
    background-color: #f0f0f0;
    color: #e67f0d;
}

.search-icon-btn:active {
    transform: scale(0.95);
}

/* Search icon in desktop nav */
.nav-desktop .search-icon-btn {
    background: none;
    border: none;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 10px 15px;
    border-radius: 5px;
    transition: all 0.3s ease;
    will-change: background-color, color;
}

.nav-desktop .search-icon-btn:hover {
    background-color: #e67f0d;
    color: white;
}

.nav-desktop .search-icon-btn:active {
    transform: scale(0.98);
}

/* Mobile search button */
.mobile-search-btn {
    display: flex;
    align-items: center;
    position: relative;
    color: #333;
    font-size: 1.1rem;
    padding: 8px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.mobile-search-btn:hover {
    color: #e67f0d;
}

/* Search Container */
.search-container {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 999;
    max-height: 70vh;
    overflow-y: auto;
}

.search-container.active {
    display: block;
}

.search-bar-wrapper {
    display: flex;
    align-items: center;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.search-input {
    flex: 1;
    padding: 12px 20px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    outline: none;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    border-color: #e67f0d;
}

.search-close-btn {
    position: absolute;
    right: 30px;
    background: none;
    border: none;
    color: #666;
    font-size: 1.2rem;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.search-close-btn:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* Search Results */
.search-results {
    padding: 0 20px 20px;
    max-width: 800px;
    margin: 0 auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-result-item:hover {
    background-color: #e8e8e8;
    transform: translateX(5px);
}

.search-result-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
    margin-right: 15px;
}

.search-result-content {
    flex: 1;
}

.search-result-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.search-result-section {
    font-size: 0.9rem;
    color: #666;
}

.search-no-results {
    text-align: center;
    padding: 30px;
    color: #666;
}

/* Large Desktop */
@media (min-width: 1200px) {
    .page-container h1 {
        font-size: 3rem;
    }
}