/**
 * Frontend Common CSS
 * Reusable styles used across multiple frontend pages
 */

/* CSS Variables */
:root {
    --frontend-primary: #FF6E14;
    --frontend-secondary: #ff8c42;
    --frontend-border-radius: 0.5rem;
    --frontend-max-width: 1200px;
}

/* Global Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Smooth scrolling for all scrollable elements */
* {
    scroll-behavior: smooth;
}

/* Enhanced smooth scrolling for containers */
.scroll-smooth,
.overflow-auto,
.overflow-x-auto,
.overflow-y-auto,
.carousel-inner,
.modal-body {
    scroll-behavior: smooth;
}

/* Smooth scrolling performance optimizations */
body {
    scroll-behavior: smooth;
    /* Improve scrolling performance on mobile */
    -webkit-overflow-scrolling: touch;
    /* Optimize for smooth scrolling */
    overscroll-behavior: contain;
}

/* Carousel Performance Optimizations */
.product-carousel-track,
.categories-carousel,
.banner-track {
    /* Hardware acceleration for smooth scrolling */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    /* Smooth scrolling on touch devices */
    -webkit-overflow-scrolling: touch;
    /* Prevent overscroll bounce */
    overscroll-behavior-x: contain;
    /* Optimize for touch interactions */
    touch-action: pan-x;
}

