/*
 * MEW Despacho - Categorias da Home
 * Primeira etapa da evolução visual do marketplace.
 * Arquivo independente para facilitar manutenção e futura CSP.
 */

.mew-category-section {
    position: relative;
    margin: 6px 0 30px;
    padding: 24px;
    overflow: hidden;
    background:
        radial-gradient(circle at 92% 0%, rgba(37, 99, 235, .10), transparent 30%),
        linear-gradient(145deg, rgba(255, 255, 255, .96), rgba(248, 250, 252, .92));
    border: 1px solid rgba(255, 255, 255, .90);
    border-radius: 26px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, .08);
}

.mew-category-section::before {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    right: -120px;
    bottom: -145px;
    border-radius: 50%;
    background: rgba(124, 58, 237, .08);
    pointer-events: none;
}

.mew-category-heading {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.mew-category-eyebrow {
    display: inline-block;
    margin-bottom: 6px;
    color: #2563eb;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.mew-category-heading h2 {
    margin: 0;
    color: #0f172a;
    font-size: clamp(23px, 3vw, 31px);
    letter-spacing: -.025em;
}

.mew-category-heading p {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
}

.mew-category-all-link {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    color: #1d4ed8;
    text-decoration: none;
    font-size: 13px;
    font-weight: 900;
    border-radius: 12px;
    transition:
        background-color .2s ease,
        transform .2s ease;
}

.mew-category-all-link:hover {
    background: #eff6ff;
    transform: translateX(2px);
}

.mew-category-all-link:focus-visible,
.mew-category-card:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .30);
    outline-offset: 3px;
}

.mew-category-scroller {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 3px 3px 10px;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 3px;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #bfdbfe transparent;
}

.mew-category-scroller::-webkit-scrollbar {
    height: 6px;
}

.mew-category-scroller::-webkit-scrollbar-track {
    background: transparent;
}

.mew-category-scroller::-webkit-scrollbar-thumb {
    background: #bfdbfe;
    border-radius: 999px;
}

.mew-category-card {
    position: relative;
    flex: 0 0 148px;
    min-height: 172px;
    padding: 16px 12px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    color: #0f172a;
    text-decoration: none;
    background: rgba(255, 255, 255, .96);
    border: 1px solid #e6edf7;
    border-radius: 20px;
    box-shadow: 0 9px 24px rgba(15, 23, 42, .055);
    scroll-snap-align: start;
    transition:
        transform .22s ease,
        border-color .22s ease,
        box-shadow .22s ease,
        background-color .22s ease;
}

.mew-category-card:hover {
    transform: translateY(-5px);
    border-color: #bfdbfe;
    box-shadow: 0 17px 32px rgba(37, 99, 235, .13);
}

.mew-category-card.is-active {
    background:
        linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
    border-color: #60a5fa;
    box-shadow:
        0 0 0 2px rgba(59, 130, 246, .08),
        0 17px 34px rgba(37, 99, 235, .14);
}

.mew-category-card.is-active::after {
    content: "✓";
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: #2563eb;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 900;
    box-shadow: 0 5px 12px rgba(37, 99, 235, .24);
}

.mew-category-icon {
    width: 76px;
    height: 76px;
    margin-bottom: 12px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    font-size: 35px;
    line-height: 1;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .74),
        0 13px 28px rgba(37, 99, 235, .13);
    transition: transform .22s ease;
}

.mew-category-card:hover .mew-category-icon {
    transform: scale(1.06) rotate(-2deg);
}

.mew-category-icon--blue {
    background: linear-gradient(145deg, #dbeafe, #eff6ff);
}

.mew-category-icon--indigo {
    background: linear-gradient(145deg, #e0e7ff, #eef2ff);
}

.mew-category-icon--violet {
    background: linear-gradient(145deg, #ede9fe, #f5f3ff);
}

.mew-category-icon--navy {
    background: linear-gradient(145deg, #dbeafe, #e2e8f0);
}

.mew-category-icon--cyan {
    background: linear-gradient(145deg, #cffafe, #ecfeff);
}

.mew-category-icon--sky {
    background: linear-gradient(145deg, #e0f2fe, #f0f9ff);
}

.mew-category-icon--orange {
    background: linear-gradient(145deg, #ffedd5, #fff7ed);
}

.mew-category-icon--teal {
    background: linear-gradient(145deg, #ccfbf1, #f0fdfa);
}

.mew-category-card strong {
    width: 100%;
    display: -webkit-box;
    overflow: hidden;
    color: #0f172a;
    font-size: 13px;
    line-height: 1.3;
    font-weight: 900;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.mew-category-card > span:last-child {
    margin-top: 6px;
    color: #64748b;
    font-size: 11px;
    line-height: 1.3;
}

.mew-category-card--all .mew-category-icon {
    color: #1d4ed8;
    font-size: 31px;
    font-weight: 900;
}

.mew-category-mobile-hint {
    display: none;
    margin: 5px 0 0;
    color: #94a3b8;
    font-size: 11px;
    text-align: center;
}

@media (max-width: 820px) {
    .mew-category-section {
        padding: 20px 16px 17px;
        border-radius: 22px;
    }

    .mew-category-heading {
        align-items: flex-start;
    }

    .mew-category-heading p {
        font-size: 13px;
    }

    .mew-category-card {
        flex-basis: 138px;
        min-height: 164px;
    }

    .mew-category-icon {
        width: 70px;
        height: 70px;
        border-radius: 22px;
        font-size: 32px;
    }
}

@media (max-width: 560px) {
    .mew-category-section {
        margin-inline: -2px;
        padding-inline: 14px;
    }

    .mew-category-heading {
        margin-bottom: 14px;
    }

    .mew-category-heading h2 {
        font-size: 22px;
    }

    .mew-category-heading p {
        max-width: 230px;
    }

    .mew-category-all-link {
        padding: 7px 4px 7px 8px;
        font-size: 12px;
    }

    .mew-category-scroller {
        gap: 10px;
        margin-inline: -2px;
        padding-bottom: 8px;
        scrollbar-width: none;
        scroll-snap-type: x mandatory;
    }

    .mew-category-scroller::-webkit-scrollbar {
        display: none;
    }

    .mew-category-card {
        flex-basis: 126px;
        min-height: 154px;
        padding: 14px 10px 12px;
        border-radius: 18px;
    }

    .mew-category-icon {
        width: 64px;
        height: 64px;
        margin-bottom: 10px;
        border-radius: 20px;
        font-size: 29px;
    }

    .mew-category-card strong {
        font-size: 12px;
    }

    .mew-category-card > span:last-child {
        font-size: 10px;
    }

    .mew-category-mobile-hint {
        display: block;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mew-category-card,
    .mew-category-icon,
    .mew-category-all-link {
        transition: none;
    }
}