/* === Enhanced Mobile Layout and General Improvements === */
html,
body {
    height: auto;
    min-height: 100%;
    scroll-behavior: smooth;
}

/* === Accessibility: Skip to Content Link === */
.skip-to-content {
    position: absolute;
    top: -40px;
    inset-inline-start: 0;
    background: #f89a34;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 1000;
    font-weight: 600;
    border-start-end-radius: 4px;
    border-end-end-radius: 4px;
    transition: top 0.3s;
}

.skip-to-content:focus {
    top: 0;
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* === Accessibility: Visually Hidden === */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border-width: 0 !important;
}

.visually-hidden:not(:focus):not(:active) {
    clip-path: inset(50%) !important;
}

/* Show visually hidden when needed */
.popup-group-title:not(.visually-hidden),
.popup-image-gallery:not(.visually-hidden),
#popup-type:not(.visually-hidden),
#no-results:not(.visually-hidden),
#error:not(.visually-hidden) {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: inherit !important;
    margin: inherit !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    border-width: inherit !important;
    clip-path: none !important;
}



/* === Font Face with font-display === */
@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: local('Poppins Regular'), local('Poppins-Regular');
}

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: local('Poppins Medium'), local('Poppins-Medium');
}

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: local('Poppins SemiBold'), local('Poppins-SemiBold');
}

/* === Global Body Styling === */
body {
    min-height: 100vh;
    background: #111 url('https://i.postimg.cc/kg8tpspj/background-stone-texture.jpg') repeat-y center top;
    background-size: cover;
    background-attachment: fixed;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Tahoma', 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: #333;
    font-size: 16px;
}

/* RTL Font Support */
[dir="rtl"] body {
    font-family: 'Cairo', 'Noto Sans Arabic', 'Tahoma', 'Arial', sans-serif;
    font-size: 17px; /* Slightly larger for Arabic readability */
}

[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 {
    font-size: 105%;
}

[dir="rtl"] body {
    text-align: right;
}

[dir="ltr"] body {
    text-align: left;
}



/* === Improved Header Styling === */
#main-header {
    background: linear-gradient(to bottom, #252525, #1a1a1a);
    border-bottom: 2px solid #f89a34;
    font-family: 'Poppins', sans-serif;
    color: #ddd;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.4);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: auto;
    padding: 15px 30px;
    flex-wrap: wrap;
}

.left-section {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.logo-wrapper {
    background: url('https://i.postimg.cc/kg8tpspj/background-stone-texture.jpg') no-repeat center center;
    background-size: cover;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.12), 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 65px;
    width: 65px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    flex-shrink: 0;
    /* Prevent logo from shrinking on mobile */
}

.logo-wrapper:hover {
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.logo-final {
    max-height: 54px;
    width: auto;
}

.contact-line {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: clamp(13px, 3vw, 15px);
    /* Responsive sizing */
    align-items: flex-start;
}

[dir="rtl"] .contact-line {
    align-items: flex-end;
}

@media (min-width: 400px) {
    .contact-line {
        flex-direction: row;
        gap: 20px;
    }
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.3s ease;
    text-decoration: none;
    color: #ddd;
}

.contact-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f89a34;
}

.contact-item:active {
    background: rgba(255, 255, 255, 0.08);
}

.contact-icon {
    font-size: 16px;
    color: #f89a34;
    flex-shrink: 0;
    /* Prevent icons from shrinking */
}

.right-section {
    display: flex;
    gap: 18px;
    font-size: 15px;
    align-items: center;
    margin-inline-start: auto;
    /* Push to end */
}

[dir="rtl"] .right-section {
    flex-direction: row-reverse;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    width: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    color: #ddd;
    text-decoration: none;
}

.social-link:hover {
    background: rgba(248, 154, 52, 0.2);
    color: #f89a34;
    transform: translateY(-3px);
}

/* Contact item styles are handled by .contact-item class above */

/* === Improved Search and Filter === */
#search-filter-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px 30px;
    max-width: 1300px;
    margin: 25px auto 20px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.search-filter-inputs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Active Filter Chips */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-height: 32px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f89a34;
    color: #fff;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-chip:hover {
    background: #e67c1f;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(248, 154, 52, 0.3);
}

.filter-chip-remove {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-chip-remove:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.active-filters:empty {
    display: none;
}

.search-input-wrapper {
    position: relative;
    flex-grow: 1;
    min-width: 200px;
}

#stoneSearch {
    width: 100%;
    padding: 12px 40px 12px 18px;
    font-size: 16px;
    border-radius: 10px;
    border: 1px solid #f89a34;
    outline: none;
    background: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.clear-search-btn {
    position: absolute;
    inset-inline-end: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1;
}

.clear-search-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.clear-search-btn:not(.visually-hidden) {
    display: flex;
}

#stoneSearch:focus {
    box-shadow: 0 0 0 3px rgba(248, 154, 52, 0.3);
    border-color: #e6b45c;
}