/* Improve carousel smoothness */
.product-carousel-track {
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.product-carousel-track::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Categories carousel smoothness */
.categories-carousel {
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.categories-carousel::-webkit-scrollbar {
    display: none;
}

/* Smooth scrolling for iOS Safari */
@supports (-webkit-overflow-scrolling: touch) {
    body {
        -webkit-overflow-scrolling: touch;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    html,
    body,
    * {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* SEO-friendly hidden elements - visible to crawlers but hidden from users */
.seo-hidden {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(1px, 1px, 1px, 1px) !important;
    white-space: nowrap !important;
}

/* Product Grid - 5 columns for desktop (20% width each) */
@media (min-width: 992px) {
    .products-col-5 {
        flex: 0 0 20%;
        max-width: 20%;
    }
}

/* Product Grid - 4 columns for tablet */
@media (min-width: 768px) and (max-width: 991.98px) {
    .products-col-5 {
        flex: 0 0 25%;
        max-width: 25%;
    }
}

/* Product Grid - 2 columns for mobile */
@media (max-width: 767.98px) {
    .products-col-5 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Common Card Styles */
.hover-shadow {
    transition: all 0.3s ease;
}

.hover-shadow:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Category/Brand Card Styles */
.category-card,
.brand-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: white;
}

.category-card:hover,
.brand-card:hover {
    border-color: var(--frontend-primary);
    box-shadow: 0 4px 12px rgba(255, 106, 0, 0.15);
    transform: translateY(-2px);
}

.category-image-wrapper,
.brand-image-wrapper {
    position: relative;
    overflow: hidden;
    height: 200px;
    background: #f8f9fa;
}

.category-image,
.brand-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.category-card:hover .category-image,
.brand-card:hover .brand-image {
    transform: scale(1.05);
}

.category-info,
.brand-info {
    padding: 1rem;
    text-align: center;
}

.category-name,
.brand-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.category-count,
.brand-count {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Banner Styles */
.category-banner,
.brand-banner {
    position: relative;
    height: 300px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.banner-content {
    position: absolute;
    top: 50%;
    left: 2rem;
    transform: translateY(-50%);
    color: white;
    z-index: 2;
}

.banner-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.banner-subtitle {
    font-size: 1.125rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}


/* Contact Form Styles */
.contact-info-card,
.contact-form-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    height: 100%;
}

.contact-info-item {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.contact-info-item:hover {
    background: #fff5f0;
    transform: translateX(5px);
}

.contact-icon {
    width: 48px;
    height: 48px;
    background: var(--frontend-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 1rem;
    flex-shrink: 0;
}

.contact-submit-btn {
    background: linear-gradient(135deg, var(--frontend-primary), var(--frontend-secondary));
    border: none;
    color: white;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.contact-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 106, 0, 0.4);
}

/* Flash Sale Badge */
/* Badge on product cards - absolute positioning */
.product-card .flash-sale-badge,
.flash-product-image-wrapper .flash-sale-badge,
.badge-flash-sale {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
}

/* Flash Sale Badge - General Styles */
.flash-sale-badge {
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    animation: pulse 2s infinite;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Flash Sale Product Card Styles */
.flash-sale-product-card {
    transition: all 0.3s ease;
    border: none;
    width: 100%;
    border-radius: var(--frontend-border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.flash-sale-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.flash-product-image-wrapper {
    position: relative;
    height: 240px;
    background: #f8f9fa;
    overflow: hidden;
    border-radius: var(--frontend-border-radius) var(--frontend-border-radius) 0 0;
}

.flash-product-image {
    height: 100%;
    width: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.flash-sale-product-card:hover .flash-product-image {
    transform: scale(1.05);
}

.flash-product-image-placeholder {
    width: 100%;
    height: 100%;
}

.badge-flash-sale {
    top: 10px;
    left: 10px;
    background: linear-gradient(45deg, #dc3545, #ff6b6b);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.55rem;
    font-weight: 600;
    z-index: 2;
    animation: pulse 2s infinite;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.btn-wishlist-flash {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

.btn-wishlist-flash:hover {
    background: white;
    color: var(--frontend-primary);
    transform: scale(1.1);
}

.btn-wishlist-flash.active {
    color: #dc3545;
    background: white;
}

.add-to-cart-overlay-flash {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 3;
}

@media (min-width: 768px) {
    .flash-sale-product-card:hover .add-to-cart-overlay-flash {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-add-to-cart-flash {
    background: var(--frontend-primary);
    color: white;
    border: none;
    border-radius: var(--frontend-border-radius);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 106, 0, 0.3);
    width: 100%;
}

.btn-add-to-cart-flash:hover {
    background: var(--frontend-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 106, 0, 0.4);
}

.btn-add-to-cart-flash:active {
    transform: translateY(0);
}

.btn-add-to-cart-flash:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-add-to-cart-flash-mobile {
    background: var(--frontend-primary);
    color: white;
    border: none;
    border-radius: var(--frontend-border-radius);
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 0.5rem;
}

.btn-add-to-cart-flash-mobile:hover {
    background: var(--frontend-secondary);
}

.flash-product-info {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.flash-product-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.flash-product-title:hover {
    color: var(--frontend-primary);
}

/* Flash price section - for standalone flash sale cards */
.flash-product-info .flash-price-section {
    margin-bottom: 0.75rem;
}

/* Flash price - only for standalone flash sale cards, not product-card component */
.flash-product-info .flash-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #dc3545;
    margin-bottom: 0.25rem;
}

.flash-original-price {
    font-size: 0.9rem;
    color: #6c757d;
    text-decoration: line-through;
    margin-right: 0.5rem;
}

.flash-savings {
    font-size: 0.8rem;
    color: #28a745;
    font-weight: 600;
}

.flash-stock-info {
    margin-bottom: 0.75rem;
}

.flash-stock-text {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.flash-stock-progress {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.flash-stock-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    transition: width 0.3s ease;
}

.flash-urgency-text {
    font-size: 0.75rem;
    color: #dc3545;
    font-weight: 600;
    margin-top: 0.25rem;
}

/* Responsive Typography */
@media (max-width: 767.98px) {
    .banner-title {
        font-size: 1.75rem;
    }
    
    .banner-subtitle {
        font-size: 1rem;
    }
    
    .banner-content {
        left: 1rem;
    }
    
    .contact-info-card,
    .contact-form-card {
        padding: 1.5rem;
    }
}

/* Loading States */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--frontend-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Common Image Gallery Styles */
.main-product-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 6px;
    cursor: zoom-in;
}

.image-zoom-container {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
}

.zoom-icon {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-zoom-container:hover .zoom-icon {
    opacity: 1;
}

.thumbnail-gallery {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--frontend-primary) #f0f0f0;
}

.thumbnail-gallery::-webkit-scrollbar {
    height: 6px;
}

.thumbnail-gallery::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}

.thumbnail-gallery::-webkit-scrollbar-thumb {
    background: var(--frontend-primary);
    border-radius: 10px;
}

.thumbnail-item {
    flex-shrink: 0;
}

.thumbnail-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.thumbnail-image:hover {
    border-color: var(--frontend-primary);
    transform: scale(1.05);
}

.thumbnail-image.active {
    border-color: var(--frontend-primary);
    box-shadow: 0 2px 8px rgba(255, 106, 0, 0.3);
}

/* Utility Classes */
.cursor-pointer {
    cursor: pointer;
}

/* Banner carousel styles removed */


/* Bootstrap Carousel Customizations */
.product-carousel {
    position: relative;
    padding: 0 40px;
}

.product-carousel .carousel-control-prev,
.product-carousel .carousel-control-next {
    width: 40px;
    height: 40px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    opacity: 0.8;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.product-carousel .carousel-control-prev {
    left: 0;
}

.product-carousel .carousel-control-next {
    right: 0;
}

.product-carousel .carousel-control-prev:hover,
.product-carousel .carousel-control-next:hover {
    opacity: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: var(--frontend-primary);
}

.product-carousel .carousel-control-prev-icon,
.product-carousel .carousel-control-next-icon {
    width: 20px;
    height: 20px;
    background-size: 100%;
    filter: invert(1);
}

.product-carousel .carousel-indicators {
    margin-bottom: -30px;
}

.product-carousel .carousel-indicators button {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #dee2e6;
}

.product-carousel .carousel-indicators button.active {
    background-color: var(--frontend-primary);
}

.carousel-item-col {
    display: flex;
    align-items: stretch;
}

@media (max-width: 767.98px) {
    .product-carousel {
        padding: 0 30px;
    }
    
    .product-carousel .carousel-control-prev,
    .product-carousel .carousel-control-next {
        width: 30px;
        height: 30px;
    }
}

/* Checkout Progress Styles */
.checkout-progress-wrapper {
    max-width: var(--frontend-max-width);
    margin: 2rem auto;
    padding: 0 0.5rem;
}

.checkout-progress-container {
    background: linear-gradient(135deg, var(--frontend-primary) 0%, var(--frontend-secondary) 100%);
    padding: 2rem 1rem;
    border-radius: var(--frontend-border-radius);
}

.checkout-progress {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.checkout-step {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 2;
}

.checkout-step:last-child {
    flex: 0;
}

.step-link,
.step-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s ease;
}

.step-link:hover .step-circle {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.step-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.checkout-step.active .step-circle {
    background: white;
    color: var(--frontend-primary);
    border-color: white;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.4);
    transform: scale(1.15);
}

.checkout-step.completed .step-circle {
    background: rgba(255, 255, 255, 0.9);
    border-color: white;
    color: #10b981;
}

.step-label {
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
    white-space: nowrap;
}

.checkout-step.active .step-label {
    opacity: 1;
    font-weight: 700;
}

.checkout-step.completed .step-label {
    opacity: 1;
}

.step-connector {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 1rem;
    position: relative;
    top: -35px;
}

.step-connector.completed {
    background: white;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .checkout-progress-wrapper {
        padding: 0 0.5rem;
    }
    
    .checkout-progress-container {
        padding: 1.5rem 0.75rem;
    }
    
    .step-circle {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .checkout-step.active .step-circle {
        transform: scale(1.1);
    }
    
    .step-label {
        font-size: 0.75rem;
    }
    
    .step-connector {
        margin: 0 0.5rem;
        top: -30px;
    }
}

@media (max-width: 576px) {
    .checkout-progress-wrapper {
        padding: 0 0.2rem;
    }
    
    .checkout-progress-container {
        padding: 1.25rem 0.5rem;
    }
    
    .step-circle {
        width: 45px;
        height: 45px;
        font-size: 1.125rem;
        margin-bottom: 0.5rem;
    }
    
    .step-label {
        font-size: 0.65rem;
    }
    
    .step-connector {
        margin: 0 0.25rem;
        top: -27px;
    }
}
