/* Top promotional bar styles */
.top-promo-bar {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 8px 0;
    overflow: hidden;
    position: relative;
    z-index: 1000;
}

.promo-content {
    display: flex;
    animation: scroll-left 30s linear infinite;
    white-space: nowrap;
}

.promo-item {
    margin-right: 50px;
    font-size: 14px;
    font-weight: 500;
    display: inline-block;
}

@keyframes scroll-left {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* Main header styles */
.main-header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px 0;
    position: relative;
    z-index: 999;
}

.logo {
    display: flex;
    align-items: center;
}

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

.logo-text {
    font-size: 28px;
    font-weight: bold;
    color: #c77f7fff;
    text-decoration: none;
}

.site-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.site-logo:hover .logo-text {
    color: #c77f7fff;
    text-decoration: none;
}

/* Fix for logo display */
.site-logo .logo-text {
    display: inline-block;
    margin-left: 10px;
}

/* Search container */
.search-container {
    position: relative;
}

.search-form {
    width: 100%;
}

.input-group {
    position: relative;
    display: flex;
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-input {
    border: none;
    padding: 12px 20px;
    font-size: 16px;
    outline: none;
    flex: 1;
    background: #f8f9fa;
}

.search-input::placeholder {
    color: #6c757d;
}

.search-btn {
    background: #007bff;
    border: none;
    padding: 12px 20px;
    color: white;
    cursor: pointer;
    transition: background 0.3s ease;
}

.search-btn:hover {
    background: #0056b3;
}

/* User actions */
.user-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
}

.action-btn {
    position: relative;
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
    transition: color 0.3s ease;
}

.action-btn:hover {
    color: #007bff;
}

.account-link,
.cart-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.account-link:hover,
.cart-link:hover {
    background: #f8f9fa;
    text-decoration: none;
    color: #007bff;
}

.action-text {
    font-size: 14px;
    font-weight: 500;
}

.cart-count {
    background: #dc3545;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    min-width: 20px;
    text-align: center;
}

/* User dropdown */
.user-menu {
    position: relative;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
    min-width: 150px;
    display: none;
    z-index: 1000;
}

.user-menu:hover .user-dropdown {
    display: block;
}

.user-dropdown a {
    display: block;
    padding: 8px 20px;
    color: #333;
    text-decoration: none;
    transition: background 0.3s ease;
}

.user-dropdown a:hover {
    background: #f8f9fa;
    color: #007bff;
}

/* Mobile search */
.mobile-search-bar {
    background: #f8f9fa;
    padding: 10px 0;
    display: none;
}

.mobile-search-bar.active {
    display: block;
}

.mobile-search-form .input-group {
    border-radius: 8px;
}

.mobile-search {
    display: none;
}

@media (max-width: 767px) {
    .mobile-search {
        display: flex;
    }
    
    .user-actions {
        gap: 15px;
    }
    
    .action-text {
        display: none;
    }
}

/* Navigation bar */
.navigation-bar {
    background: linear-gradient(135deg, #007bff, #0056b3);
    padding: 0;
    box-shadow: 0 2px 10px rgba(0, 123, 255, 0.3);
}

.main-navigation {
    padding: 0;
}

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.nav-menu li {
    margin: 0;
}

.nav-menu li a {
    display: block;
    padding: 15px 25px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-menu li a:before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: white;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-menu li a:hover:before {
    width: 80%;
}

.nav-menu li a:hover {
    background: rgba(255, 255, 255, 0.2);
    text-decoration: none;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Categories bar - Design moderne */
.categories-bar {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 1px solid #dee2e6;
    border-bottom: 2px solid #007bff;
    padding: 15px 0;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 123, 255, 0.1);
}

.categories-scroll {
    position: relative;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
    padding: 5px 0;
}

.categories-scroll::-webkit-scrollbar {
    display: none;
}

.categories-scroll:active {
    cursor: grabbing;
}

.categories-container {
    display: flex;
    gap: 15px;
    padding: 0 20px;
    min-width: max-content;
}

.category-item {
    position: relative;
    white-space: nowrap;
}

.category-item a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    color: #495057;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-radius: 50px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-transform: capitalize;
    letter-spacing: 0.5px;
    overflow: hidden;
}

.category-item a .category-icon {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.category-item a .category-text {
    font-weight: 600;
    transition: all 0.3s ease;
}

.category-item a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.category-item a:hover::before {
    left: 0;
}

.category-item a:hover {
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.3);
    border-color: #007bff;
}

.category-item a:hover .category-icon {
    transform: scale(1.2) rotate(5deg);
}

.category-item a:hover .category-text {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Scroll buttons pour les catégories */
.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
}

.scroll-btn:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.scroll-left {
    left: 10px;
}

.scroll-right {
    right: 10px;
}

/* Category popup - Style mega menu professionnel */
.category-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 10000;
    justify-content: center;
    align-items: flex-start;
    padding-top: 160px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-popup.active {
    display: flex;
    opacity: 1;
}

.popup-content {
    background: white;
    border-radius: 12px;
    max-width: 1000px;
    width: 90%;
    max-height: 65vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-popup.active .popup-content {
    transform: translateY(0);
}

.popup-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px 12px 0 0;
    position: relative;
}

.popup-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    border-radius: 12px 12px 0 0;
}