#stoneFilter {
    padding: 12px 18px;
    font-size: 16px;
    border-radius: 10px;
    border: 1px solid #f89a34;
    background: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
    max-width: 100%;
    white-space: normal;
    /* Allows text wrapping */
    word-break: keep-all;
}

#stoneFilter:hover {
    border-color: #d49c42;
    background-color: #fef9f3;
}

/* === Enhanced Catalog Styling === */
#catalog {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    /* Responsive columns */
    gap: 20px;
    padding: 0 20px 40px;
    width: 100%;
    max-width: 1300px;
    margin: auto;
    box-sizing: border-box;
}

.stone-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ccc;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border 0.3s ease;
}

.stone-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2);
    border-color: #e6b45c;
}

.stone-card img {
    width: 100%;
    height: 180px;
    /* Taller images for better visibility */
    object-fit: cover;
    transition: transform 0.5s ease;
    aspect-ratio: 4/3;
    /* Standard image ratio */
    background: #f5f5f5 url('loading-spinner.gif') no-repeat center;
}

.stone-card:hover img {
    transform: scale(1.05);
    /* Slight zoom effect on hover */
}

.stone-info {
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    /* Take remaining space */
    justify-content: space-between;
    /* Push button to bottom */
}

.stone-info h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 6px 0 2px;
    color: #222;
}

.stone-info p {
    font-size: 14px;
    margin: 2px 0 10px;
    color: #555;
}

.details-btn {
    display: block;
    width: 200px;
    max-width: 100%;
    min-width: 120px;
    margin: 16px auto 0 auto;
    padding: 12px 0;
    font-size: 1.08em;
    font-weight: 600;
    border-radius: 24px;
    background: #f89a34;
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(248, 154, 52, 0.08);
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-align: center;
    letter-spacing: 0.02em;
}

.details-btn:hover,
.details-btn:focus {
    background: #e67c1f;
    color: #fff;
    box-shadow: 0 4px 16px rgba(248, 154, 52, 0.18);
}

