/**
 * Floating Sticky Bottom Navigation Bar, Floating WhatsApp & Mobile Drawers
 * Muslim Pandai - Wpmedia Child Theme
 */

/* ===================================================
   1. DESKTOP DEFAULT: Sembunyikan total di Desktop
   =================================================== */
@media (min-width: 769px) {
    #mp-bottom-nav,
    #mp-floating-wa-btn,
    #mp-search-modal,
    #mp-topics-drawer {
        display: none !important;
    }
}

/* ===================================================
   2. KHUSUS SMARTPHONE (Layar <= 768px)
   =================================================== */
@media (max-width: 768px) {
    /* Ruang dasar agar konten situs tidak terpotong oleh floating nav */
    body {
        padding-bottom: 86px !important;
    }

    /* -----------------------------------------------
       A. Floating WhatsApp Quick Contact Button (Melayang Elegan)
       ----------------------------------------------- */
    .mp-floating-wa-btn {
        position: fixed;
        bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        right: 16px;
        z-index: 99990;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
        color: #ffffff !important;
        text-decoration: none;
        padding: 8px 14px 8px 10px;
        border-radius: 28px;
        box-shadow: 0 6px 20px rgba(37, 211, 102, 0.42), 0 2px 6px rgba(0, 0, 0, 0.12);
        border: 1.5px solid rgba(255, 255, 255, 0.5);
        font-size: 11.5px;
        font-weight: 700;
        letter-spacing: -0.1px;
        transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .mp-floating-wa-btn:active {
        transform: scale(0.92);
    }

    .mp-floating-wa-icon {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mp-floating-wa-pulse {
        position: absolute;
        inset: -4px;
        border-radius: 32px;
        border: 2px solid rgba(37, 211, 102, 0.6);
        animation: mpWaPulse 2.2s infinite cubic-bezier(0.25, 1, 0.5, 1);
        pointer-events: none;
    }

    @keyframes mpWaPulse {
        0% { transform: scale(0.95); opacity: 0.9; }
        70% { transform: scale(1.15); opacity: 0; }
        100% { transform: scale(1.15); opacity: 0; }
    }

    /* -----------------------------------------------
       B. Floating Island Bottom Navigation Bar
       (Sedikit melayang di tengah layar, tidak full)
       ----------------------------------------------- */
    .mp-bottom-nav {
        position: fixed;
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 44px);
        max-width: 350px;
        height: 58px;
        background: rgba(255, 255, 255, 0.94);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border: 1px solid rgba(8, 41, 224, 0.12);
        border-radius: 36px;
        box-shadow: 
            0 12px 32px -4px rgba(8, 41, 224, 0.22), 
            0 4px 12px rgba(0, 0, 0, 0.06);
        z-index: 99999;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 4px;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    }

    .mp-nav-container {
        display: flex;
        width: 100%;
        height: 100%;
        align-items: center;
        justify-content: space-around;
        padding: 0 2px;
    }

    .mp-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1;
        height: 100%;
        color: #64748b;
        text-decoration: none;
        background: transparent;
        border: none;
        outline: none;
        cursor: pointer;
        padding: 2px 0;
        transition: color 0.18s ease, transform 0.15s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .mp-nav-item:active {
        transform: scale(0.92);
    }

    .mp-nav-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 22px;
        height: 22px;
        margin-bottom: 2px;
    }

    .mp-nav-label {
        font-size: 10px;
        font-weight: 600;
        line-height: 1.2;
        letter-spacing: -0.1px;
    }

    /* Active State (Warna Biru Royal Eksisting Muslim Pandai) */
    .mp-nav-item.is-active,
    .mp-nav-item:focus-visible {
        color: #0829e0;
    }

    .mp-nav-item.is-active .mp-nav-icon svg {
        stroke: #0829e0;
        stroke-width: 2.3;
    }

    /* -----------------------------------------------
       C. Center Floating Action Highlight (Buku Kajian)
       ----------------------------------------------- */
    .mp-nav-action {
        position: relative;
        top: -13px;
    }

    .mp-action-circle {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: linear-gradient(135deg, #0829e0 0%, #000159 100%);
        color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 
            0 8px 20px rgba(8, 41, 224, 0.42),
            0 2px 6px rgba(0, 0, 0, 0.1);
        border: 3.5px solid #ffffff;
        transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
    }

    .mp-nav-action:active .mp-action-circle {
        transform: scale(0.92);
        box-shadow: 0 4px 10px rgba(8, 41, 224, 0.3);
    }

    .mp-nav-action .mp-nav-label {
        color: #0829e0;
        font-weight: 700;
        margin-top: 1px;
    }

    /* -----------------------------------------------
       D. Modals & Drawers
       ----------------------------------------------- */
    .mp-modal,
    .mp-drawer {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100000;
        display: none;
        align-items: flex-end;
    }

    .mp-modal.is-open,
    .mp-drawer.is-open {
        display: flex;
    }

    .mp-modal-overlay,
    .mp-drawer-overlay {
        position: absolute;
        inset: 0;
        background: rgba(15, 23, 42, 0.55);
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
    }

    .mp-modal-sheet,
    .mp-drawer-sheet {
        position: relative;
        width: 100%;
        max-height: 84vh;
        background: #ffffff;
        border-radius: 24px 24px 0 0;
        padding: 16px 20px 32px 20px;
        box-shadow: 0 -10px 32px rgba(0, 0, 0, 0.18);
        z-index: 2;
        overflow-y: auto;
        animation: mpSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @keyframes mpSlideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .mp-drawer-handle {
        width: 36px;
        height: 4px;
        background: #cbd5e1;
        border-radius: 4px;
        margin: 0 auto 12px auto;
    }

    .mp-modal-header,
    .mp-drawer-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;
    }

    .mp-modal-header h3,
    .mp-drawer-header h3 {
        margin: 0;
        font-size: 17px;
        font-weight: 700;
        color: #0f172a;
    }

    .mp-close-btn {
        background: #f1f5f9;
        border: none;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        font-size: 20px;
        line-height: 1;
        color: #475569;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.15s ease;
    }

    .mp-close-btn:active {
        background: #e2e8f0;
    }

    /* -----------------------------------------------
       E. WhatsApp Banner Card di dalam Drawer
       ----------------------------------------------- */
    .mp-drawer-wa-card {
        display: flex;
        align-items: center;
        gap: 12px;
        background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
        border: 1.5px solid #86efac;
        border-radius: 16px;
        padding: 12px 14px;
        margin-bottom: 18px;
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.12);
    }

    .mp-drawer-wa-icon {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
        color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        box-shadow: 0 3px 8px rgba(37, 211, 102, 0.35);
    }

    .mp-drawer-wa-text {
        flex: 1;
    }

    .mp-drawer-wa-text h4 {
        margin: 0 0 2px 0;
        font-size: 13.5px;
        font-weight: 700;
        color: #14532d;
    }

    .mp-drawer-wa-text p {
        margin: 0;
        font-size: 11.5px;
        color: #166534;
        line-height: 1.35;
    }

    .mp-drawer-wa-btn {
        background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
        color: #ffffff !important;
        text-decoration: none;
        padding: 8px 14px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 700;
        white-space: nowrap;
        box-shadow: 0 3px 10px rgba(37, 211, 102, 0.35);
        flex-shrink: 0;
    }

    .mp-drawer-section-title {
        font-size: 12px;
        font-weight: 700;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 10px;
    }

    /* -----------------------------------------------
       F. Search Form di Modal
       ----------------------------------------------- */
    .mp-search-input-wrap {
        display: flex;
        align-items: center;
        background: #f8fafc;
        border: 1.5px solid #0829e0;
        border-radius: 14px;
        padding: 6px 14px;
        gap: 10px;
    }

    .mp-search-input-wrap input {
        border: none;
        background: transparent;
        flex: 1;
        font-size: 14.5px;
        padding: 6px 0;
        outline: none;
        color: #0f172a;
    }

    .mp-search-input-wrap button {
        background: #0829e0;
        color: #ffffff;
        border: none;
        border-radius: 10px;
        padding: 8px 18px;
        font-weight: 700;
        font-size: 13px;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(8, 41, 224, 0.28);
    }

    .mp-quick-tags {
        margin-top: 18px;
    }

    .mp-quick-label {
        font-size: 12px;
        font-weight: 700;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        display: block;
        margin-bottom: 10px;
    }

    .mp-tags-list {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .mp-tags-list a {
        background: #eff6ff;
        color: #0829e0;
        border-radius: 20px;
        padding: 6px 14px;
        font-size: 12.5px;
        text-decoration: none;
        font-weight: 600;
        border: 1px solid rgba(8, 41, 224, 0.12);
        transition: background 0.15s ease;
    }

    .mp-tags-list a:active {
        background: #0829e0;
        color: #ffffff;
    }

    /* -----------------------------------------------
       G. Kategori Grid di Drawer
       ----------------------------------------------- */
    .mp-categories-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding-bottom: 16px;
    }

    .mp-cat-card {
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 14px;
        padding: 12px 14px;
        text-decoration: none;
        display: flex;
        flex-direction: column;
        transition: border-color 0.2s ease, background 0.2s ease;
    }

    .mp-cat-card:active {
        background: #eff6ff;
        border-color: #0829e0;
    }

    .mp-cat-name {
        font-weight: 700;
        font-size: 13.5px;
        color: #1e293b;
        margin-bottom: 3px;
    }

    .mp-cat-count {
        font-size: 11.5px;
        color: #64748b;
    }

    /* -----------------------------------------------
       H. Upgrade Native Wpmedia Social Share Icon WhatsApp
       ----------------------------------------------- */
    ul.gmr-socialicon-share li.whatsapp a {
        background: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
        border-radius: 8px !important;
        box-shadow: 0 3px 8px rgba(37, 211, 102, 0.35) !important;
        color: #ffffff !important;
        transition: transform 0.15s ease !important;
    }

    ul.gmr-socialicon-share li.whatsapp a:active {
        transform: scale(0.92) !important;
    }
}