.popup-header h4 {
    margin: 0;
    color: #333;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.popup-header h4:before {
    content: '🏷️';
    font-size: 18px;
}

.popup-body {
    padding: 0;
    background: #fff;
    max-height: 55vh;
    overflow-y: auto;
}

/* Mega menu container */
.mega-menu-container {
    display: flex;
    min-height: 320px;
}

.mega-menu-left {
    width: 30%;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    padding: 20px 0;
}

.mega-menu-right {
    width: 70%;
    padding: 20px;
    background: white;
}

/* Subcategories styling */
.subcategories-list {
    padding: 0 20px;
}

.subcategory-group {
    margin-bottom: 20px;
}

.subcategory-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #007bff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.subcategory-title:before {
    content: '▶';
    color: #007bff;
    font-size: 12px;
}

.subcategory-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.subcategory-items li {
    margin-bottom: 4px;
}

.subcategory-items a {
    color: #666;
    text-decoration: none;
    font-size: 13px;
    display: block;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
}

.subcategory-items a:hover {
    background: #007bff;
    color: white;
    text-decoration: none;
    transform: translateX(3px);
}

.subcategory-items a:before {
    content: '•';
    color: #007bff;
    margin-right: 6px;
    font-weight: bold;
}

.subcategory-items a:hover:before {
    color: white;
}

/* Featured products section */
.featured-products {
    height: 100%;
}

.featured-products-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.featured-products-title:before {
    content: '⭐';
    font-size: 16px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 8px;
}

.products-grid::-webkit-scrollbar {
    width: 4px;
}

.products-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.products-grid::-webkit-scrollbar-thumb {
    background: #007bff;
    border-radius: 10px;
}

.products-grid::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

.product-card {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: white;
    height: fit-content;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: #007bff;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.product-card:hover::before {
    transform: scaleX(1);
}

.product-image {
    width: 100%;
    height: 100px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.03);
}

.product-info {
    padding: 12px;
}

.product-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-title:hover {
    color: #007bff;
    text-decoration: none;
}

.product-price {
    font-size: 15px;
    font-weight: bold;
    color: #007bff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 2px;
}

.product-price::before {
    content: 'TND';
    font-size: 13px;
    opacity: 0.8;
}

/* Mega Menu Price Container Styling */
.product-card .price-container {
    position: relative;
    margin-top: 8px;
}

.product-card .discount-badge {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    padding: 2px 6px;
    font-size: 0.65rem;
    font-weight: bold;
    border-radius: 8px;
    position: absolute;
    top: -8px;
    right: 0;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.3);
    z-index: 1;
    animation: pulse 2s infinite;
}

.product-card .price-original {
    color: #999;
    font-size: 0.75rem;
    text-decoration: line-through;
    text-decoration-color: #e74c3c;
    text-decoration-thickness: 1.5px;
    margin-bottom: 3px;
    font-weight: 400;
}

.product-card .price-discounted {
    color: #e74c3c;
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 1px 2px rgba(231, 76, 60, 0.1);
}

/* Close button styling */
.popup-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.popup-close:hover {
    background: #f8f9fa;
    color: #007bff;
    transform: rotate(90deg);
}

/* Animation for content loading */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mega-menu-container {
    animation: fadeInUp 0.6s ease;
}

