/* Product Category Wise - Responsive Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    overflow-x: hidden; /* Prevent horizontal scroll on mobile */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

/* Header Styling */
.header-default {
    position: relative;
    z-index: 500;
    background: #fff;
    width: 100%;
}

/* Product Category Wise Section */
.flat-spacing-5 {
    padding-top: 20px;
    position: relative;
    z-index: 600;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px; /* Add padding for mobile */
    position: relative;
    z-index: 500;
    overflow: visible !important;
}

.stories-container {
    max-width: 100%;
    margin: 1rem auto;
    position: relative;
    padding: 0 40px;
    z-index: 610;
    visibility: visible !important;
    background-color: #f5f5f5;
    overflow: visible; /* Ensure overflow is visible */
}

.story-list {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding: 10px 0;
    z-index: 620;
    visibility: visible !important;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    position: relative; /* Ensure proper stacking context */
}

.story-list::-webkit-scrollbar {
    display: none;
}

.story-item {
    position: relative;
    min-width: 120px; /* Smaller width for mobile */
    height: 200px; /* Shorter height for mobile */
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
    z-index: 630;
    background-color: #f0f0f0;
    visibility: visible !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Adjust story item size for tablet and desktop */
@media (min-width: 768px) {
    .story-item {
        min-width: 150px;
        height: 250px;
    }
}

.story-item:hover {
    transform: scale(1.02);
}

.story-item:active {
    transform: scale(0.98); /* Feedback for touch on mobile */
}

.story-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1 !important;
    visibility: visible !important;
}

.story-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    font-size: 14px; /* Smaller font for mobile */
    font-weight: 500;
    visibility: visible !important;
    text-align: center;
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 640;
    visibility: visible !important;
}

.prev-btn {
    left: 5px;
}

.next-btn {
    right: 5px;
}

/* Story Viewer */
.story-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.95);
    display: none;
    z-index: 9999; /* Increase z-index to ensure it's above all other content */
    overflow: hidden;
}

.story-viewer.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.stories-wrapper {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 0 20px; /* Reduced padding for mobile */
    overflow: hidden;
    z-index: 10001; /* Ensure it's above other elements */
}

/* Adjust padding for larger screens */
@media (min-width: 768px) {
    .stories-wrapper {
        padding: 0 50px;
    }
}

.story-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 90vh;
    transition: all 0.3s ease;
    max-height: 100vh;
    background-color: #333;
    z-index: 10000; /* Ensure it's above other elements */
}

.story-content.image-loaded {
    background-color: transparent;
}

.story-content.prev,
.story-content.next {
    width: 300px;
    height: 70vh;
    opacity: 0.5;
    display: none; /* Hide on mobile by default */
}

/* Add media query to show prev/next stories on larger screens */
@media (min-width: 768px) {
    .story-content.prev,
    .story-content.next {
        display: block; /* Show on tablet and desktop */
    }
}

.story-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    z-index: 10004; /* Ensure it's above other elements */
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0,0,0,0.5);
    border-radius: 50%;
}

.story-controls {
    position: absolute;
    top: 20px;
    right: 70px;
    display: flex;
    gap: 15px;
    z-index: 10004; /* Ensure it's above other elements */
}

.control-btn {
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    opacity: 0.8;
    transition: opacity 0.3s;
    padding: 5px;
}

.control-btn:hover {
    opacity: 1;
}

.progress-container {
    position: absolute;
    top: 10px;
    left: 0;
    right: 0;
    display: flex;
    gap: 4px;
    padding: 0 20px;
    z-index: 10003; /* Ensure it's above other elements */
}

.progress-bar {
    flex: 1;
    height: 2px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: white;
    width: 0;
    transition: width 0.1s linear;
}

/* Story text container styling */
.story-text-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10003; /* Ensure it's above other elements */
    width: 90%;
    max-width: 300px;
}

.profile-name {
    margin-bottom: 15px;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    background: rgba(0,0,0,0.4);
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
    z-index: 10002; /* Ensure it's above other elements */
    position: relative; /* Ensure proper stacking context */
}

