body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    margin: 0;
    color: #333;
}
.container {
    max-width: 2500px;
    margin: 0 auto;
    padding: 20px;
}

/* View toggle button styles */
.view-toggle {
    margin-bottom: 20px;
}
.view-toggle button {
    padding: 10px 20px;
    margin-right: 10px;
    font-size: 1rem;
    background-color: #007bff;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
}
.view-toggle button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Filter styles */
.filter-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.filter-item {
    min-width: 200px;
    flex-grow: 1;
}
.filter-item label {
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
}
.filter-item select {
    width: 100%;
    min-height: 120px;
}
.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}
.tag {
    background-color: #007bff;
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
}
.tag .close {
    margin-left: 5px;
    cursor: pointer;
}

/* Card and grid styles */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    align-items: stretch;
}
@media (min-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}
.card-product {
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.card-product:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}
.card-product .card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 8px;
    padding-bottom: 12px;
    min-height: 0;
}
.card-product .action-buttons {
    margin-top: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}
.card-product .card-body p {
    overflow-wrap: anywhere;
}

/* Brand image styles */
.brand-wrapper {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-bottom: 1px solid #f1f1f1;
    padding: 10px;
    margin-bottom: 12px;
}
.brand-wrapper img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

/* Image gallery styles */
.image-gallery {
    width: 100%;
    height: 300px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
      touch-action: pan-y;         /* <-- key */

    margin-bottom: 12px;
    border-radius: 8px;
    background: #f8f9fa;
}
.image-gallery img {
    height: 100%;
    width: 560px;
    max-width: 100%;
    object-fit: contain;
    scroll-snap-align: start;
    display: inline-block;
    margin-right: 2px;
      touch-action: manipulation;  /* don’t block vertical scrolling */

    cursor: pointer;
    background-color: white;
}
.image-gallery::-webkit-scrollbar {
    height: 5px;
}
.image-gallery::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
.image-gallery::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}
.image-gallery::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Card body styles */
.card-body {
    padding: 8px 0;
}
.card-body h4 {
    margin: 12px 0 8px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a202c;
}
.card-body p {
    margin: 6px 0;
    font-size: 0.95rem;
    color: #4a5568;
}
.card-body p strong {
    color: #1a202c;
}

/* Price styles */
.price {
    color: #28a745;
    font-weight: 700;
    font-size: 1.2rem;
}
.old-price {
    color: #999;
    text-decoration: line-through;
    font-size: 1rem;
    margin-left: 4px;
}

/* Button styling */
.btn {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font: inherit;
}
.view-btn {
    background: #2563eb;
    color: #fff;
}
.share-btn {
    background: #16a34a;
    color: #fff;
}

/* Table View (List View) styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
table, th, td {
    border: 1px solid #ddd;
}
th, td {
    padding: 12px;
    text-align: left;
}
th {
    background-color: #f4f4f4;
}

/* No products styles */
.no-products {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-top: 30px;
}
.no-products h3 {
    font-size: 1.6rem;
    margin-bottom: 10px;
}
.no-products p {
    font-size: 1.1rem;
    color: #718096;
}

/* Modal styles */
.share-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    z-index: 10000;
    padding: 16px;
}
.share-modal .modal-content {
    position: relative;
    box-sizing: border-box;
    width: min(92vw, 520px);
    max-width: 520px;
    padding: 16px 20px 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    margin: 0;
    text-align: center;
}
.share-modal h3 {
    margin: 8px 0 14px;
    font-size: 1.1rem;
}
.share-modal .close {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 24px;
    line-height: 1;
    color: #111;
    background: transparent;
    border: 0;
    cursor: pointer;
}
.share-options {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    white-space: nowrap;
    padding: 10px 20px;
    flex: none;
}
.share-option {
    flex: 1;
    max-width: 200px;
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    font-size: 1rem;
    width: 100%;
}
.share-option:hover {
    background-color: #0056b3;
}

/* Image Modal Styles */
.image-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    overflow: auto;
    animation: fadeIn 0.3s;
}
.image-modal .close-modal {
    position: absolute;
    right: 14px;
    top: 8px;
    font-size: 32px;
    color: #fff;
    background: transparent;
    border: 0;
    z-index: 3;
    cursor: pointer;
}
.image-modal .modal-content1 {
    position: absolute;
    left: 50%;
    top: 40%;
    transform: translate(-50%, -50%);
    width: min(96vw, 1400px);
    height: min(92vh, 900px);
    background: transparent;
}
.zoom-stage {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
}
.zoom-stage:active {
    cursor: grabbing;
}
#modalImage {
    position: absolute;
    top: 50%;
    left: 50%;
    height:580px;
    transform: translate(-50%, -50%) scale(1);
    transform-origin: center center;
    max-width: none;
    max-height: none;
}

/* Media query for mobile devices */
@media (max-width: 850px) {
    #modalImage {
        top: 25%;  /* Adjust top position */
        left: 45%; /* Adjust left position */
        transform: translate(-45%, -25%) scale(1); /* Center it based on new left and top */
    }
}

.zoom-toolbar {
    position: absolute;
    left: 50%;
    top: 10px;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    gap: 6px;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 8px;
    border-radius: 999px;
}
.zoom-btn {
    background: #111;
    color: #fff;
    border: 1px solid #444;
    border-radius: 18px;
    padding: 6px 10px;
    font-weight: 600;
    cursor: pointer;
}
.zoom-btn:hover {
    background: #222;
}
.nav-arrows .nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    color: #fff;
    opacity: 0.95;
    cursor: pointer;
    user-select: none;
    z-index: 2;
}
.prev-arrow {
    left: 10px;
}
.next-arrow {
    right: 10px;
}
.image-counter {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}
.modal-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    margin-top: 200px;
    margin-left: 20px;
}
@media (min-width: 1024px) {
    .modal-image {
        margin-top: 100px;
    }
}

/* Loading spinner */
.loading-spinner {
    display: none;
    text-align: center;
    padding: 20px;
}
.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 4px solid #007bff;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}
.end-of-products {
    text-align: center;
    padding: 20px;
    color: #777;
    display: none;
}

/* Page loader */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: rgba(255, 255, 255, 255);
    backdrop-filter: blur(1px);
    transition: opacity 0.25s ease;
}
.page-loader.is-hidden {
    opacity: 0;
    pointer-events: none;
}
.loader-spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 4px solid rgba(0, 0, 0, 0.15);
    border-top-color: #007bff;
    animation: spin 0.9s linear infinite;
    margin-bottom: 10px;
}
.loader-text {
    font-size: 0.95rem;
    color: #333;
}
body.is-loading {
    overflow: hidden;
}

/* Mobile filters toggle */
.filters-toggle {
    display: none;
}
@media (max-width: 640px) {
    .filters-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        width: 100%;
        padding: 10px 12px;
        margin: 8px 0 10px;
        font-weight: 600;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        background: #fff;
        cursor: pointer;
    }
    .filters-toggle .badge {
        font-size: 12px;
        padding: 2px 8px;
        border-radius: 999px;
        background: #111827;
        color: #fff;
    }
    .filters-panel {
        overflow: hidden;
        max-height: 0;
        transition: max-height 0.3s ease;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        background: #fff;
    }
    .filters-panel.is-open {
        max-height: 1000px;
    }
    .filters-panel .filter-container {
        padding: 12px;
    }
}
@media (min-width: 641px) {
    .filters-panel {
        max-height: none !important;
        overflow: visible;
        border: 0;
        background: transparent;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
