/* =========================================================
   SICFM — STICKY ICONIC FOOTER MENU
   Strictly isolated namespace. Zero asset bleed guarantee.
   ========================================================= */

/* --- Shell & Container --- */
.sicfm-dock-shell {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    pointer-events: none;
}

.sicfm-dock-shell .sicfm-dock-container {
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
    min-height: 64px;
    max-height: 72px;
    padding: 6px 14px calc(6px + env(safe-area-inset-bottom));
    box-sizing: border-box;
    border-radius: 30px 30px 0 0;
    box-shadow:
        0 -4px 24px rgba(0, 0, 0, 0.08),
        0 -1px 4px rgba(0, 0, 0, 0.04);
    pointer-events: auto;
    overflow: hidden;
}

/* --- 1/N Spatial Logic --- */
.sicfm-dock-shell .sicfm-dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 2px;
    margin: 0;
    border: none;
    background: transparent;
    text-decoration: none;
    cursor: pointer;
    border-radius: 16px;
    transition: background-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", sans-serif;
}

.sicfm-dock-shell .sicfm-dock-item:focus-visible {
    box-shadow: inset 0 0 0 2px var(--sicfm-active-color, #2563eb);
}

.sicfm-dock-shell .sicfm-dock-item:active {
    transform: scale(0.96);
}



/* --- Current Page Indicator --- */
.sicfm-dock-shell .sicfm-dock-item.current-menu-item {
    font-weight: 600;
}

.sicfm-dock-shell .sicfm-dock-item.current-menu-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 3px;
    border-radius: 0 0 3px 3px;
}

/* --- Icons --- */
.sicfm-dock-shell .sicfm-dock-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-bottom: 3px;
    flex-shrink: 0;
}

.sicfm-dock-shell .sicfm-dock-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
    display: block;
}

/* --- Labels --- */
.sicfm-dock-shell .sicfm-dock-label {
    font-size: 10px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.3px;
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    padding: 0 2px;
}

/* --- Ripple --- */
.sicfm-dock-shell .sicfm-dock-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    pointer-events: none;
    transform: scale(0);
    animation: sicfm-ripple-anim 0.5s ease-out forwards;
    width: 40px;
    height: 40px;
    margin-left: -20px;
    margin-top: -20px;
}

