/* C.C. Mega Menu — FAB + panel (sin dependencias del plugin de flota). */

.cc-mm-layer {
    --cc-primary: #1d4ed8;
    --cc-primary-light: #3b82f6;
    --cc-radius-button: 999px;
    --cc-radius-card: 12px;
    --cc-radius-mega-menu: 20px;
    --cc-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --cc-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --cc-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.18);
    --cc-glass: rgba(255, 255, 255, 0.98);
    --cc-glass-border: rgba(226, 232, 240, 0.95);
    --cc-glass-soft: #f8fafc;
    --cc-card-header-bg: linear-gradient(135deg, var(--cc-primary), var(--cc-primary-light));
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    pointer-events: none;
    isolation: isolate;
}

.cc-mm-layer > .cc-mm-fab {
    pointer-events: auto;
    z-index: 5;
}

.cc-mm-layer > .cc-mm-backdrop {
    z-index: 1;
}

.cc-mm-layer > .cc-mm-panel {
    pointer-events: auto;
    z-index: 4;
}

body.admin-bar .cc-mm-fab.cc-mm-pos-top-right,
body.admin-bar .cc-mm-fab.cc-mm-pos-top-left {
    top: 52px !important;
}

@media screen and (max-width: 782px) {
    body.admin-bar .cc-mm-fab.cc-mm-pos-top-right,
    body.admin-bar .cc-mm-fab.cc-mm-pos-top-left {
        top: 68px !important;
    }
}

.cc-mm-fab {
    position: fixed;
    z-index: 99991;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px 0 14px;
    height: 50px;
    background: var(--cc-primary, #1d4ed8);
    color: #fff;
    border: none;
    border-radius: 100px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(29, 78, 216, 0.4), 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.22s ease,
        background 0.18s ease;
    outline: none;
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    pointer-events: all;
}

.cc-mm-fab:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

.cc-mm-fab:hover {
    transform: scale(1.04) translateY(-2px);
    box-shadow: 0 8px 28px rgba(29, 78, 216, 0.5), 0 2px 6px rgba(0, 0, 0, 0.15);
}

.cc-mm-fab:active {
    transform: scale(0.98);
}

.cc-mm-fab-active {
    background: #1e293b !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}

.cc-mm-layer .cc-mm-fab.cc-mm-fab-active {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: none !important;
    box-shadow: none !important;
}

.cc-mm-icon-menu,
.cc-mm-icon-close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    pointer-events: none;
}

.cc-mm-fab-txt {
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.025em;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.cc-mm-fab-pulse {
    position: absolute;
    inset: -5px;
    border-radius: 100px;
    border: 2.5px solid var(--cc-primary, #1d4ed8);
    opacity: 0;
    pointer-events: none;
    animation: cc-mm-pulse-anim 2.5s ease-out 1s infinite;
}

@keyframes cc-mm-pulse-anim {
    0% {
        opacity: 0.7;
        transform: scale(1);
    }
    80% {
        opacity: 0;
        transform: scale(1.28);
    }
    100% {
        opacity: 0;
        transform: scale(1.28);
    }
}

.cc-mm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99992;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
}

.cc-mm-backdrop-on {
    opacity: 1;
    pointer-events: all;
}

.cc-mm-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 99993;
    width: min(340px, 88vw);
    background: #fff;
    display: flex;
    flex-direction: column;
    min-height: 0;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.04);
    pointer-events: none;
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.cc-mm-from-right {
    right: 0;
    left: auto;
    transform: translateX(105%);
    border-radius: 20px 0 0 20px;
}

.cc-mm-from-left {
    left: 0;
    right: auto;
    transform: translateX(-105%);
    border-radius: 0 20px 20px 0;
}

.cc-mm-open {
    transform: translateX(0) !important;
    pointer-events: all;
}

.cc-mm-panel-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 14px;
    background: linear-gradient(
        135deg,
        var(--cc-primary, #1d4ed8) 0%,
        var(--cc-primary-light, #3b82f6) 100%
    );
    flex-shrink: 0;
}

.cc-mm-panel-ttl {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0.01em;
}

.cc-mm-panel-x {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
    padding: 0;
}

.cc-mm-panel-x:hover {
    background: rgba(255, 255, 255, 0.38);
    transform: scale(1.1) rotate(90deg);
}

.cc-mm-panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 18px;
    background: #f8fafc;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.cc-mm-panel-body::-webkit-scrollbar {
    width: 4px;
}

.cc-mm-panel-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.cc-mm-grid {
    display: grid;
    grid-template-columns: repeat(var(--mm-cols, 3), 1fr);
    gap: 10px;
    width: 100%;
}

.cc-mm-cell {
    display: flex;
    min-height: 90px;
}

.cc-mm-btn {
    --btn-color: #1d4ed8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 90px;
    gap: 7px;
    padding: 14px 8px 12px;
    border-radius: 12px;
    text-decoration: none !important;
    color: #fff !important;
    box-sizing: border-box;
    cursor: pointer;
    transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.18s ease,
        filter 0.18s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.cc-mm-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(150deg, rgba(255, 255, 255, 0.18) 0%, transparent 55%);
    pointer-events: none;
    z-index: 0;
}

.cc-mm-style-card .cc-mm-btn {
    background: var(--btn-color);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.16);
}