.shop-now-btn {
    display: inline-block;
    padding: 10px 24px;
    background-color: #fff;
    color: #000;
    border-radius: 24px;
    text-decoration: none;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    font-size: 16px;
    letter-spacing: 0.5px;
    z-index: 10002; /* Ensure it's above other elements */
    position: relative; /* Ensure proper stacking context */
}

.shop-now-btn:hover, .shop-now-btn:active {
    background-color: #f0f0f0;
    transform: translateY(-2px);
}

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 30px;
    opacity: 0.8;
    cursor: pointer;
    z-index: 10004; /* Ensure it's above other elements */
    background: rgba(0,0,0,0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-arrow.prev {
    left: 10px;
}

.nav-arrow.next {
    right: 10px;
}

/* Ensure body doesn't scroll when story is open */
body.story-viewer-active {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    touch-action: none !important; /* Prevent scrolling on touch devices */
}

/* Fix for initial load visibility issues */
.swiper, .swiper-wrapper, .swiper-slide {
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 1 !important;
}

/* Fix for black background issue */
.tf-sw-collection {
    background-color: transparent !important;
    position: relative;
    z-index: 600;
    overflow: visible !important;
}

/* Fix for dropdown menu z-index issues */
.sub-menu.submenu-default {
    position: absolute;
    z-index: 1000;
    background-color: #fff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Ensure dropdown is visible when hovered */
.menu-item.position-relative:hover .sub-menu.submenu-default {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Make sure dropdown menu is properly visible */
.menu-item.position-relative {
    position: relative !important;
}

/* Fix any potential issues with overflow */
.box-navigation {
    overflow: visible !important;
}

/* Fix for any potential issues with the hover-sw-nav */
.hover-sw-nav {
    position: relative;
    z-index: 500;
    overflow: visible !important;
}
/* Product Category Wise - Responsive Styles */


/* Modal Quick View Responsive Styles */
.tf-product-info-buy-button {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tf-single-slide {
    height: 640px;
}

.wishlist-wrapper {
    display: flex;
    justify-content: center;
}

.tf-product-btn-wishlist {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #fff;
    border: 1px solid #ddd;
    position: relative;
    transition: all 0.3s ease;
}

.tf-product-btn-wishlist:hover {
    background-color: #f5f5f5;
    border-color: #bbb;
}

.tf-product-btn-wishlist .icon {
    font-size: 18px;
    color: #666;
}

.tf-product-btn-wishlist.active .icon-heart {
    color: #ff0000;
}

.tf-product-btn-wishlist .tooltip {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.tf-product-btn-wishlist:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

/* Notification */
.toast-notification {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px 25px;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    z-index: 9999;
    display: none;
    animation: fadeIn 0.3s, fadeOut 0.3s 2.7s;
    text-align: center;
}

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

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* Media Queries for Responsive Design */
@media (max-width: 1200px) {
    .stories-container {
        padding: 0 30px;
    }

    .story-content {
        max-width: 450px;
    }

    .tf-grid-layout.wrapper-shop.tf-col-5 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .story-item {
        min-width: 140px;
        height: 230px;
    }

    .story-content.prev,
    .story-content.next {
        width: 250px;
    }

    .stories-wrapper {
        padding: 0 40px;
    }

    .tf-grid-layout.wrapper-shop.tf-col-5 {
        grid-template-columns: repeat(3, 1fr);
    }

    .modal-dialog {
        max-width: 90%;
    }
}

@media (max-width: 768px) {
    .stories-container {
        padding: 0 25px;
        margin: 0.5rem auto;
    }

    .story-item {
        min-width: 110px;
        height: 180px;
    }

    .story-title {
        font-size: 12px;
        padding: 10px 8px;
    }

    .nav-btn {
        width: 30px;
        height: 30px;
    }

    .story-content.prev,
    .story-content.next {
        display: none; /* Hide on mobile */
    }

    .story-content {
        width: 90%;
        max-width: 350px;
    }

    .stories-wrapper {
        padding: 0 20px;
    }

    .nav-arrow {
        width: 35px;
        height: 35px;
        font-size: 24px;
    }

    .shop-now-btn {
        padding: 8px 20px;
        font-size: 14px;
    }

    .profile-name {
        font-size: 14px;
        padding: 6px 12px;
    }

    .tf-grid-layout.wrapper-shop.tf-col-5 {
        grid-template-columns: repeat(2, 1fr);
    }

     Extra added part for covering image size
    .tf-single-slide {
        height: auto !important; /* Override the fixed height */
         max-height: 80vh; /* Maximum height relative to viewport height */
    }

    .tf-single-slide .swiper-slide {
        height: auto;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .tf-single-slide .swiper-slide .item {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .tf-single-slide .swiper-slide .item img {
        max-width: 100%;
        max-height: 80vh;
        object-fit: contain;
        margin: 0 auto;
    }

    /* Adjust the modal content for better responsiveness */
    .modalDemo .modal-content {
        display: flex;
        flex-direction: column;
    }

    .modalDemo .wrap {
        display: flex;
        flex-direction: column;
    }

    @media (min-width: 768px) {
        .modalDemo .wrap {
            flex-direction: row;
        }

        .tf-product-media-wrap {
            width: 50%;
        }

        .tf-product-info-wrap {
            width: 50%;
        }
    }


    /* Modal Quick View Mobile Styles */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content .wrap {
        flex-direction: column;
    }

    .tf-product-media-wrap {
        width: 100%;
    }

    .tf-product-info-wrap {
        width: 100%;
        padding: 15px;
    }

    .tf-single-slide {
        height: auto !important;
        max-height: 50vh;
    }
}

@media (max-width: 576px) {
    .stories-container {
        padding: 0 20px;
    }

    .story-item {
        min-width: 90px;
        height: 160px;
    }

    .story-list {
        gap: 10px;
    }

    .story-content {
        width: 95%;
        height: 85vh;
    }

    .nav-arrow {
        width: 30px;
        height: 30px;
        font-size: 20px;
    }

    .nav-arrow.prev {
        left: 5px;
    }

    .nav-arrow.next {
        right: 5px;
    }

    .close-btn {
        top: 15px;
        right: 15px;
        font-size: 24px;
        width: 35px;
        height: 35px;
    }

    .story-controls {
        top: 15px;
        right: 60px;
    }

    .control-btn {
        font-size: 20px;
    }

    /* Improve touch targets for mobile */
    .nav-btn, .nav-arrow, .close-btn, .control-btn {
        min-width: 44px;
        min-height: 44px;
    }

    /* Fix product grid for small mobile */
    .tf-grid-layout.wrapper-shop.tf-col-5 {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    /* Adjust product cards for mobile */
    .card-product {
        margin-bottom: 15px;
    }

    .card-product-info {
        padding: 10px 5px;
    }

    /* Fix modal for small screens */
    .modal-content {
        border-radius: 10px;
    }

    .modal-content .header {
        padding: 10px;
    }

    .tf-product-info-title h5 {
        font-size: 16px;
    }

    .tf-product-description p {
        font-size: 14px;
    }

    .btn-add-to-cart {
        padding: 12px 15px;
    }
}

@media (max-width: 767px){
    .collection-item-v4.style-2 .collection-image{
        /*height:50px;*/
    }
}


/* Fix for Safari mobile issues */
@supports (-webkit-touch-callout: none) {
    .story-viewer {
        height: -webkit-fill-available;
    }

    body.story-viewer-active {
        height: -webkit-fill-available;
    }

    .story-image {
        -webkit-user-select: none;
        user-select: none;
    }
}

/* Improve accessibility */
.nav-btn:focus, .nav-arrow:focus, .close-btn:focus, .control-btn:focus, .shop-now-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
}

/* Fix for notch on iPhone X and newer */
@supports (padding: max(0px)) {
    .story-viewer {
        padding-top: max(0px, env(safe-area-inset-top));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }

    .close-btn {
        top: max(20px, env(safe-area-inset-top));
    }

    .story-controls {
        top: max(20px, env(safe-area-inset-top));
    }
}