/* Responsive design for mega menu */
@media (max-width: 768px) {
    .mega-menu-container {
        flex-direction: column;
        min-height: auto;
    }
    
    .mega-menu-left {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        padding: 15px 0;
    }
    
    .mega-menu-right {
        width: 100%;
        padding: 15px;
    }
    
    .subcategories-list {
        padding: 0 15px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        max-height: 200px;
    }
    
    .popup-content {
        max-width: 95%;
        max-height: 80vh;
    }
    
    .popup-body {
        max-height: 70vh;
    }
    
    .mega-menu-container {
        min-height: 250px;
    }
}

@media (max-width: 576px) {
    .subcategory-group {
        margin-bottom: 15px;
    }
    
    .subcategory-title {
        font-size: 14px;
    }
    
    .featured-products-title {
        font-size: 16px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .popup-header {
        padding: 15px 20px;
    }
    
    .popup-header h4 {
        font-size: 18px;
    }
    
    .product-card {
        border-radius: 8px;
    }
    
    .product-info {
        padding: 10px;
    }
    
    .product-image {
        height: 80px;
    }
    
    .popup-content {
        max-height: 85vh;
    }
}

/* Loading spinner with better animation */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    flex-direction: column;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-spinner::after {
    content: 'Chargement des produits...';
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Smooth category item hover */
.category-item {
    position: relative;
    white-space: nowrap;
    cursor: pointer;
}

.category-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 123, 255, 0.1);
    border-radius: 25px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-item:hover::after {
    opacity: 1;
}

.category-item a {
    position: relative;
    z-index: 2;
}

/* Alert styles for better user experience */
.alert-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.alert-modal.active {
    opacity: 1;
    visibility: visible;
}

.alert-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.alert-modal.active .alert-content {
    transform: scale(1);
}

.alert-icon {
    font-size: 48px;
    margin-bottom: 20px;
    color: #007bff;
}

.alert-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.alert-message {
    font-size: 16px;
    color: #666;
    margin-bottom: 25px;
    line-height: 1.5;
}

.alert-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.alert-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.alert-btn-primary {
    background: #007bff;
    color: white;
}

.alert-btn-primary:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
}

.alert-btn-secondary {
    background: #6c757d;
    color: white;
}

.alert-btn-secondary:hover {
    background: #545b62;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.3);
}

/* Notification toast */
.notification-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 15000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.notification-toast.show {
    transform: translateX(0);
}

.notification-toast.error {
    background: #dc3545;
}

.notification-toast.info {
    background: #17a2b8;
}

/* Additional responsive improvements */
@media (max-width: 576px) {
    .alert-content {
        padding: 20px;
    }
    
    .alert-title {
        font-size: 20px;
    }
    
    .alert-message {
        font-size: 14px;
    }
    
    .alert-buttons {
        flex-direction: column;
    }
    
    .notification-toast {
        right: 10px;
        left: 10px;
        transform: translateY(-100%);
    }
    
    .notification-toast.show {
        transform: translateY(0);
    }
}

/* Main responsive design */
@media (max-width: 768px) {
    .main-header {
        padding: 10px 0;
    }
    
    .logo-text {
        font-size: 24px;
    }
    
    .user-actions {
        gap: 10px;
    }
    
    .categories-container {
        gap: 20px;
        padding: 0 10px;
    }
    
    .category-item a {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .popup-content {
        width: 95%;
        max-height: 90vh;
        margin: 20px 0;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .nav-menu {
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .nav-menu::-webkit-scrollbar {
        display: none;
    }
    
    .nav-menu li {
        flex-shrink: 0;
    }
}

@media (max-width: 576px) {
    .promo-item {
        margin-right: 30px;
        font-size: 12px;
    }
    
    .nav-menu {
        flex-wrap: nowrap;
        justify-content: flex-start;
    }
    
    .nav-menu li a {
        padding: 12px 20px;
        font-size: 14px;
        white-space: nowrap;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .logo-img {
        height: 35px;
    }
    
    .logo-text {
        font-size: 20px;
    }
    
    .popup-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .popup-header {
        padding: 20px;
    }
    
    .popup-body {
        padding: 20px;
    }
    
    .product-card {
        border-radius: 10px;
    }
    
    .product-info {
        padding: 15px;
    }
}

/* View more button */
.view-more-container {
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.view-more-btn {
    display: inline-block;
    padding: 8px 20px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.view-more-btn:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
    color: white;
    text-decoration: none;
}
