/*
 * mnm-notes-chrome — visual customization for /notes-app/
 * Pairs with chrome.js (DOM rewrite + drawer toggle).
 */

/* ============================================================
 * Tabler icon baseline — works alongside FP Pro's FA4
 * ============================================================ */
.mnm-notes-chrome .ti {
    font-size: 16px;
    line-height: 1;
    vertical-align: middle;
}

/* ============================================================
 * Row context dropdown — replaces 3 separate FP Pro action cells
 * ============================================================ */

/* Hide the 3 FP Pro action cells UNCONDITIONALLY (don't wait for JS to
 * dropdownify the row — if chrome.js is cached/stale or fails for any
 * reason, the cells must still be invisible). */
.post-list-action-cell.post-list-link-cell,
.post-list-action-cell.post-list-edit-cell,
.post-list-action-cell.post-list-delete-cell,
.post-list-row-expand-icon {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
}

/* Row layout: flex + gap, push dropdown to the right edge */
.post-list-table-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    transition: background-color 0.15s ease;
}
.post-list-table-row:hover {
    background: rgba(0, 0, 0, 0.025);
}
.post-list-table-row .post-list-post-title-cell {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    font-size: 15px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dropdown wrapper injected by JS */
.mnm-row-dropdown {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}
.mnm-row-dropdown-trigger {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    color: rgba(0, 0, 0, 0.55);
    font-size: 20px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease;
    line-height: 1;
}
.mnm-row-dropdown-trigger:hover,
.mnm-row-dropdown-trigger:focus-visible {
    background: rgba(0, 0, 0, 0.06);
    color: #000;
    outline: none;
}
.mnm-row-dropdown-trigger[aria-expanded="true"] {
    background: rgba(0, 0, 0, 0.08);
    color: #000;
}

/* The dropdown menu — glassmorphism (videos-feed style) */
.mnm-row-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 200px;
    background: rgba(20, 20, 24, 0.94);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
    z-index: 1000;
    overflow: hidden;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.mnm-row-dropdown-menu[hidden] { display: none; }

.mnm-row-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    font-size: 14px;
    line-height: 1.2;
    background: transparent;
    border: none;
    border-radius: 6px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
    box-sizing: border-box;
}
.mnm-row-dropdown-item:hover,
.mnm-row-dropdown-item:focus-visible {
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
    outline: none;
}
.mnm-row-dropdown-item i {
    flex-shrink: 0;
    font-size: 18px;
    width: 20px;
    text-align: center;
}
.mnm-row-dropdown-item-destructive {
    color: #ff6464;
}
.mnm-row-dropdown-item-destructive:hover {
    background: rgba(255, 80, 80, 0.14);
    color: #ff8c8c;
}

/* ============================================================
 * Global hamburger nav drawer
 * ============================================================ */

.mnm-hamburger-btn {
    position: fixed;
    /* Default top — JS reassigns to center inside the site header on init.
     * These CSS values are sane fallbacks while JS hasn't run yet. */
    top: 14px;
    left: 14px;
    z-index: 9999;
    width: 42px;
    height: 42px;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    padding: 0;
    line-height: 1;
    transition: background-color 0.15s ease, transform 0.08s ease;
}
.mnm-hamburger-btn:hover {
    background: rgba(0, 0, 0, 0.72);
}
.mnm-hamburger-btn:active {
    transform: scale(0.94);
}
/* CSS fallback offsets so the button isn't hidden under the WP admin bar
 * before chrome.js runs. positionHamburgerInHeader() overrides these. */
body.admin-bar .mnm-hamburger-btn {
    top: 46px;
}
@media (max-width: 782px) {
    body.admin-bar .mnm-hamburger-btn {
        top: 60px;
    }
}

.mnm-side-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 9998;
}
.mnm-side-menu-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.mnm-side-menu-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(310px, 85vw);
    background: #111;
    color: rgba(255, 255, 255, 0.82);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}
