/* ==========================================================================
   Mega-menu — Parceiros
   --------------------------------------------------------------------------
   Full-width drop-down anchored to the "Parceiros" trigger inside the main
   navigation. Pure CSS hover behaviour on desktop; mobile is hidden because
   the existing mobile menu already lists partners separately.
   ========================================================================== */

/* The wrapper around <nav> needs to be position:relative so the panel can
   hang off it with `top: 100%`. Already true in markup but enforced here. */
.main-navigation-wrap-desktop {
    position: relative;
    z-index: 50;
}

/* Trigger styling — small green pill badge next to the count, like the "2"
   in the screenshot for Garage Sales. Inherits all main_menu_item styling
   from style.css. */
.main_menu_item--has-mega .mega-menu-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 4px;
    background: #1a8d3a;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    line-height: 1;
    vertical-align: middle;
}

/* The panel itself — hidden by default, slid down on hover. */
.mega-menu-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
    border-top: 1px solid #eef0f3;
    z-index: 100;

    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 180ms ease-out, transform 180ms ease-out, visibility 0s linear 180ms;
}

/* Open state — toggled by a tiny JS at the bottom of nav.blade.php.
   The class lives on the wrapper so we can show the panel without depending
   on sibling-selector relationships (the trigger is inside <nav> while the
   panel is its sibling). */
.main-navigation-wrap-desktop.mega-open .mega-menu-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    transition-delay: 0s;
}

/* Trigger gets a subtle "pressed" feel while the mega is open. */
.main-navigation-wrap-desktop.mega-open .main_menu_item--has-mega > a {
    color: #1a8d3a;
}

.mega-menu-panel-inner {
    padding: 28px 16px 24px;
}

.mega-menu-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: #9099a6;
    margin-bottom: 18px;
}

/* 6-column grid that gracefully drops to fewer cols on smaller widths. */
.mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-bottom: 18px;
}

@media (max-width: 1280px) {
    .mega-menu-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 992px) {
    .mega-menu-grid { grid-template-columns: repeat(3, 1fr); }
}

.mega-menu-card {
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #eef0f3;
    text-decoration: none;
    color: inherit;
    transition: transform 160ms ease-out, box-shadow 160ms ease-out, border-color 160ms ease-out;
}

.mega-menu-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
    border-color: #d6dde4;
    text-decoration: none;
    color: inherit;
}

.mega-menu-card-media {
    position: relative;
    width: 100%;
    /* 16:11 — slightly taller than the screenshot for breathing room */
    aspect-ratio: 16 / 11;
    background: #f5f6f8;
    overflow: hidden;
}

/* Fallback for browsers that don't support aspect-ratio (rare in 2026). */
@supports not (aspect-ratio: 1 / 1) {
    .mega-menu-card-media {
        height: 0;
        padding-bottom: 68.75%; /* 11/16 */
    }
    .mega-menu-card-media > img {
        position: absolute;
        inset: 0;
    }
}

.mega-menu-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 220ms ease-out;
}

.mega-menu-card:hover .mega-menu-card-media img {
    transform: scale(1.04);
}

.mega-menu-card-body {
    padding: 12px 14px 14px;
}

.mega-menu-card-name {
    font-size: 14px;
    font-weight: 600;
    color: #1c2530;
    line-height: 1.3;
    margin-bottom: 2px;
    /* Truncate to two lines max */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mega-menu-card-city {
    font-size: 13px;
    color: #74808d;
    line-height: 1.3;
}

.mega-menu-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #1c2530;
    text-decoration: none;
    padding: 6px 0;
    border-bottom: 1px solid transparent;
    transition: border-color 140ms ease-out, color 140ms ease-out;
}

.mega-menu-footer-link:hover {
    color: #1a8d3a;
    border-bottom-color: #1a8d3a;
    text-decoration: none;
}

.mega-menu-arrow {
    display: inline-block;
    transition: transform 140ms ease-out;
}

.mega-menu-footer-link:hover .mega-menu-arrow {
    transform: translateX(3px);
}

/* On mobile/tablet, the existing mobile menu lists partners — don't render
   this panel there to avoid overlap with the burger menu. */
@media (max-width: 768px) {
    .mega-menu-panel {
        display: none !important;
    }
}
