/* ZOYNIQ Mobile Optimization - 90+ Lighthouse Score */

/* Prevent layout shifts on mobile */
:root {
    --zq-safe-area-top: max(12px, env(safe-area-inset-top));
    --zq-safe-area-right: max(12px, env(safe-area-inset-right));
    --zq-safe-area-bottom: max(12px, env(safe-area-inset-bottom));
    --zq-safe-area-left: max(12px, env(safe-area-inset-left));
}

/* Improve mobile header */
@media (max-width: 768px) {
    .zq-header {
        padding-left: var(--zq-safe-area-left);
        padding-right: var(--zq-safe-area-right);
        min-height: 64px;
    }

    .zq-header__inner {
        min-height: 60px;
        gap: 12px;
    }

    .zq-brand {
        font-size: 16px;
    }

    .zq-brand__mark {
        width: 32px;
        height: 32px;
    }

    /* Better mobile navigation fallback */
    .zq-nav {
        display: none;
    }

    /* Stack actions vertically on small screens */
    .zq-header__actions {
        gap: 8px;
    }

    .zq-cart-link {
        min-height: 36px;
        padding: 0 12px;
        font-size: 13px;
    }

    .zq-cart-link__icon {
        width: 16px;
        height: 16px;
    }

    .zq-cart-link__icon svg {
        width: 16px;
        height: 16px;
    }

    .zq-header--marketplace {
        padding-left: 0;
        padding-right: 0;
        min-height: 0;
    }

    .zq-header--marketplace .zq-market-header__top {
        min-height: 0;
        gap: 10px;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .zq-header--marketplace .zq-brand {
        font-size: 28px;
    }

    .zq-header--marketplace .zq-brand__mark {
        display: grid;
    }

    .zq-header--marketplace .zq-cart-link {
        width: 38px;
        height: 38px;
        min-height: 38px;
        padding: 0;
    }
}

/* Optimize service archive for mobile */
@media (max-width: 640px) {
    .zq-fiverr-services {
        padding: 40px 16px;
    }

    .zq-fiverr-services__hero {
        gap: 16px;
    }

    .zq-fiverr-services__search {
        gap: 12px;
    }

    .zq-fiverr-services__search-input {
        padding: 12px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .zq-fiverr-services__grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
        gap: 12px;
    }

    .zq-fiverr-services__guides-grid,
    .zq-fiverr-services__tips-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .zq-fiverr-service-card {
        border-radius: 16px;
        box-shadow: 0 12px 28px rgba(17, 24, 39, 0.05);
    }

    .zq-fiverr-service-card__body {
        gap: 10px;
        padding: 14px 14px 16px;
    }

    .zq-fiverr-service-card__media {
        aspect-ratio: 4 / 3;
    }

    .zq-fiverr-service-card h2 {
        font-size: 13px;
        line-height: 1.28;
    }

    .zq-fiverr-service-card p {
        font-size: 12px;
        line-height: 1.5;
    }

    /* Prevent horizontal scroll on mobile */
    .zq-container {
        width: calc(100% - 16px);
        padding-left: 0;
        padding-right: 0;
    }

    /* Better button sizing for mobile touch */
    .zq-btn {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 15px;
    }

    .zq-btn--small {
        min-height: 40px;
        padding: 10px 14px;
        font-size: 13px;
    }

    /* Mobile-friendly filter UI */
    .zq-fiverr-services__toolbar {
        flex-direction: column;
        gap: 12px;
    }

    .zq-fiverr-services__select,
    .zq-fiverr-services__sort {
        width: 100%;
    }

    .zq-fiverr-services__select select,
    .zq-fiverr-services__sort select {
        width: 100%;
        padding: 12px 14px;
        font-size: 15px;
    }
}

@media (max-width: 768px) {
    .zq-fiverr-services__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .zq-section__head h1 {
        font-size: clamp(28px, 6vw, 48px);
    }

    .zq-section__head h2 {
        font-size: clamp(24px, 5vw, 42px);
    }
}

/* Optimize single service page for mobile */
@media (max-width: 768px) {
    .zq-service-marketplace {
        padding: 24px 0;
    }

    .zq-service-marketplace__breadcrumbs {
        font-size: 12px;
        margin-bottom: 20px;
    }

    /* Stack gallery and sidebar vertically */
    .zq-product-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .zq-product-sidebar {
        position: relative;
        top: 0;
    }

    .zq-physical-gallery__stage {
        min-height: 300px;
    }

    .zq-physical-gallery__stage img {
        height: 100%;
        object-fit: cover;
    }

    /* Optimize service card sizing */
    .zq-card {
        border-radius: 16px;
        padding: 16px;
    }

    .zq-card__icon {
        width: 40px;
        height: 40px;
    }

    .zq-card h3 {
        font-size: 18px;
    }

    .zq-card p {
        font-size: 14px;
    }

    /* Better plan selection on mobile */
    .zq-service-market-sidebar__tabs {
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }

    .zq-service-market-sidebar__tab {
        scroll-snap-align: start;
        flex: 0 0 auto;
        min-width: auto;
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Responsive modal */
    .zq-portfolio-modal__container {
        width: calc(100vw - 24px);
        height: auto;
        max-height: 90vh;
        border-radius: 16px;
    }
}

@media (max-width: 480px) {
    .zq-container {
        width: calc(100% - 12px);
    }

    .zq-fiverr-services {
        padding: 32px 12px;
    }

    .zq-fiverr-services__grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
        gap: 10px;
    }

    .zq-section__head h1 {
        font-size: clamp(24px, 7vw, 36px);
    }

    .zq-card {
        padding: 12px;
    }

    .zq-card h3 {
        font-size: 16px;
    }

    .zq-btn {
        min-height: 40px;
        padding: 10px 14px;
        font-size: 14px;
    }

    .zq-portfolio-modal__container {
        width: calc(100vw - 16px);
    }

    .zq-portfolio-modal__nav {
        width: 32px;
        height: 32px;
    }
}

/* Fix text input fonts for iOS (prevents auto-zoom) */
input[type="text"],
input[type="email"],
input[type="search"],
textarea,
select {
    font-size: 16px;
}

/* Better focus states for accessibility and mobile */
button,
a,
input,
select,
textarea {
    outline: 2px solid transparent;
    outline-offset: 2px;
}



/* Image skeleton loading */
.zq-skeleton {
    background: linear-gradient(90deg, var(--zq-border) 25%, rgba(15, 23, 42, 0.05) 50%, var(--zq-border) 75%);
    background-size: 200% 100%;
    animation: zq-skeleton-loading 1.5s infinite;
}

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

.zq-card__image-skeleton {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 18px;
    margin: -14px -14px 18px;
    background: var(--zq-border);
}

/* Prevent CLS from images without dimensions */
img {
    aspect-ratio: attr(width) / attr(height, 1);
}

/* Improve scrolling performance */
.zq-cart-drawer__overlay,
.zq-portfolio-modal__overlay,
.zq-product-modal__overlay {
    will-change: opacity;
}

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

    .zq-skeleton {
        animation: none;
        background: var(--zq-border);
    }
}

/* Safe touchable area minimum (44x44px) */
@media (hover: none) and (pointer: coarse) {
    button,
    a,
    input[type="button"],
    input[type="submit"],
    input[type="reset"] {
        min-width: 44px;
        min-height: 44px;
        padding: 12px 16px;
    }
}

/* Better form inputs for mobile */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="search"],
    textarea,
    select {
        min-height: 44px;
        padding: 12px 14px;
        border-radius: 12px;
        font-size: 16px;
    }
}
