/**
 * Frontend Styles
 * Mobile Sticky Menu - Native App Feel
 */

/* CSS Variables */
:root {
    --msm-primary: #5caf21;
    --msm-primary-dark: #5caf21;
    --msm-text: #111;
    --msm-text-light: #333;
    --msm-bg: #ffffff;
    --msm-border: #e5e7eb;
    --msm-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    --msm-radius: 20px;
    --msm-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Hide on desktop by default */
.msm-sticky-bar,
.msm-bottom-sheet,
.msm-backdrop {
    display: none;
}

/* Mobile styles - will be overridden by inline CSS for custom breakpoint */
@media screen and (max-width: 768px) {

    /* Backdrop Overlay */
    .msm-backdrop {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 99998;
    }

    .msm-education-content .wp-video-shortcode {
        width: 100%;
        height: 100%;
        border-radius: 10px;
    }

    .msm-education-content .wp-video {
        width: 100% !important;
    }

    .post-to-pdf-button {
        padding: 6px 18px !important;
        font-weight: normal;
        width: max-content;
    }

    .post-to-pdf-button:hover {
        background-color: #FFEBEE !important;
        text-decoration: none;
        box-shadow: none !important;
    }

    ins span.woocommerce-Price-amount.amount {
        color: #4CAF50 !important;
    }

    .msm-backdrop.active {
        opacity: 1;
        visibility: visible;
    }

    /* Sticky Bottom Bar */
    .msm-sticky-bar {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--msm-bg);
        z-index: 99997;
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        padding-bottom: var(--msm-safe-bottom);
        border-top: 1px solid #ddd;
        box-shadow: 0 -8px 11px 1px #0000000f;
        border-radius: 20px 20px 0 0;
        overflow: hidden;
    }

    span.ourOffers {
        position: absolute;
        top: -31px;
        right: 15px;
        color: #03A9F4;
        background: #E1F5FE;
        border: 1px solid #B3E5FC;
        font-size: 15px;
        padding: 1px 8px;
        border-radius: 8px 8px 8px 3px;
    }

    .msm-sticky-bar.visible {
        transform: translateY(0) !important;
        overflow: visible;
    }

    .msm-sticky-bar.visible {
        transform: translateY(0) !important;
    }

    /* Fallback: show immediately if JS fails */
    .msm-sticky-bar.msm-no-js {
        transform: translateY(0);
    }

    .msm-bar-inner {
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding: 8px 10px;
        margin: 0 auto;
    }

    button.msm-bar-item.msm-bar-item-icon-only {
        display: contents;
    }

    .msm-bar-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0;
        padding: 0;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--msm-text-light);
        transition: color 0.2s, transform 0.2s;
        -webkit-tap-highlight-color: transparent;
        margin: 0;
        width: 25%;
        flex-shrink: 0;
        line-height: normal;
        gap: 3px;
    }

    .msm-bar-item:active {
        transform: scale(0.95);
    }

    .msm-bar-item.active {
        color: var(--msm-primary);
    }

    .msm-bar-icon {
        width: 40px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .productBox_MSB {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-bottom: 20px;
        border-bottom: 2px dashed #ddd;
        padding-bottom: 20px;
    }

    .msm-bar-icon svg {
        width: 30px;
        height: 30px;
    }

    .msm-bar-label {
        font-size: 14px;
        font-weight: 500;
        text-wrap-mode: nowrap;
        position: relative;
    }

    /* Marquee animation for long titles */
    .msm-label-marquee {
        display: block;
        width: 80px;
        overflow: hidden;
    }

    span.msm-bar-label.msm-label-marquee:after {
        content: "";
        background: #ffffff;
        width: 1px;
        height: 22px;
        box-shadow: 0px 0px 9px 8px #fff;
        position: absolute;
        left: 0px;
        top: 0;
    }

    .msm-marquee-track {
        display: inline-flex;
        animation: msmMarquee 6s linear 2s infinite;
    }

    .msm-label-text {
        white-space: nowrap;
        flex-shrink: 0;
        padding-left: 10px;
    }

    @keyframes msmMarquee {
        0% {
            transform: translateX(0);
        }

        100% {
            transform: translateX(50%);
        }
    }

    /* Bottom Sheet */
    .msm-bottom-sheet {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--msm-bg);
        border-radius: var(--msm-radius) var(--msm-radius) 0 0;
        /*box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);*/
        z-index: 99999;
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        max-height: 85vh;
        overflow: hidden;
        padding-bottom: var(--msm-safe-bottom);
    }

    .msm-bottom-sheet.open {
        transform: translateY(0);
    }

    .msm-bottom-sheet.dragging {
        transition: none;
    }

    /* Sheet Handle */
    .msm-sheet-handle {
        display: flex;
        justify-content: center;
        padding: 12px;
        cursor: grab;
        touch-action: none;
    }

    .msm-sheet-handle:active {
        cursor: grabbing;
    }

    .msm-handle-bar {
        width: 40px;
        height: 4px;
        background: #d1d5db;
        border-radius: 2px;
    }

    /* Sheet Content */
    .msm-sheet-content {
        padding: 0 20px 20px;
        overflow-y: auto;
        max-height: calc(85vh - 40px);
        overscroll-behavior: contain;
    }

    /* Panels */
    .msm-panel {
        display: none;
    }

    .msm-panel.active {
        display: block;
        animation: msmFadeIn 0.3s ease;
    }

    @keyframes msmFadeIn {
        from {
            opacity: 0;
            transform: translateY(10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .msm-panel-header {
        margin-bottom: 0;
        text-align: center;
    }

    .msm-panel-header h3 {
        margin: 0;
        font-size: 18px !important;
        font-weight: 600;
        color: var(--msm-text);
    }

    .msm-panel-body {
        direction: rtl;
    }

    /* Product Card */
    .msm-product-card {
        display: grid;
        gap: 16px;
        border-radius: 12px;
        margin-bottom: 16px;
    }

    .msm-product-image {
        position: relative;
        flex-shrink: 0;
        width: 100px;
        height: 100px;
        border-radius: 15px;
        margin: 0;
        border: 1px solid #ddd;
    }

    .title_price_box {
        display: grid;
    }

    .msm-product-image img {
        width: 100%;
        height: 100%;
        border-radius: 10px;
    }

    .msm-discount-badge {
        position: absolute;
        top: 7px;
        right: -13px;
        background: #ee2719;
        color: #fff;
        font-size: 11px;
        font-weight: 700;
        padding: 2px 6px;
        border-radius: 6px;
    }

    .msm-product-info {
        flex: 1;
        min-width: 0;
    }

    .msm-product-title {
        margin: 0;
        font-size: 18px !important;
        font-weight: 600;
        color: var(--msm-text);
        line-height: 1.5;
        text-align: right;
    }

    .msm-product-desc {
        margin: 0 0 8px;
        font-size: 16px;
        color: var(--msm-text-light);
        line-height: 1.5;
        text-align: justify;
    }

    .msm-product-price {
        font-size: 18px;
        font-weight: 700;
        color: var(--msm-primary);
        text-align: center;
        display: grid;
        justify-content: flex-start;
        text-align: right;
    }

    .msm-product-price del {
        color: #9ca3af;
        font-weight: 400;
        font-size: 13px;
        margin-left: 8px;
    }

    .msm-product-price ins {
        text-decoration: none;
    }

    /* Education Content */
    .msm-education-content {
        font-size: 14px;
        line-height: 1.7;
        color: var(--msm-text);
        margin-bottom: 16px;
    }

    .msm-education-content p {
        margin: 0 0 12px;
    }

    .msm-education-content ul,
    .msm-education-content ol {
        padding-right: 20px;
        margin: 0 0 12px;
    }

    /* PDF Description */
    .msm-pdf-desc {
        font-size: 16px;
        line-height: 1.6;
        color: var(--msm-text-light);
        margin-bottom: 16px;
        text-align: center;
    }

    /* Panel Actions */
    .msm-panel-actions {
        display: flex;
        gap: 12px;
    }

    /* Buttons */
    .msm-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 9px 15px;
        font-size: 15px;
        text-decoration: none;
        border-radius: 12px;
        transition: all 0.2s;
        cursor: pointer;
        border: none;
        flex: 1;
        text-align: center;
    }

    .msm-btn-primary {
        background: #5caf21;
        color: #fff;
    }

    .msm-btn-primary:hover,
    .msm-btn-primary:active {
        background: var(--msm-primary-dark);
        color: #fff;
    }

    .msm-btn-secondary {
        background: #f3f4f6;
        color: #626262;
    }

    .msm-btn-secondary:hover,
    .msm-btn-secondary:active {
        background: #e5e7eb;
        color: var(--msm-text);
    }

.msm-btn-full {
    width: auto;
    max-width: 120px;
    margin: 0 auto;
}
    /* Hide sticky bar when sheet is open */
    .msm-sticky-bar.sheet-open {
        transform: translateY(100%);
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {

    .msm-sticky-bar,
    .msm-bottom-sheet,
    .msm-backdrop,
    .msm-panel.active {
        transition: none;
        animation: none;
    }
}


/* =========================================
   More Panel Styles
   ========================================= */

/* Icon-only bar item (no label) */
.msm-bar-item-icon-only {
    width: auto !important;
    min-width: 44px;
    padding: 8px !important;
}

.msm-bar-item-icon-only .msm-bar-icon {
    width: 28px;
    height: 28px;
}

.msm-bar-item-icon-only .msm-bar-icon svg {
    width: 28px;
    height: 28px;
}

/* More Panel User Section */
.msm-more-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 20px;
}

.msm-more-user-icon {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 10px;
    padding: 18px;
}

.msm-more-user-icon svg {
    width: 100%;
    height: 100%;
    fill: var(--msm-text-light);
}

.msm-more-user-info {
    display: flex;
    flex-direction: column;
}

.msm-more-user-mobile {
    font-size: 15px;
    font-weight: 600;
    color: var(--msm-text);
    direction: ltr;
    text-align: right;
}

.msm-more-user-membership {
    font-size: 14px;
    color: var(--msm-text-light);
}

a.profile_BTN {
    color: #03A9F4;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

a.profile_BTN svg {
    fill: #03A9F4;
    width: 22px;
}

.msm-more-user-btn {
    flex-shrink: 0;
    padding: 8px 16px !important;
    font-size: 13px !important;
}

/* More Panel Sections */
.msm-more-section {
    margin-bottom: 20px;
}

.msm-more-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--msm-text);
    margin: 0 0 12px;
    padding-bottom: 8px;
    /*border-bottom: 1px solid var(--msm-border);*/
}

/* Related Posts */
.msm-more-posts {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.msm-more-post-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s;
}

.msm-more-post-item:active {
    background: #e9ecef;
}

.msm-more-post-thumb {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #e9ecef;
}

.msm-more-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msm-more-post-title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--msm-text);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Categories Horizontal Scroll */
.msm-more-categories {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 4px 0;
}

.msm-more-categories::-webkit-scrollbar {
    display: none;
}

.msm-more-cat-item {
    flex-shrink: 0;
    width: calc(40% - 1px);
    min-width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    text-decoration: none;
    scroll-snap-align: start;
    transition: transform 0.2s, box-shadow 0.2s;
}

.msm-more-cat-item:active {
    transform: scale(0.98);
}

.msm-more-cat-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--msm-text);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.msm-more-cat-count {
    font-size: 11px;
    color: var(--msm-text-light);
}