/**
 * Mobile Community Menu Styles
 * Fixed bottom bar + slide-up navigation panel for screens below 1200px (xl)
 * All classes prefixed with cardel-cm- to avoid conflicts
 */

/* ============================================
   BODY MODIFICATIONS
   ============================================ */

/* Prevent background scroll when menu panel is open */
body.cardel-cm-open {
    overflow: hidden;
}

/* Bottom padding to prevent content occlusion by fixed bar */
body.cardel-cm-body-padded {
    padding-bottom: 44px;
}

/* Hide the existing floating connect button when mobile bar is present */
@media (max-width: 1199.98px) {
    .chhp-comm-tab {
        display: none !important;
    }

    /* Align connect popup to right half of bottom bar */
    .chhp-popup {
        right: 0 !important;
        left: auto !important;
        width: 50% !important;
        min-width: 0 !important;
        border-radius: 5px 5px 0 0;
    }

    .chhp-popup.chhp-show {
        bottom: 44px !important;
    }
}

/* ============================================
   BOTTOM BAR
   ============================================ */

.cardel-cm-menu-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1045;
    display: flex;
}

.cardel-cm-bar-content {
    display: flex;
    width: 100%;
}

.cardel-cm-btn-container {
    flex: 1;
    display: flex;
}

/* ============================================
   HAMBURGER TOGGLE BUTTON
   ============================================ */

.cardel-cm-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background-color: #fff;
    border: none;
    color: #333;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    padding: 12px 0;
    transition: background-color 0.2s ease;
}

.cardel-cm-toggle-btn:hover,
.cardel-cm-toggle-btn:focus-visible {
    background-color: #f5f5f5;
}

.cardel-cm-toggle-btn:focus-visible {
    outline: 2px solid #333;
    outline-offset: -2px;
}

/* ============================================
   HAMBURGER ICON (ANIMATED)
   ============================================ */

.cardel-cm-hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 20px;
    height: 16px;
    position: relative;
}

.cardel-cm-hamburger-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #333;
    position: absolute;
    left: 0;
    transition: transform 0.3s ease, opacity 0.3s ease, top 0.3s ease;
}

.cardel-cm-hamburger-icon span:nth-child(1) {
    top: 0;
}

.cardel-cm-hamburger-icon span:nth-child(2) {
    top: 7px;
}

.cardel-cm-hamburger-icon span:nth-child(3) {
    top: 14px;
}

/* Hamburger to X animation */
.cardel-cm-toggle-btn[aria-expanded="true"] .cardel-cm-hamburger-icon span:nth-child(1) {
    top: 7px;
    transform: rotate(45deg);
}

.cardel-cm-toggle-btn[aria-expanded="true"] .cardel-cm-hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.cardel-cm-toggle-btn[aria-expanded="true"] .cardel-cm-hamburger-icon span:nth-child(3) {
    top: 7px;
    transform: rotate(-45deg);
}

/* ============================================
   GET CONNECTED BUTTON
   ============================================ */

.cardel-cm-connect-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background-color: #af272f;
    border: none;
    color: #fff;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    padding: 12px 0;
    transition: background-color 0.2s ease;
}

.cardel-cm-connect-btn:hover,
.cardel-cm-connect-btn:focus-visible {
    background-color: #8e1f26;
}

.cardel-cm-connect-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -2px;
}

.cardel-cm-connect-btn svg {
    width: 17.59px;
    height: 17.59px;
    flex-shrink: 0;
}

/* ============================================
   OVERLAY
   ============================================ */

.cardel-cm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1031;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cardel-cm-overlay.cardel-cm-visible {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   SIDE PANEL (SLIDE-UP NAV)
   ============================================ */

.cardel-cm-side-panel {
    position: fixed;
    left: 0;
    bottom: -100%;
    width: 50%;
    background-color: #fff;
    z-index: 1032;
    box-shadow: 2px -2px 12px rgba(0, 0, 0, 0.2);
    transition: bottom 0.3s ease;
    will-change: transform;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 44px);
}

.cardel-cm-side-panel.cardel-cm-panel-open {
    bottom: 44px;
}

/* ============================================
   PANEL HEADER
   ============================================ */

.cardel-cm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background-color: #333;
    color: #fff;
    flex-shrink: 0;
}

.cardel-cm-title {
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
    color: #fff;
}

.cardel-cm-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    transition: opacity 0.2s ease;
}

.cardel-cm-close:hover,
.cardel-cm-close:focus-visible {
    opacity: 0.7;
}

.cardel-cm-close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ============================================
   NAVIGATION LIST
   ============================================ */

.cardel-cm-content {
    overflow-y: auto;
    flex: 1;
}

.cardel-cm-navigation {
    list-style: none;
    margin: 0;
    padding: 0;
    display: block;
    justify-content: unset;
    gap: unset;
}

.cardel-cm-navigation li {
    border-bottom: 1px solid #e5e7eb;
}

.cardel-cm-navigation li:last-child {
    border-bottom: none;
}

.cardel-cm-navigation a {
    display: block;
    padding: 14px 20px;
    color: #333;
    text-decoration: none;
    font-family: 'Roboto', sans-serif;
    font-size: 15px;
    font-weight: 400;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.cardel-cm-navigation a:hover,
.cardel-cm-navigation a:focus-visible {
    background-color: #f5f5f5;
    color: #af272f;
}

.cardel-cm-navigation a:focus-visible {
    outline: 2px solid #af272f;
    outline-offset: -2px;
}

.cardel-cm-navigation a.cardel-cm-active {
    font-weight: 700;
    color: #af272f;
    border-left: 3px solid #af272f;
    padding-left: 17px;
}

/* ============================================
   SMALL SCREEN ADJUSTMENTS
   ============================================ */

@media (max-width: 575.98px) {
    .cardel-cm-side-panel {
        width: 50%;
    }
}

@media (max-width: 375px) {
    .cardel-cm-toggle-btn,
    .cardel-cm-connect-btn {
        font-size: 12px;
    }
}

/* ============================================
   HIDE ON XL+ (DESKTOP)
   ============================================ */

@media (min-width: 1200px) {
    .cardel-cm-menu-bar,
    .cardel-cm-overlay,
    .cardel-cm-side-panel {
        display: none !important;
    }

    body.cardel-cm-body-padded {
        padding-bottom: 0 !important;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .cardel-cm-overlay,
    .cardel-cm-side-panel,
    .cardel-cm-hamburger-icon span,
    .cardel-cm-toggle-btn,
    .cardel-cm-connect-btn,
    .cardel-cm-close,
    .cardel-cm-navigation a {
        transition: none !important;
    }
}