@media (max-width: 600px) {

    /* Remove header-bar, left-section, right-section, logo-wrapper mobile overrides to restore old mobile header */
    /* Only keep the card, popup, and footer improvements */
    .stone-card {
        margin: 10px 0;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .stone-info {
        text-align: center;
        padding: 0 5px;
    }

    .details-btn,
    .copy-btn,
    .download-btn,
    #popup-download {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin: 8px 0 !important;
        font-size: 1.1em !important;
        padding: 10px 0 !important;
        box-sizing: border-box;
    }

    .popup-content {
        padding: 5vw 2vw;
        max-width: 100vw;
        max-height: 98vh;
        border-radius: 10px;
    }

    .popup-content img {
        max-width: 98vw;
        max-height: 35vh;
        margin-bottom: 10px;
    }

    .popup-details {
        padding: 0 2vw 10px 2vw;
        text-align: center;
    }

    .popup-buttons {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
        margin-top: 12px;
    }

    .footer-main,
    .footer-section {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .group-card .group-card-code-mobile-hide {
        display: none !important;
    }

    .group-card .stone-info {
        padding: 10px !important;
        min-height: unset !important;
    }

    .group-card .stone-group-title {
        font-size: 1em !important;
        margin-bottom: 4px !important;
    }

    .group-card .stone-type {
        font-size: 0.95em !important;
        margin-bottom: 4px !important;
    }

    .group-card .details-btn {
        margin-top: 6px !important;
        margin-bottom: 0 !important;
        padding: 10px 0 !important;
        font-size: 1em !important;
    }
}

/* === Improved Popup Styles === */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
    animation: fadeIn 0.3s ease-out;
    overscroll-behavior: contain;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.popup-overlay[aria-hidden="true"] {
    display: none;
}

.popup-overlay[aria-hidden="false"] {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.popup-content {
    background: white;
    padding: 25px;
    border-radius: 16px;
    text-align: center;
    width: auto;
    min-width: 320px;
    max-width: 90vw;
    max-height: 85vh;
    overflow: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: popupFadeIn 0.4s ease-out;
    touch-action: manipulation;
    /* Disables double-tap zoom */
    -webkit-user-select: none;
    /* Prevents text selection */
    user-select: none;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.popup-content img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    display: block;
    margin: 0 auto 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    touch-action: pinch-zoom;
    -ms-touch-action: pinch-zoom;
    -webkit-touch-callout: none;
}

.popup-image-container {
    display: block;
    width: 100%;
    margin-bottom: 20px;
}

.popup-details {
    padding: 0 20px 20px 20px;
    text-align: left;
}

@media (max-width: 900px) {
    .popup-content {
        padding: 10px;
        max-width: 98vw;
        max-height: 98vh;
    }

    .popup-content img {
        max-width: 98vw;
        max-height: 40vh;
    }

    .popup-details {
        padding: 0 8px 12px 8px;
    }
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 10;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.close-btn:hover {
    background: #f89a34;
    color: #fff;
    border-color: transparent;
    transform: rotate(90deg);
}

.popup-content h2 {
    margin: 10px 0 5px 0;
    font-size: 24px;
    color: #333;
}

.popup-content p {
    margin: 5px 0 15px;
    font-size: 16px;
    color: #555;
}

.popup-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.copy-btn,
.download-btn,
#popup-download {
    background-color: #444;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.3s ease;
    flex-grow: 1;
    max-width: 180px;
    font-weight: 500;
}

.copy-btn:hover,
.download-btn:hover {
    background-color: #f89a34;
    transform: translateY(-3px) scale(1.02);
}

.whatsapp-icon-btn {
    background-color: #25d366;
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    margin-left: 5px;
    flex-shrink: 0;
}

.whatsapp-icon-btn:hover {
    background-color: #1ebd59;
    transform: scale(1.1);
}

/* WhatsApp button inside popup on mobile */
@media (max-width: 768px) {
    .popup-buttons .whatsapp-icon-btn {
        width: 100%;
        border-radius: 8px;
        height: 48px;
        margin-left: 0;
        margin-top: 0;
    }

    .popup-buttons .whatsapp-icon-btn:hover {
        transform: translateY(-2px);
    }
}

/* === Improved Magnifier Lens Style === */
.magnifier-lens {
    position: absolute;
    border: 3px solid #f89a34;
    border-radius: 50%;
    cursor: none;
    width: 150px;
    height: 150px;
    overflow: hidden;
    pointer-events: none;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

/* === Footer Enhancement === */
footer {
    background: linear-gradient(to top, #111, #1a1a1a);
    color: #bbb;
    border-top: 2px solid #f89a34;
    margin-top: 40px;
    box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.3);
}

.footer-content {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

.footer-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 40px;
    padding: 40px 30px;
}

.footer-section {
    flex: 1;
    min-width: 220px;
}

.footer-section h3 {
    color: #f89a34;
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: 500;
    position: relative;
    padding-bottom: 10px;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: #f89a34;
}

.footer-section p {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
    color: #bbb;
}

.footer-links {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: #bbb;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.footer-links a:hover {
    color: #f89a34;
    transform: translateX(5px);
}

.footer-social {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.footer-social a {
    height: 40px;
    width: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    transition: all 0.3s ease;
    text-decoration: none;
}

.footer-social a:hover {
    background: rgba(248, 154, 52, 0.2);
    color: #f89a34;
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding: 20px;
    font-size: 13px;
    background: rgba(0, 0, 0, 0.3);
    color: #999;
}

/* === Enhanced Mobile Responsive Styles === */
@media (max-width: 1024px) {
    #catalog {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 16px;
        padding: 0 15px 30px;
    }
}

@media (max-width: 768px) {

    /* Header Mobile Improvements */
    .header-bar {
        flex-direction: column;
        padding: 15px 15px 12px 15px;
        gap: 15px;
    }

    .left-section {
        width: 100%;
        justify-content: flex-start;
        align-items: flex-start;
        gap: 15px;
        flex-wrap: nowrap;
    }

    .logo-wrapper {
        height: 55px;
        width: 55px;
        flex-shrink: 0;
        padding: 8px;
    }

    .logo-final {
        max-height: 42px;
        max-width: 42px;
        width: auto;
        height: auto;
        object-fit: contain;
    }

    .contact-line {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        font-size: 13px;
        flex: 1;
        min-width: 0;
        padding-top: 2px;
    }

    .contact-item {
        padding: 3px 0;
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .contact-item span {
        font-size: 13px;
        line-height: 1.4;
        word-break: break-word;
        overflow-wrap: break-word;
        flex: 1;
        min-width: 0;
    }

    .contact-icon {
        font-size: 15px;
        flex-shrink: 0;
        color: #f89a34;
        width: 18px;
        text-align: center;
    }

    .right-section {
        width: 100%;
        justify-content: space-between;
        align-items: center;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        gap: 10px;
        flex-wrap: nowrap;
    }

    .social-link {
        height: 38px;
        width: 38px;
        font-size: 16px;
        flex-shrink: 0;
    }

    .lang-toggle-btn {
        flex-shrink: 0;
        margin-left: auto;
    }

    /* Search & Filter Mobile Improvements */
    #search-filter-container {
        padding: 12px;
        gap: 10px;
        margin: 15px auto;
        width: calc(100% - 30px);
        max-width: 100%;
        box-sizing: border-box;
    }

    .search-filter-inputs {
        flex-direction: column;
        gap: 12px;
    }

    .search-input-wrapper {
        width: 100%;
        min-width: 0;
    }

    #stoneSearch,
    #stoneFilter {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box;
        font-size: 14px;
        padding: 10px 15px;
    }

    #stoneSearch {
        padding-right: 40px;
    }

    .active-filters {
        gap: 6px;
    }

    .filter-chip {
        font-size: 12px;
        padding: 5px 10px;
    }

    /* Catalog Mobile Improvements */
    #catalog {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
        padding: 0 10px 20px;
    }

    .stone-card img {
        height: 140px;
    }

    .stone-info {
        padding: 10px;
    }

    .stone-info h2 {
        font-size: 14px;
    }

    .stone-info p {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .details-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    /* Popup Mobile Improvements */
    .popup-overlay {
        padding: 10px 0;
        align-items: flex-start;
        justify-content: flex-start;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .popup-content {
        padding: 15px 12px;
        margin: 10px auto;
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        animation: fadeSlideUp 0.3s ease-out;
        box-sizing: border-box;
        position: relative;
    }

    .close-btn {
        width: 40px;
        height: 40px;
        font-size: 28px;
        top: 10px;
        right: 10px;
        z-index: 1001;
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    @keyframes fadeSlideUp {
        from {
            opacity: 0;
            transform: translateY(20px) scale(0.97);
        }

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

    .popup-content img,
    .popup-gallery-img {
        max-height: 40vh;
        max-width: 100%;
        width: auto;
        height: auto;
    }

    .popup-image-wrapper {
        max-width: 100%;
    }

    .popup-content h2 {
        font-size: 20px;
    }

    .popup-buttons {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
        width: 100%;
    }

    .copy-btn,
    .download-btn,
    #popup-download {
        max-width: none;
        width: 100%;
        margin: 0;
    }



    /* Footer Mobile Improvements */
    .footer-main {
        flex-direction: column;
        gap: 30px;
        padding: 30px 20px;
    }

    .footer-section {
        width: 100%;
        text-align: center;
    }

    .footer-section h3::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .footer-links a {
        justify-content: center;
    }

    .footer-social {
        justify-content: center;
    }
}

/* Extra Small Devices */
@media (max-width: 480px) {
    #catalog {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 0 8px 20px;
    }

    .stone-card img {
        height: 120px;
    }

    .stone-info h2 {
        font-size: 13px;
        margin: 5px 0 2px;
    }

    .stone-info p {
        font-size: 12px;
        margin: 0 0 5px;
    }

    .details-btn {
        padding: 8px 12px;
        font-size: 13px;
        margin-top: 5px;
        min-height: 44px;
    }

    .popup-content {
        padding: 12px 10px;
        margin: 5px;
        max-width: calc(100vw - 10px);
    }

    .popup-content img,
    .popup-gallery-img {
        max-height: 35vh;
    }

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

    .header-bar {
        padding: 12px 12px 10px 12px;
        gap: 12px;
    }

    .left-section {
        gap: 12px;
    }

    .logo-wrapper {
        height: 50px;
        width: 50px;
        padding: 6px;
    }

    .logo-final {
        max-height: 38px;
        max-width: 38px;
    }

    .contact-line {
        font-size: 12px;
        gap: 5px;
    }

    .contact-item {
        padding: 2px 0;
        gap: 6px;
    }

    .contact-item span {
        font-size: 12px;
    }

    .contact-icon {
        font-size: 14px;
        width: 16px;
    }

    .right-section {
        padding-top: 8px;
        gap: 8px;
    }

    .social-link {
        height: 36px;
        width: 36px;
        font-size: 15px;
    }

    .lang-toggle-btn {
        font-size: 13px;
        padding: 7px 10px;
        min-width: 85px;
    }

    #search-filter-container {
        padding: 10px;
        margin: 12px auto;
        width: calc(100% - 24px);
    }
}

.group-card .group-title {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

.group-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding: 15px;
}

.group-item-box {
    background: #f7f7f7;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    padding: 10px;
    text-align: center;
    transition: all 0.3s ease;
}

.group-item-box img {
    width: 100%;
    max-height: 100px;
    object-fit: cover;
    border-radius: 6px;
}

.group-item-box:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.group-item-box .mini-description {
    font-size: 13px;
    margin-top: 5px;
    color: #444;
    text-align: left;
}

.slide-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #f89a34;
    color: white;
    border: none;
    font-size: 22px;
    padding: 10px;
    cursor: pointer;
    border-radius: 50%;
    z-index: 10;
}