.cc-mm-style-pill .cc-mm-btn {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    padding: 12px 14px;
    border-radius: 100px;
    gap: 10px;
    background: var(--btn-color);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.14);
    min-height: 52px;
}

.cc-mm-style-pill .cc-mm-btn-txt {
    align-items: flex-start;
}

.cc-mm-style-flat .cc-mm-btn {
    background: transparent;
    border: 2px solid var(--btn-color);
    color: var(--btn-color) !important;
    box-shadow: none;
}

.cc-mm-style-flat .cc-mm-btn:hover {
    background: var(--btn-color);
    color: #fff !important;
}

.cc-mm-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
    filter: brightness(1.08);
    color: #fff !important;
    text-decoration: none !important;
}

.cc-mm-btn:active {
    transform: scale(0.97);
    filter: brightness(0.96);
}

.cc-mm-btn-icon {
    position: relative;
    z-index: 1;
    font-size: 1.9rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    pointer-events: none;
    transition: transform 0.18s ease;
}

.cc-mm-btn:hover .cc-mm-btn-icon {
    transform: scale(1.12);
}

.cc-mm-btn-txt {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    pointer-events: none;
}

.cc-mm-style-pill .cc-mm-btn-txt {
    align-items: flex-start;
}

.cc-mm-btn-name {
    font-weight: 700;
    font-size: 0.8rem;
    line-height: 1.25;
    letter-spacing: 0.01em;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.cc-mm-btn-desc {
    font-size: 0.68rem;
    opacity: 0.85;
    line-height: 1.3;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.cc-mm-size-sm .cc-mm-btn {
    min-height: 72px;
    padding: 10px 6px 8px;
    border-radius: 10px;
}

.cc-mm-size-sm .cc-mm-btn-icon {
    font-size: 1.5rem;
}

.cc-mm-size-sm .cc-mm-btn-name {
    font-size: 0.72rem;
}

.cc-mm-size-lg .cc-mm-btn {
    min-height: 110px;
    padding: 20px 10px 16px;
    border-radius: 16px;
}

.cc-mm-size-lg .cc-mm-btn-icon {
    font-size: 2.5rem;
}

.cc-mm-size-lg .cc-mm-btn-name {
    font-size: 0.9rem;
}

.cc-mm-panel-ft {
    padding: 14px 18px 16px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 0.72rem;
    color: #94a3b8;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.cc-mm-panel-ft-logo {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 4px 4px;
}

.cc-mm-panel-ft-logo img.cc-mm-footer-logo-img {
    max-width: min(100%, 340px);
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
}

.cc-mm-panel-ft-meta {
    font-size: 0.72rem;
    color: #94a3b8;
    line-height: 1.35;
}

@media screen and (max-width: 600px) {
    .cc-mm-fab-txt {
        display: none;
    }
    .cc-mm-fab {
        width: 48px;
        height: 48px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }

    .cc-mm-panel {
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: 80vh;
        min-height: 0;
        border-radius: 20px 20px 0 0 !important;
        transform: translateY(105%) !important;
        transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .cc-mm-open {
        transform: translateY(0) !important;
    }

    .cc-mm-panel::before {
        content: "";
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.5);
        border-radius: 2px;
        margin: 10px auto 0;
    }

    .cc-mm-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 9px;
    }

    .cc-mm-btn {
        min-height: 80px;
        border-radius: 11px;
    }

    .cc-mm-btn-icon {
        font-size: 1.7rem;
    }

    .cc-mm-btn-name {
        font-size: 0.75rem;
    }
}

@media screen and (max-width: 360px) {
    .cc-mm-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Tokens visuales locales (sustituyen CC_MF_Style_Settings). */
.cc-mm-layer .cc-mm-fab {
    border-radius: var(--cc-radius-button, 999px);
    background: var(--cc-primary);
    box-shadow: var(--cc-shadow-md);
}

.cc-mm-layer .cc-mm-panel {
    border-radius: var(--cc-radius-mega-menu, 20px) 0 0 var(--cc-radius-mega-menu, 20px);
    background: var(--cc-glass, rgba(255, 255, 255, 0.98));
    border: 1px solid var(--cc-glass-border, rgba(226, 232, 240, 0.95));
    box-shadow: var(--cc-shadow-lg);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
}

.cc-mm-layer .cc-mm-panel.cc-mm-from-left {
    border-radius: 0 var(--cc-radius-mega-menu, 20px) var(--cc-radius-mega-menu, 20px) 0;
}

.cc-mm-layer .cc-mm-panel-hd {
    background: var(--cc-card-header-bg, linear-gradient(135deg, var(--cc-primary), var(--cc-primary-light)));
}

.cc-mm-layer .cc-mm-panel-body,
.cc-mm-layer .cc-mm-panel-ft {
    background: var(--cc-glass-soft, #f8fafc);
}

.cc-mm-layer .cc-mm-btn {
    border-radius: var(--cc-radius-card, 12px);
    box-shadow: var(--cc-shadow-sm);
}

.cc-mm-btn-icon img {
    filter: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .cc-mm-layer,
    .cc-mm-layer * {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }
}

@media print {
    .cc-mm-layer .cc-mm-fab,
    .cc-mm-layer .cc-mm-panel,
    .cc-mm-layer .cc-mm-panel-body,
    .cc-mm-layer .cc-mm-panel-ft {
        box-shadow: none !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        background: #fff !important;
    }
}
