/*
Theme Name: ShopKart
Description: Advanced E-commerce WordPress Theme with WooCommerce Integration
Version: 11.0
Author: ShopKart Team
*/

/* 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;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    text-decoration: none;
    color: white;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
}

.nav-menu a:hover {
    opacity: 0.8;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cart-icon {
    position: relative;
    color: white;
    font-size: 1.2rem;
    text-decoration: none;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

/* Product Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.product-info {
    padding: 1.5rem;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.product-price {
    font-size: 1.2rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 1rem;
}

.product-actions {
    display: flex;
    gap: 0.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #dee2e6;
}

.btn-secondary:hover {
    background: #e9ecef;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Cart Styles */
.cart-item {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 1rem;
}

.cart-item-details {
    flex: 1;
}

.cart-item-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.cart-item-price {
    color: #667eea;
    font-weight: 500;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 1rem;
}

.quantity-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.quantity-btn:hover {
    background: #f8f9fa;
}

.quantity-display {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
}

/* Checkout Styles */
.checkout-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 3rem;
}

.checkout-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.order-summary {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
}

.total-row.final {
    border-top: 2px solid #dee2e6;
    padding-top: 1rem;
    margin-top: 1rem;
    font-weight: bold;
    font-size: 1.1rem;
}

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

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: #ecf0f1;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section ul li a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #34495e;
    color: #bdc3c7;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-menu {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }

    .checkout-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .cart-item {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .quantity-controls {
        margin: 0;
    }

    .container {
        padding: 0 15px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-actions {
        flex-direction: column;
    }

    .checkout-container {
        padding: 1rem;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.p-1 {
    padding: 0.5rem;
}

.p-2 {
    padding: 1rem;
}

.p-3 {
    padding: 1.5rem;
}

.p-4 {
    padding: 2rem;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Success/Error Messages */
.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.modal-close:hover {
    color: #333;
}

/* Print Styles */
@media print {

    .header,
    .footer,
    .btn,
    .modal {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .product-card,
    .cart-item,
    .checkout-section {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

/* Touch Scroll Fixes - Prevent horizontal scroll from blocking page scroll */
.category-scroll,
.subcategory-scroll,
.overflow-x-auto,
[class*="overflow-x-auto"] {
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-x: contain !important;
    overscroll-behavior-y: none !important;
    touch-action: pan-x !important;
    overflow-y: hidden !important;
}

/* Ensure page can scroll vertically */
body,
html,
.app-main {
    touch-action: pan-y !important;
    overscroll-behavior-y: auto !important;
}

/* Mobile specific fixes */
@media (max-width: 768px) {

    /* Prevent horizontal scroll elements from interfering with page scroll */
    .category-scroll {
        touch-action: pan-x !important;
        overscroll-behavior: contain none !important;
    }

    .subcategory-scroll {
        touch-action: pan-x !important;
        overscroll-behavior: contain none !important;
    }

    /* Grid layout touch fixes */
    .grid.grid-cols-4 {
        touch-action: manipulation !important;
    }

    /* Image gallery fixes */
    #image-thumbnails {
        touch-action: pan-x !important;
        overscroll-behavior: contain none !important;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {

    .category-scroll,
    .subcategory-scroll {
        -webkit-overflow-scrolling: touch !important;
        transform: translateZ(0) !important;
        /* Force hardware acceleration */
    }

    body {
        -webkit-overflow-scrolling: touch !important;
    }
}

/* Banner Slider Touch Fixes */
.banner-slider {
    touch-action: pan-y !important;
    overscroll-behavior: none !important;
}

.banner-slider .slider-container {
    touch-action: pan-x pan-y !important;
}

.banner-slider img {
    touch-action: manipulation !important;
    pointer-events: auto !important;
}

/* Prevent slider from blocking page scroll */
.banner-slider .slide {
    touch-action: manipulation !important;
}

/* Mobile specific banner fixes */
@media (max-width: 768px) {
    .banner-slider {
        touch-action: pan-y !important;
        overscroll-behavior-x: contain !important;
        overscroll-behavior-y: none !important;
    }

    .banner-slider .slider-container {
        touch-action: pan-x pan-y !important;
    }
}

/* Shimmer/Skeleton Loading Effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    animation: shimmer 2s linear infinite forwards;
    background: #f6f7f8;
    background: linear-gradient(to right, #f6f7f8 8%, #edeef1 18%, #f6f7f8 33%);
    background-size: 1000px 100%;
    position: relative;
    overflow: hidden;
}

/* Skeleton Utilities */
.skeleton-box {
    background-color: #eee;
    border-radius: 4px;
}

.skeleton-text {
    height: 12px;
    margin-bottom: 8px;
    border-radius: 2px;
}

.skeleton-text.w-50 {
    width: 50%;
}

.skeleton-text.w-75 {
    width: 75%;
}

.skeleton-text.w-100 {
    width: 100%;
}

.skeleton-img {
    width: 100%;
    height: 100%;
    display: block;
}

/* Product Card Loading State */
.product-image-container {
    position: relative;
    background: #f0f0f0;
    overflow: hidden;
}

.product-image-container.loading::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, #f0f0f0 8%, #e0e0e0 18%, #f0f0f0 33%);
    background-size: 1000px 100%;
    animation: shimmer 1.5s linear infinite;
    z-index: 1;
}

.product-image-container img {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.product-image-container.loading img {
    opacity: 0;
}

/* Cart Modal Skeleton */
.cart-item-skeleton {
    display: flex;
    padding: 1rem;
    gap: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #eee;
    border-radius: 8px;
}

.cart-item-skeleton-img {
    width: 60px;
    height: 60px;
    border-radius: 6px;
}

.cart-item-skeleton-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}