/*
 Mego Cart Frontend Compatibility Layer
 Keeps the luxury frontend visually aligned with the previous theme while improving cross-browser support.
*/

* {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body.mego-cart-ui {
    min-height: 100vh;
    overflow-x: hidden;
}

a, button, input, select, textarea {
    -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea {
    font: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

.site-header,
.benefits,
.products-grid,
.checkout-grid,
.half-grid,
.gender-options {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

.products-grid {
    display: -ms-grid;
    display: grid;
}

.site-header {
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}

.brand {
    color: inherit;
    text-decoration: none;
}

.brand-label {
    white-space: normal;
    line-height: 1.05;
}

.lang-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 34px;
    border: 1px solid rgba(217, 163, 93, .35);
    border-radius: 999px;
    color: #efd8b7;
    text-decoration: none;
}

.nav-actions form {
    margin: 0;
}

.nav-actions a,
.nav-actions button {
    color: #efd8b7;
    background: transparent;
    border: 1px solid rgba(217, 163, 93, .25);
    border-radius: 999px;
    padding: 8px 12px;
    text-decoration: none;
    cursor: pointer;
}

.hero-copy h1 {
    max-width: 520px;
}

.filter-card {
    margin-bottom: 20px;
}

.filter-card input,
.filter-card select,
.checkout-card input,
.checkout-card select,
.checkout-card textarea {
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(217, 163, 93, .23);
    background: rgba(255,255,255,.04);
    color: #f5eadb;
    padding: 10px 12px;
    margin-bottom: 10px;
}

.checkout-card textarea {
    min-height: 110px;
    resize: vertical;
}

.product-detail-grid {
    align-items: stretch;
}

.product-card form {
    margin: 0;
}

.product-card .favorite-btn {
    cursor: pointer;
}

:focus-visible {
    outline: 2px solid #d9a35d;
    outline-offset: 3px;
}

@media (max-width: 1100px) {
    .site-header {
        gap: 16px;
        flex-wrap: wrap;
    }

    .site-nav {
        order: 3;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .hero-copy {
        max-width: 500px;
    }
}

@media (max-width: 768px) {
    .site-shell {
        width: 100%;
    }

    .site-header {
        padding: 16px;
    }

    .brand-label {
        font-size: 12px;
    }

    .site-nav {
        gap: 10px;
        font-size: 12px;
    }

    .nav-actions {
        gap: 6px;
    }

    .hero {
        min-height: 560px;
    }

    .hero-copy {
        left: 24px !important;
        right: 24px !important;
        top: auto !important;
        bottom: 42px !important;
        transform: none !important;
    }

    .hero-copy h1 {
        font-size: clamp(38px, 12vw, 66px);
    }

    .benefits,
    .checkout-grid,
    .half-grid {
        grid-template-columns: 1fr !important;
        flex-direction: column;
    }

    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 14px !important;
    }
}

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

    .age-modal {
        width: calc(100% - 24px);
        padding: 22px;
    }

    .hero {
        min-height: 520px;
    }
}

/* Firefox specific tune */
@-moz-document url-prefix() {
    .product-image-wrap img {
        image-rendering: auto;
    }
}

/* Safari safe rendering */
@supports (-webkit-touch-callout: none) {
    .hero-image {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

.chat-window {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 18px 0;
}

.chat-bubble {
    max-width: 76%;
    border: 1px solid rgba(217, 163, 93, .18);
    background: rgba(255,255,255,.045);
    border-radius: 18px;
    padding: 12px 14px;
    color: #f3e7d5;
}

.chat-bubble.mine {
    align-self: flex-end;
    border-color: rgba(217, 163, 93, .42);
    background: rgba(217, 163, 93, .12);
}

.chat-bubble.theirs {
    align-self: flex-start;
}

.is-rtl .chat-bubble.mine {
    align-self: flex-start;
}

.is-rtl .chat-bubble.theirs {
    align-self: flex-end;
}

.bilingual-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 768px) {
    .chat-bubble {
        max-width: 92%;
    }

    .bilingual-fields {
        grid-template-columns: 1fr;
    }
}

.system-copyright {
    margin: 32px auto 10px;
    padding: 18px 14px;
    border-top: 1px solid rgba(217, 163, 93, .22);
    color: #b99f7b;
    text-align: center;
    font-size: 13px;
    line-height: 1.7;
}

.system-copyright small {
    display: block;
    color: rgba(239, 216, 183, .68);
}