#popup-prev {
    left: 10px;
}

#popup-next {
    right: 10px;
}

.slide-btn:hover {
    background: #d47d26;
}

@media (max-width: 768px) {
    .magnifier-lens {
        width: 100px;
        height: 100px;
        border: 2px solid #f89a34;
    }
}

/* Base style */
.group-image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 10px;
    margin-bottom: 10px;
    height: 180px;
    /* Match single image card height */
    overflow: hidden;
}


.grid-img-box {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid #ccc;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.grid-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.more-count {
    position: absolute;
    top: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    font-weight: bold;
    font-size: 1.4em;
    border-radius: 6px;
    width: 100%;
    height: 100%;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}


@media (min-width: 768px) {

    .group-image-grid.images-5,
    .group-image-grid.images-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

.popup-content-inner {
    display: flex;
    flex-direction: row;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
}

.popup-image-wrapper {
    flex: 1 1 300px;
    max-width: 400px;
}

.popup-image-wrapper img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    object-fit: contain;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.popup-text-wrapper {
    flex: 1 1 300px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.popup-meta p {
    font-size: 15px;
    color: #444;
    margin: 0 0 8px;
}

.popup-description {
    font-size: 15px;
    color: #333;
    white-space: pre-line;
    /* Preserve line breaks */
    background: #f9f9f9;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #eee;
}

@media (max-width: 768px) {
    .popup-content-inner {
        flex-direction: column;
        align-items: center;
    }

    .popup-image-wrapper,
    .popup-text-wrapper {
        max-width: 100%;
        flex: 1 1 auto;
    }

    .popup-description {
        font-size: 14px;
    }
}

.grid-img-box:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .popup-image-wrapper {
        margin-bottom: 15px;
    }
}

.group-card .stone-image-container {
    height: 180px;
    overflow: hidden;
}

.group-card .group-image-grid {
    height: 180px;
}

@media (max-width: 768px) {
    .group-card {
        background: rgba(255, 255, 255, 0.95);
        border: 1px solid #ccc;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 360px;
        margin: auto;
    }

    .group-card .group-title {
        font-size: 1rem;
        padding: 10px;
    }

    .group-card .group-image-grid {
        max-height: 140px;
        gap: 4px;
    }

    .group-card .grid-img-box img {
        height: auto;
    }
}

.stone-group-title {
    font-weight: bold;
    font-size: 16px;
}

.stone-group-code {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.thickness-button-group {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 10px;
    gap: 8px;
}

.thickness-btn {
    padding: 6px 14px;
    border: none;
    background-color: #eee;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.thickness-btn.selected {
    background-color: #ff8c00;
    color: white;
}

.single-preview-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 6px;
}

/* ✅ Compress group-card with only 1 image on mobile */
@media (max-width: 768px) {
    .group-card.one-image .group-image-grid {
        display: block;
        height: auto;
        padding: 0;
    }

    .group-card.one-image .grid-img-box {
        aspect-ratio: unset;
        height: 140px;
        /* Match single image height */
        width: 100%;
        border-radius: 0;
        box-shadow: none;
        border: none;
    }

    .group-card.one-image .grid-img-box img {
        object-fit: cover;
        height: 100%;
        width: 100%;
        border-radius: 0;
    }

    .group-card.one-image .stone-image-container {
        height: auto;
        padding: 0;
    }
}

@media (max-width: 768px) {
    .popup-content {
        padding: 15px 10px;
        max-height: 90vh;
        overflow-y: auto;
        overflow-x: hidden;
        border-radius: 12px;
    }

    .popup-content img {
        max-height: 240px;
        width: 100%;
        object-fit: cover;
    }

    .popup-content-inner {
        flex-direction: column;
        padding: 10px 0;
        gap: 12px;
    }

    .popup-buttons {
        flex-direction: column;
        gap: 12px;
    }

    .copy-btn,
    .download-btn,
    #popup-download {
        width: 100%;
        font-size: 14px;
    }
}

