/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #f8f9fa !important;
    background-color: #f8f9fa !important;
    overflow-x: hidden;
}

/* Ensure minimum height for body */
html, body {
    min-height: 100vh;
}

/* Page wrapper background */
.container {
    position: relative;
}

/* Colorful Gradients */
.bg-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

.text-gradient-light {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

.btn-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    transition: all 0.3s ease;
}

.btn-gradient:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-outline-gradient {
    border: 2px solid #667eea;
    color: #667eea;
    background: transparent;
    transition: all 0.3s ease;
}

.btn-outline-gradient:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

/* Navbar - Enhanced */
.navbar {
    padding: 1rem 0;
    transition: all 0.3s ease;
    z-index: 1030;
}

.navbar.sticky-top {
    z-index: 1030;
}

.navbar-brand {
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 1rem;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
}

.nav-link.active {
    color: #667eea !important;
}

/* Cards */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
}

.card-img-top {
    height: 280px;
    object-fit: contain;
    background: #fff;
    margin: 10px;
    width: calc(100% - 20px);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Product Cards */
.product-card {
    overflow: hidden;
    position: relative;
}

.product-card .card-img-top {
    transition: transform 0.3s ease;
}

.product-card:hover .card-img-top {
    transform: scale(1.1);
}

/* Product Badge - Discount Badge */
.product-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
    font-weight: 700;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    letter-spacing: 0.5px;
}

/* Discount Badge - For inline price display */
.discount-badge {
    background-color: #dc3545 !important;
    color: #ffffff !important;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
    margin-left: 0.5rem;
    vertical-align: middle;
    letter-spacing: 0.5px;
    -webkit-background-clip: border-box !important;
    background-clip: border-box !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* Override text-gradient for discount badge */
h2 .discount-badge,
.text-gradient .discount-badge {
    background: #dc3545 !important;
    -webkit-background-clip: border-box !important;
    background-clip: border-box !important;
    -webkit-text-fill-color: #ffffff !important;
    color: #ffffff !important;
}

/* Price Display */
.price-tag {
    font-size: 1.25rem;
    font-weight: 700;
    color: #667eea;
}

.old-price {
    font-size: 0.875rem;
    color: #999;
    text-decoration: line-through;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}

.hero-section .container {
    position: relative;
    z-index: 1;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.1)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,112C672,96,768,96,864,112C960,128,1056,160,1152,160C1248,160,1344,128,1392,112L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
    opacity: 0.3;
    pointer-events: none;
}

/* Badge */
.badge {
    padding: 0.5em 1em;
    border-radius: 50px;
}

/* Buttons */
.btn {
    border-radius: 50px;
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-sm {
    padding: 0.4rem 1rem;
}

/* Forms */
.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    padding: 0.75rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Product Detail Page */
.product-detail-img {
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Cart */
.cart-item {
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.cart-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.12);
}

.cart-item-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 10px;
}

/* Order Status */
.order-status {
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-processing {
    background: #cfe2ff;
    color: #084298;
}

.status-shipped {
    background: #d1e7dd;
    color: #0f5132;
}

.status-delivered {
    background: #d1e7dd;
    color: #0f5132;
}

.status-cancelled {
    background: #f8d7da;
    color: #842029;
}

/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer a {
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer a:hover {
    color: #667eea;
    transform: translateX(5px);
}

/* Social Icons - Perfect Circle */
.social-links .btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
}

.social-links .btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    transform: translateY(-3px);
}

/* Admin Styles */
.admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 250px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

/* Sidebar Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.3s ease;
}

.sidebar-brand:hover {
    background: rgba(255, 255, 255, 0.05);
}

.brand-icon {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.sidebar-brand:hover .brand-icon {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.brand-icon i {
    font-size: 1.5rem;
    color: white;
}

.brand-text {
    flex: 1;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.125rem;
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.admin-sidebar .nav-link {
    color: rgba(255,255,255,0.7);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.admin-sidebar .nav-link i {
    width: 20px;
    margin-right: 10px;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: rgba(102, 126, 234, 0.2);
    color: white;
    border-left: 4px solid #667eea;
}

.admin-content {
    margin-left: 250px;
    padding: 2rem;
    min-height: 100vh;
    background: #f8f9fa;
}

.admin-header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    border-radius: 10px;
}

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Responsive Design */
@media (max-width: 991px) {
    .admin-sidebar {
        width: 0;
        overflow: hidden;
    }
    
    .admin-sidebar.show {
        width: 250px;
    }
    
    .admin-content {
        margin-left: 0;
    }
    
    .hero-section {
        padding: 50px 0;
    }
    
    /* Stack navbar items better on mobile */
    .navbar-collapse {
        margin-top: 1rem;
    }
    
    .navbar-nav {
        margin-bottom: 1rem;
    }
}

@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .card-img-top {
        height: 220px;
    }
    
    .cart-item-img {
        width: 80px;
        height: 80px;
    }
    
    .product-detail-img {
        margin-bottom: 2rem;
    }
}

@media (max-width: 576px) {
    .hero-section {
        padding: 40px 0;
    }
    
    .hero-section h1 {
        font-size: 1.8rem;
    }
    
    .card-img-top {
        height: 200px;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease;
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Image Zoom */
.img-zoom {
    transition: transform 0.3s ease;
}

.img-zoom:hover {
    transform: scale(1.05);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Product Detail Sticky Elements */
.product-sticky-container {
    z-index: 1;
}

/* Announcement Bar */
.announcement-bar {
    z-index: 1031;
}

/* Premium Breadcrumb Styling */
.breadcrumb {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.breadcrumb-item {
    font-size: 0.9rem;
    font-weight: 500;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "\F285";
    font-family: 'bootstrap-icons';
    color: #667eea;
    font-weight: 600;
    opacity: 0.6;
}

.breadcrumb-item a {
    color: #667eea;
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.breadcrumb-item a:hover {
    color: #764ba2;
    background: rgba(102, 126, 234, 0.1);
    transform: translateX(2px);
}

.breadcrumb-item.active {
    color: #495057;
    font-weight: 600;
}

/* ===== IMAGE LOADING OPTIMIZATIONS ===== */

/* Skeleton Loading Animation for Images */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* Image Loading Placeholder */
.card-img-top:not([src]),
.product-card img:not([src]),
.thumbnail-item img:not([src]) {
    background: linear-gradient(
        90deg,
        #f0f0f0 0px,
        #e0e0e0 40px,
        #f0f0f0 80px
    );
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* When image is loaded, stop animation */
.card-img-top[src],
.product-card img[src],
.thumbnail-item img[src] {
    animation: none;
}

/* Image fade-in effect after loading */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

img[loading="lazy"].loaded,
img[loading="lazy"][src] {
    opacity: 1;
}

/* Blur-up placeholder effect */
.img-placeholder {
    filter: blur(10px);
    transition: filter 0.3s ease;
}

.img-placeholder.loaded {
    filter: blur(0);
}

/* Optimize image rendering */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Prevent layout shift during image load */
.product-card {
    contain: layout;
}

.product-card .card-img-top {
    object-fit: contain;
    will-change: transform;
}

/* Loading spinner for images */
.img-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Performance: GPU acceleration for image transforms */
.product-card .card-img-top,
.thumbnail-item img {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Reduce repaint areas */
.product-card,
.thumbnail-item {
    isolation: isolate;
}

/* Preload critical images */
link[rel="preload"][as="image"] {
    fetchpriority: high;
}