.mnm-side-menu-drawer.is-open {
    transform: translateX(0);
}

.mnm-side-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}
.mnm-side-menu-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
    font-weight: 600;
}
.mnm-side-menu-brand img {
    height: 28px;
    width: auto;
    display: block;
}
.mnm-side-menu-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    font-size: 22px;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 6px;
}
.mnm-side-menu-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.mnm-side-menu-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    flex: 1;
}
.mnm-side-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 20px;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-size: 15px;
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.mnm-side-menu-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}
.mnm-side-menu-item.is-active {
    color: #ffe770;
    border-left-color: #ffe770;
    background: rgba(255, 231, 112, 0.06);
}
.mnm-side-menu-item i {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}
.mnm-side-menu-footer {
    padding: 16px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.45);
    font-size: 12px;
    text-align: center;
}

/* ============================================================
 * Hide Kadence's mobile menu toggle (3-dots button top right of header).
 * Our hamburger drawer (top-left) covers the same nav role, so this
 * button is redundant.
 * ============================================================ */
.site-header-item-navgation-popup-toggle,
[data-section="kadence_customizer_mobile_trigger"],
#mobile-toggle {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* ============================================================
 * Add-note button rebrand — preserves Kadence styling, swaps text only
 * ============================================================
 * (chrome.js handles the textContent swap; CSS just refines layout.)
 */
a.mobile-header-button[href*="/notes-app/add-note"] {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* ============================================================
 * "Editar nota" button on single-post view (injected by PHP filter)
 * ============================================================ */
.mnm-single-edit-button-wrap {
    margin: 0 0 24px 0;
    display: flex;
    justify-content: flex-end;
}
a.mnm-single-edit-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #111;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
    line-height: 1;
    transition: background-color 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
a.mnm-single-edit-button:hover,
a.mnm-single-edit-button:focus {
    background: #2b2b2b;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}
a.mnm-single-edit-button .mnm-single-edit-icon {
    font-size: 16px;
    line-height: 1;
}

/* ============================================================
 * Mobile WebView polish
 * ============================================================ */
@media (max-width: 640px) {
    .post-list-table-row {
        padding: 12px 14px;
    }
    .mnm-side-menu-item {
        padding: 14px 18px;
    }
    .mnm-hamburger-btn {
        top: 10px;
        left: 10px;
    }
}

/* ============================================================
 * Media-frame menu / router — force visible text colors
 * ------------------------------------------------------------
 * In the FP Pro Sandboxed_Rich_Text iframe context, the WP admin
 * CSS for .media-menu-item doesn't load fully, and the parent theme
 * (Kadence/UM frontend) sets generic colors that leave the tab text
 * white-on-white. We force WP's native admin colors on every tab
 * in the media frame so they're always visible.
 * ============================================================ */
.media-frame .media-router .media-menu-item,
.media-frame .media-frame-menu .media-menu-item {
    color: #1d2327 !important;
    background: transparent !important;
    text-shadow: none !important;
}
.media-frame .media-router .media-menu-item:hover,
.media-frame .media-router .media-menu-item:focus,
.media-frame .media-frame-menu .media-menu-item:hover,
.media-frame .media-frame-menu .media-menu-item:focus {
    color: #0073aa !important;
    background: transparent !important;
}
.media-frame .media-router .media-menu-item.active,
.media-frame .media-router .media-menu-item.active:hover,
.media-frame .media-frame-menu .media-menu-item.active,
.media-frame .media-frame-menu .media-menu-item.active:hover {
    color: #1d2327 !important;
}

/* Our injected upload tab inherits the above; only need cursor */
a.media-menu-item.mnm-upload-new {
    cursor: pointer;
}

/* ============================================================
 * Honour reduced-motion preferences
 * ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .mnm-side-menu-drawer,
    .mnm-side-menu-overlay,
    .mnm-row-dropdown-trigger,
    .mnm-hamburger-btn {
        transition: none !important;
    }
}