@media (max-width: 768px) {

    #popup-prev,
    #popup-next {
        top: 50%;
        transform: translateY(-50%);
        padding: 10px;
        font-size: 18px;
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 768px) {
    .magnifier-lens {
        width: 100px;
        height: 100px;
        border: 2px solid #f89a34;
    }
}

@media (max-width: 480px) {
    .magnifier-lens {
        width: 80px;
        height: 80px;
    }
}

.popup-content {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

body,
html {
    overflow-x: hidden;
    /* Prevent horizontal scroll on mobile */
    width: 100%;
    position: relative;
}

/* Prevent zoom on input focus on iOS */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
}

button,
.details-btn,
.slide-btn,
.thickness-btn,
.gallery-nav-btn,
.copy-btn,
.download-btn,
#popup-download,
.whatsapp-icon-btn,
.lang-toggle-btn,
.social-link {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Improve touch targets on mobile */
@media (max-width: 768px) {
    button,
    .details-btn,
    .copy-btn,
    .download-btn,
    #popup-download,
    .thickness-btn {
        min-height: 44px; /* Minimum touch target size */
    }

    .gallery-nav-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* === No Results Message === */
.no-results-message {
    text-align: center;
    padding: 60px 20px;
    color: #ddd;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    margin: 40px auto;
    max-width: 500px;
}

.no-results-message i {
    font-size: 48px;
    color: #f89a34;
    margin-bottom: 20px;
    opacity: 0.7;
}

.no-results-message h3 {
    color: #f89a34;
    margin: 0 0 10px 0;
    font-size: 24px;
}

.no-results-message p {
    color: #bbb;
    margin: 0 0 20px 0;
    font-size: 16px;
    line-height: 1.6;
}

.clear-filters-btn {
    background: #f89a34;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
}

.clear-filters-btn:hover {
    background: #e67c1f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(248, 154, 52, 0.3);
}

@media (max-width: 768px) {
    .no-results-message {
        padding: 40px 15px;
        margin: 20px;
    }

    .no-results-message i {
        font-size: 40px;
    }

    .no-results-message h3 {
        font-size: 20px;
    }

    .no-results-message p {
        font-size: 14px;
    }
}

/* === Loading and Error States === */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #ddd;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(248, 154, 52, 0.3);
    border-top: 3px solid #f89a34;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

/* Loading Skeletons */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ccc;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.skeleton-image {
    width: 100%;
    height: 180px;
    margin-bottom: 15px;
}

.skeleton-text {
    height: 16px;
    margin: 8px 15px;
    border-radius: 4px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.medium {
    width: 80%;
}

.skeleton-button {
    height: 40px;
    width: 200px;
    margin: 16px auto;
    border-radius: 24px;
}

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

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

.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #ddd;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 12px;
    margin: 20px;
}

.error-container i {
    font-size: 48px;
    color: #dc3545;
    margin-bottom: 20px;
}

.error-container h3 {
    color: #dc3545;
    margin-bottom: 10px;
}

.retry-btn {
    background: #f89a34;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.retry-btn:hover {
    background: #e6b45c;
    transform: translateY(-2px);
}

/* === Lazy Loading Animations === */
.stone-card img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stone-card img.loaded {
    opacity: 1;
}

.stone-card img.error {
    opacity: 0.5;
    filter: grayscale(100%);
}

/* === Enhanced Search with Debouncing === */
#stoneSearch {
    flex-grow: 1;
    padding: 12px 18px;
    font-size: 16px;
    border-radius: 10px;
    border: 1px solid #f89a34;
    outline: none;
    background: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
    min-width: 200px;
    position: relative;
}

#stoneSearch:focus {
    box-shadow: 0 0 0 3px rgba(248, 154, 52, 0.3);
    border-color: #e6b45c;
}