@keyframes sicfm-ripple-anim {
    to {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* --- Grid Overlay --- */
.sicfm-grid-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: flex-end;
    justify-content: center;
}

.sicfm-grid-overlay.active {
    display: flex;
}

.sicfm-grid-panel {
    width: 100%;
    max-height: 85vh;
    border-radius: 24px 24px 0 0;
    padding: 24px;
    box-sizing: border-box;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sicfm-grid-overlay.active .sicfm-grid-panel {
    transform: translateY(0);
}

.sicfm-grid-close {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    opacity: 0.6;
    cursor: pointer;
    margin-bottom: 16px;
}

/* --- Grid Panel: WordPress Menu List --- */
.sicfm-grid-title {
    margin: 0 0 16px;
    padding: 0 2px;
    font-size: 12px;
    font-weight: 600;
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sicfm-grid-screens {
    position: relative;
}

.sicfm-grid-screen {
    display: none;
}

.sicfm-grid-screen.sicfm-screen-active {
    display: block;
    animation: sicfm-screen-in 0.22s ease;
}

@keyframes sicfm-screen-in {
    from { opacity: 0; transform: translateX(10px); }
    to   { opacity: 1; transform: translateX(0); }
}

.sicfm-grid-back {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 16px;
    padding: 7px 14px 7px 10px;
    background: transparent;
    border: none;
    border-radius: 999px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-size: 13px;
    font-weight: 600;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    font-family: inherit;
}

.sicfm-grid-back svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.sicfm-grid-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.sicfm-grid-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.04);
    background: color-mix(in srgb, var(--sicfm-icon-color, #333) 5%, var(--sicfm-bg-color, #fff));
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 6px rgba(0, 0, 0, 0.05);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.01em;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    font-family: inherit;
    transition: box-shadow 0.15s ease, transform 0.12s ease, opacity 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}

.sicfm-grid-btn:active {
    transform: scale(0.97);
    opacity: 0.75;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.sicfm-grid-btn-caret {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    opacity: 0.4;
}

html.dark-mode-active .sicfm-grid-btn {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 6px rgba(0, 0, 0, 0.22);
}

html.dark-mode-active .sicfm-grid-btn:active {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

html.dark-mode-active .sicfm-grid-back {
    background: rgba(255, 255, 255, 0.1);
}

html.dark-mode-active .sicfm-grid-list-item {
    border-bottom-color: rgba(255, 255, 255, 0.12);
}

/* --- Smart Invert Dark Mode --- */
html {
    transition: filter 0.25s ease;
    color-scheme: light;
}

html.dark-mode-active {
    filter: invert(1) hue-rotate(180deg);
    color-scheme: dark;
}

/* Fidelity shielding: double-invert exclusions to restore original color */
html.dark-mode-active img,
html.dark-mode-active video,
html.dark-mode-active iframe,
html.dark-mode-active embed,
html.dark-mode-active object,
html.dark-mode-active picture,
html.dark-mode-active .dark-mode-exclude,
html.dark-mode-active [data-dark-exclude="true"] {
    filter: invert(1) hue-rotate(180deg) !important;
}

/* Additional exclusions for better inversion fidelity */
html.dark-mode-active code,
html.dark-mode-active pre,
html.dark-mode-active kbd,
html.dark-mode-active samp,
html.dark-mode-active canvas,
html.dark-mode-active .mejs-container,
html.dark-mode-active .wp-block-embed__wrapper iframe {
    filter: invert(1) hue-rotate(180deg) !important;
}

/* --- Responsive: 600px --- */
@media screen and (max-width: 600px) {
    .sicfm-dock-shell .sicfm-dock-container {
        min-height: 60px;
        max-height: 68px;
        padding: 5px 10px calc(5px + env(safe-area-inset-bottom));
    }
    .sicfm-dock-shell .sicfm-dock-icon {
        width: 22px;
        height: 22px;
    }
    .sicfm-dock-shell .sicfm-dock-label {
        font-size: 9px;
        letter-spacing: 0.2px;
    }
    .sicfm-dock-shell .sicfm-dock-item {
        padding: 5px 1px;
        border-radius: 14px;
    }
}

/* --- Responsive: 400px --- */
@media screen and (max-width: 400px) {
    .sicfm-dock-shell .sicfm-dock-container {
        min-height: 56px;
        max-height: 64px;
        padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    }
    .sicfm-dock-shell .sicfm-dock-icon {
        width: 20px;
        height: 20px;
    }
    .sicfm-dock-shell .sicfm-dock-label {
        font-size: 8px;
    }
    .sicfm-dock-shell .sicfm-dock-item {
        padding: 4px 1px;
        border-radius: 12px;
    }
}

/* --- Responsive: 320px (minimal) --- */
@media screen and (max-width: 320px) {
    .sicfm-dock-shell .sicfm-dock-label {
        font-size: 7.5px;
        letter-spacing: 0;
    }
    .sicfm-dock-shell .sicfm-dock-icon {
        width: 18px;
        height: 18px;
    }
    .sicfm-dock-shell .sicfm-dock-container {
        padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    }
}

/* --- Accessibility: Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .sicfm-dock-shell .sicfm-dock-item,
    .sicfm-dock-shell .sicfm-dock-ripple,
    .sicfm-grid-panel,
    html,
    html.dark-mode-active .sicfm-dock-shell,
    html.dark-mode-active .sicfm-grid-overlay {
        transition: none;
        animation: none;
    }
}

/* --- Body padding utility (prevents content occlusion) --- */
body.has-sicfm-dock {
    padding-bottom: 80px;
}
@media screen and (max-width: 600px) {
    body.has-sicfm-dock {
        padding-bottom: 72px;
    }
}
@media screen and (max-width: 400px) {
    body.has-sicfm-dock {
        padding-bottom: 68px;
    }
}

/* --- Device Visibility Control --- */
body.has-sicfm-dock.sicfm-mobile-only,
body.has-sicfm-dock.sicfm-mobile-tablet {
    padding-bottom: 0;
}

body.sicfm-mobile-only .sicfm-dock-shell,
body.sicfm-mobile-tablet .sicfm-dock-shell {
    display: none;
}

/* Mobile breakpoint (0–767px): show for mobile-only & mobile+tablet */
@media (max-width: 767px) {
    body.sicfm-mobile-only .sicfm-dock-shell,
    body.sicfm-mobile-tablet .sicfm-dock-shell {
        display: block;
    }
    body.has-sicfm-dock.sicfm-mobile-only,
    body.has-sicfm-dock.sicfm-mobile-tablet {
        padding-bottom: 80px;
    }
}
@media screen and (max-width: 600px) {
    body.has-sicfm-dock.sicfm-mobile-only,
    body.has-sicfm-dock.sicfm-mobile-tablet {
        padding-bottom: 72px;
    }
}
@media screen and (max-width: 400px) {
    body.has-sicfm-dock.sicfm-mobile-only,
    body.has-sicfm-dock.sicfm-mobile-tablet {
        padding-bottom: 68px;
    }
}

/* Tablet breakpoint (768px–1024px): show only for mobile+tablet */
@media (min-width: 768px) and (max-width: 1024px) {
    body.sicfm-mobile-tablet .sicfm-dock-shell {
        display: block;
    }
    body.has-sicfm-dock.sicfm-mobile-tablet {
        padding-bottom: 80px;
    }
}

/* =========================================================
   ADMIN STYLES (isolated under .sicfm-admin)
   ========================================================= */
.sicfm-admin .description {
    font-size: 13px;
    color: #555;
    margin-bottom: 16px;
    max-width: 780px;
}
.sicfm-admin #sicfm-items th,
.sicfm-admin #sicfm-items td {
    vertical-align: middle;
    padding: 10px 8px;
}
.sicfm-admin #sicfm-items input.regular-text,
.sicfm-admin #sicfm-items select {
    width: 100%;
    max-width: 260px;
}
.sicfm-admin .sicfm-remove-item {
    color: #d63638;
    border-color: #d63638;
}
.sicfm-admin .sicfm-remove-item:hover {
    background: #d63638;
    color: #fff;
}
.sicfm-admin .wp-picker-container {
    display: inline-block;
    vertical-align: top;
}
.sicfm-admin .wp-picker-holder {
    position: absolute;
    z-index: 10;
}