#stoneSearch.searching {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%23f89a34" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

/* === Enhanced Stone Cards === */
.stone-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stone-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
}

.stone-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f89a34, #e6b45c);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.stone-card:hover::before {
    transform: scaleX(1);
}

/* === Enhanced Buttons === */
.details-btn {
    background: linear-gradient(135deg, #f89a34, #e6b45c);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.details-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.details-btn:hover::before {
    left: 100%;
}

.details-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(248, 154, 52, 0.3);
}

/* === Enhanced Popup === */
.popup-content {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    padding: 30px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.popup-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #f89a34, #e6b45c, #f89a34);
    border-radius: 20px 20px 0 0;
}

/* === Enhanced Footer === */
footer {
    background: linear-gradient(135deg, #1a1a1a, #252525);
    color: #ddd;
    padding: 40px 0 20px;
    margin-top: 60px;
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f89a34, #e6b45c, #f89a34);
}

/* === Enhanced Social Links === */
.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    width: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    transition: all 0.3s ease;
    color: #ddd;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.social-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #f89a34, #e6b45c);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 50%;
}

.social-link:hover::before {
    opacity: 1;
}

.social-link:hover {
    transform: translateY(-3px) scale(1.1);
    color: white;
}

.social-link i {
    position: relative;
    z-index: 1;
}

/* === Enhanced Responsive Design === */
@media (max-width: 768px) {

    .loading-container,
    .error-container {
        padding: 40px 20px;
    }

    .loading-spinner {
        width: 40px;
        height: 40px;
    }

    .error-container i {
        font-size: 36px;
    }

    .popup-content {
        margin: 20px;
        padding: 20px;
        border-radius: 15px;
    }

    .popup-content::before {
        border-radius: 15px 15px 0 0;
    }
}

/* === Enhanced Accessibility === */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === Focus States for Accessibility === */
.details-btn:focus,
.social-link:focus,
.retry-btn:focus {
    outline: 2px solid #f89a34;
    outline-offset: 2px;
}

/* === Cookie Consent Banner === */
.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1a1a1a, #252525);
    border-top: 3px solid #f89a34;
    padding: 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transform: translateY(100%);
    transition: transform 0.4s ease-out;
}

.cookie-consent:not(.visually-hidden) {
    transform: translateY(0);
}

.cookie-consent-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-consent-text {
    flex: 1;
    min-width: 250px;
}

.cookie-consent-text h3 {
    color: #f89a34;
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
}

.cookie-consent-text p {
    color: #ddd;
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.cookie-link {
    color: #f89a34;
    text-decoration: underline;
}

.cookie-link:hover {
    color: #e67c1f;
}

.cookie-consent-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.cookie-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    min-height: 44px;
}

.cookie-btn-accept {
    background: #f89a34;
    color: #fff;
}

.cookie-btn-accept:hover {
    background: #e67c1f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(248, 154, 52, 0.3);
}

.cookie-btn-necessary {
    background: transparent;
    color: #ddd;
    border: 1px solid #666;
}

.cookie-btn-necessary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #999;
}

@media (max-width: 768px) {
    .cookie-consent {
        padding: 15px;
    }

    .cookie-consent-content {
        flex-direction: column;
        align-items: stretch;
    }

    .cookie-consent-buttons {
        width: 100%;
    }

    .cookie-btn {
        flex: 1;
        min-width: 0;
    }
}

/* === Back to Top Button === */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #f89a34;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
}

.back-to-top.show {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.back-to-top:hover {
    background: #e67c1f;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
    .back-to-top {
        width: 44px;
        height: 44px;
        font-size: 18px;
        bottom: 15px;
        right: 15px;
    }
}

/* === Print Styles === */
@media print {
    /* Hide interactive elements */
    .social-link,
    .details-btn,
    .close-btn,
    .back-to-top,
    .cookie-consent,
    .search-filter-wrapper,
    .lang-toggle-btn,
    .filter-chip,
    .clear-search-btn,
    .clear-filters-btn,
    .popup-overlay {
        display: none !important;
    }

    /* Print-friendly layout */
    body {
        background: #fff !important;
        color: #000 !important;
    }

    .header {
        background: #fff !important;
        border-bottom: 2px solid #000;
        padding: 20px 0;
        page-break-after: avoid;
    }

    .logo-final {
        filter: none !important;
    }

    .stone-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
        margin-bottom: 20px;
    }

    .stone-card img {
        max-height: 200px;
        object-fit: contain;
    }

    .footer {
        page-break-inside: avoid;
        border-top: 2px solid #000;
        margin-top: 40px;
        padding-top: 20px;
    }

    /* Ensure URLs are visible */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }

    /* Page breaks */
    .catalog {
        display: block;
    }

    h1, h2, h3 {
        page-break-after: avoid;
    }

    /* Print header/footer */
    @page {
        margin: 2cm;
        @top-center {
            content: "Jordanian Stone Catalog";
            font-size: 10pt;
        }
        @bottom-right {
            content: "Page " counter(page);
            font-size: 10pt;
        }
    }
}

/* Language Toggle Button Styles */
.lang-toggle-btn {
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    border: 1px solid #f89a34;
    background: #fff;
    color: #222;
    border-radius: 8px;
    padding: 6px 12px;
    margin-left: 16px;
    min-width: 110px;
    transition: border 0.3s, background 0.3s, color 0.3s;
    cursor: pointer;
    white-space: nowrap;
}

.lang-toggle-btn:hover {
    background: #f89a34;
    color: #fff;
}

.lang-toggle-btn:focus {
    outline: 2px solid #f89a34;
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .lang-toggle-btn {
        margin-left: 0;
        min-width: 90px;
        font-size: 14px;
        padding: 8px 12px;
    }
}

@media (max-width: 600px) {

    /* Remove header-bar, left-section, right-section, logo-wrapper mobile overrides to restore old mobile header */
    /* Only keep the card, popup, and footer improvements */
    .stone-card {
        margin: 10px 0;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .stone-info {
        text-align: center;
        padding: 0 5px;
    }

    .details-btn,
    .copy-btn,
    .download-btn,
    #popup-download {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin: 8px 0 !important;
        font-size: 1.1em !important;
        padding: 10px 0 !important;
        box-sizing: border-box;
    }

    .popup-content {
        padding: 5vw 2vw;
        max-width: 100vw;
        max-height: 98vh;
        border-radius: 10px;
    }

    .popup-content img {
        max-width: 98vw;
        max-height: 35vh;
        margin-bottom: 10px;
    }

    .popup-details {
        padding: 0 2vw 10px 2vw;
        text-align: center;
    }

    .popup-buttons {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
        margin-top: 12px;
    }

    .footer-main,
    .footer-section {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .group-card .group-card-code-mobile-hide {
        display: none !important;
    }

    .group-card .stone-info {
        padding: 10px !important;
        min-height: unset !important;
    }

    .group-card .stone-group-title {
        font-size: 1em !important;
        margin-bottom: 4px !important;
    }

    .group-card .stone-type {
        font-size: 0.95em !important;
        margin-bottom: 4px !important;
    }

    .group-card .details-btn {
        margin-top: 6px !important;
        margin-bottom: 0 !important;
        padding: 10px 0 !important;
        font-size: 1em !important;
    }
}

/* Popup button improvements for all mobile (max-width: 768px) */
@media (max-width: 768px) {
    .popup-buttons {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
        margin-top: 12px;
    }

    .copy-btn,
    .download-btn,
    #popup-download {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        font-size: 1.1em;
        margin: 0;
        padding: 12px 0;
        box-sizing: border-box;
    }
}

@media (max-width: 600px) {
    #catalog {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        align-items: start !important;
        gap: 10px;
    }

    .stone-card {
        height: 250px;
        max-height: 250px;
        min-height: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        overflow: hidden;
    }

    .stone-info {
        flex: 1 1 auto;
        overflow: hidden;
    }

    .stone-info h2,
    .stone-info p {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.popup-image-gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.popup-gallery-main-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 10px;
}

.popup-gallery-img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
    display: block;
    margin: 0 auto;
}

.popup-gallery-thumbnails {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-top: 10px;
    justify-content: center;
    align-items: center;
    overflow-x: auto;
    width: 100%;
}

.popup-gallery-thumbnails img.popup-gallery-thumb {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #eee;
    cursor: pointer;
    opacity: 0.7;
    transition: border 0.2s, opacity 0.2s;
    flex-shrink: 0;
    box-sizing: border-box;
}

.popup-gallery-thumb.active {
    border: 2px solid #f89a34;
    opacity: 1;
    box-shadow: 0 0 6px #f89a34;
}

.popup-image-note {
    font-size: 1em;
    color: #555;
    margin-bottom: 8px;
}

.popup-image-note-above-thickness {
    font-size: 1.1em;
    color: #f89a34;
    font-weight: bold;
    margin-bottom: 8px;
    text-align: start;
    padding-inline-start: 4px;
}

#popup-dimensions {
    text-align: start;
    padding-inline-start: 4px;
}

@media (max-width: 600px) {
    .popup-gallery-main-wrapper {
        max-width: 98vw;
        min-width: 0;
        margin-bottom: 8px;
    }

    .popup-gallery-img {
        max-width: 96vw;
        max-height: 180px;
        border-radius: 10px;
    }

    .popup-gallery-thumbnails {
        gap: 4px;
        margin-top: 6px;
        padding-bottom: 4px;
        overflow-x: auto;
        width: 100%;
        scrollbar-width: thin;
    }

    .popup-gallery-thumb {
        width: 38px !important;
        height: 38px !important;
        max-width: 38px !important;
        max-height: 38px !important;
        border-radius: 5px;
    }

    .gallery-nav-btn {
        font-size: 1.2em;
        width: 32px;
        height: 32px;
        padding: 0;
        min-width: 0;
        min-height: 0;
        border-radius: 50%;
        background: #fff;
        opacity: 0.85;
        z-index: 2;
    }
}

@media (max-width: 600px) {

    .popup-overlay,
    .popup-content {
        padding-top: env(safe-area-inset-top, 20px);
    }
}/* ============================================
   COMPREHENSIVE RTL (RIGHT-TO-LEFT) SUPPORT
   ============================================ */

/* Popup Meta and Dimensions */
[dir="rtl"] .popup-meta p,
[dir="rtl"] #popup-dimensions,
[dir="rtl"] .popup-image-note-above-thickness {
    text-align: right;
}

[dir="ltr"] .popup-meta p,
[dir="ltr"] #popup-dimensions,
[dir="ltr"] .popup-image-note-above-thickness {
    text-align: left;
}

/* Popup Buttons */
[dir="rtl"] .popup-buttons {
    flex-direction: row-reverse;
}

/* Footer Links */
[dir="rtl"] .footer-links {
    direction: rtl;
}

[dir="rtl"] .footer-links a {
    direction: rtl;
}

/* Icon Mirroring for Directional Icons */
[dir="rtl"] .fa-chevron-right::before {
    content: "\f053"; /* Left chevron */
}

[dir="rtl"] .fa-arrow-right::before {
    content: "\f060"; /* Left arrow */
}

[dir="rtl"] .fa-arrow-left::before {
    content: "\f061"; /* Right arrow */
}

/* Gallery Navigation Buttons */
[dir="rtl"] .gallery-nav-btn,
[dir="rtl"] #popup-prev,
[dir="rtl"] #popup-next {
    transform: scaleX(-1);
}

/* Search Input Alignment */
[dir="rtl"] #stoneSearch {
    text-align: right;
    direction: rtl;
}

[dir="ltr"] #stoneSearch {
    text-align: left;
    direction: ltr;
}

/* Filter Select Alignment */
[dir="rtl"] #stoneFilter {
    text-align: right;
    direction: rtl;
}

[dir="ltr"] #stoneFilter {
    text-align: left;
    direction: ltr;
}

/* Contact Items */
[dir="rtl"] .contact-item {
    flex-direction: row-reverse;
}

/* Back to Top Button */
[dir="rtl"] .back-to-top,
[dir="ltr"] .back-to-top {
    inset-inline-end: 20px;
    inset-inline-start: auto;
}

/* Cookie Consent */
[dir="rtl"] .cookie-consent-content {
    flex-direction: row-reverse;
}

[dir="rtl"] .cookie-consent-buttons {
    flex-direction: row-reverse;
}

/* Filter Chips */
[dir="rtl"] .filter-chip {
    flex-direction: row-reverse;
}

/* No Results Message */
[dir="rtl"] .no-results-message {
    text-align: right;
}

[dir="ltr"] .no-results-message {
    text-align: center;
}

/* Error Container */
[dir="rtl"] .error-container {
    text-align: right;
}

[dir="ltr"] .error-container {
    text-align: center;
}

/* Loading Container */
[dir="rtl"] .loading-container {
    text-align: right;
}

[dir="ltr"] .loading-container {
    text-align: center;
}

