/* =====================================================
   MEGA MENU NAV - Top navigation with dropdown panels
   Shortcode: [pointless_pos_mega_menu]
   Class prefix: ppos-hn
   ===================================================== */

.ppos-hn {
    position: relative;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    /* Grow to fill the flex cell WordPress places us in, without claiming the full row */
    flex: 1 1 auto !important;
    min-width: 0 !important;
    /* Reset WordPress block-editor properties that leak into our nav */
    gap: 0 !important;
    padding-block: 0 !important;
    padding-inline: 0 !important;
    align-items: unset !important;
    flex-wrap: unset !important;
}

/* Nav bar */
.ppos-hn__bar {
    display: flex;
    align-items: stretch;
    padding: 0 16px;
    background: transparent;
}

/* Department buttons */
.ppos-hn__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 16px 18px;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: #222222;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
    margin-bottom: -1px;
    line-height: 1.4;
}

.ppos-hn__btn:hover {
    color: #000000;
    border-bottom-color: #222222;
    outline: none;
}

.ppos-hn__btn.is-open {
    color: #000000;
    border-bottom-color: #222222;
}

.ppos-hn__btn:focus-visible {
    outline: 3px solid #4a90d9;
    outline-offset: -3px;
}

.ppos-hn__btn-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.ppos-hn__btn-label {
    font-size: 14px;
    font-weight: 500;
}

/* Separator between departments and extra buttons */
.ppos-hn__separator {
    align-self: stretch;
    width: 1px;
    background: #e5e5e5;
    margin: 12px 8px;
    flex-shrink: 0;
}

/* Extra nav buttons (Latest, Tags, Discounts) */
.ppos-hn__btn--extra {
    padding: 16px 12px;
}

.ppos-hn__btn--extra:hover .ppos-hn__btn-icon {
    color: #000000;
}

/* Dropdown panel */
.ppos-hn__dropdown {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 999;
    background: #ffffff;
    border-top: 1px solid #e5e5e5;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    max-height: 70vh;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Two-panel body */
.ppos-hn__dropdown-body {
    display: flex;
    align-items: flex-start;
    padding: 32px 40px;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Close button (accessibility) */
.ppos-hn__close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    background: #f5f5f5;
    color: #555555;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.ppos-hn__close:hover,
.ppos-hn__close:focus {
    background: #222222;
    color: #ffffff;
    border-color: #222222;
}

.ppos-hn__close:focus:not(:focus-visible) {
    outline: none;
}

.ppos-hn__close:focus-visible {
    outline: 3px solid #4a90d9;
    outline-offset: 2px;
}

/* Filter columns (left panel) */
.ppos-hn__columns {
    display: flex;
    gap: 48px;
    flex: 1;
    min-width: 0;
}

.ppos-hn__column {
    min-width: 120px;
    flex: 1;
}

/* Double-class specificity beats most theme h3 overrides */
.ppos-hn .ppos-hn__column-heading {
    margin: 0 0 14px 0;
    padding: 0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #111111;
    background: none;
    border: none;
    box-shadow: none;
    white-space: normal;
    word-break: break-word;
}

.ppos-hn__column-list {
    display: flex;
    flex-direction: column;
}

.ppos-hn__filter-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 5px 0;
    border: none;
    background: transparent;
    color: #555555;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.12s ease;
    line-height: 1.5;
}

.ppos-hn__filter-btn:hover,
.ppos-hn__filter-btn:focus {
    color: #000000;
    background: transparent;
}

.ppos-hn__filter-btn:focus:not(:focus-visible) {
    outline: none;
}

.ppos-hn__filter-btn:focus-visible {
    outline: 2px solid #4a90d9;
    outline-offset: 2px;
}

/* Featured panel (right side) — column direction so heading stacks above grid */
.ppos-hn__featured {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
    padding-left: 48px;
    border-left: 1px solid #e5e5e5;
    margin-left: 48px;
}

.ppos-hn__card {
    display: block;
    position: relative;
    width: 160px;
    height: 200px;
    border-radius: 4px;
    overflow: hidden;
    text-decoration: none;
    flex-shrink: 0;
    background: #333333;
}

.ppos-hn__card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.ppos-hn__card:hover .ppos-hn__card-img {
    transform: scale(1.04);
}

.ppos-hn__card-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #444 0%, #888 100%);
}

.ppos-hn__card-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 32px 12px 12px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.65) 0%, transparent 100%);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
}

/* Spinner keyframes shared by bar and column loading states */
@keyframes ppos-spin {
    to { transform: rotate(360deg); }
}

/* Nav-bar loading placeholder (shown while initial data fetch is in-flight) */
.ppos-hn__bar-loading {
    display: flex;
    align-items: center;
    padding: 0 18px;
    height: 56px;
}

.ppos-hn__bar-loading::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid #e5e5e5;
    border-top-color: #444444;
    border-radius: 50%;
    animation: ppos-spin 0.75s linear infinite;
}

/* Loading / empty states */
.ppos-hn__loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    color: #aaaaaa;
    font-size: 13px;
    font-style: italic;
}

.ppos-hn__loading::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #e0e0e0;
    border-top-color: #999999;
    border-radius: 50%;
    animation: ppos-spin 0.75s linear infinite;
    flex-shrink: 0;
}

.ppos-hn__empty {
    padding: 6px 0;
    color: #cccccc;
    font-size: 13px;
}

/* Latest items as text links (when no featured panel needed) */
.ppos-hn__latest-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    color: #555555;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.12s ease;
}

.ppos-hn__latest-link:hover,
.ppos-hn__latest-link:focus {
    color: #000000;
}

.ppos-hn__latest-link:focus:not(:focus-visible) {
    outline: none;
}

.ppos-hn__latest-link:focus-visible {
    outline: 2px solid #4a90d9;
    outline-offset: 2px;
    border-radius: 2px;
}

.ppos-hn__latest-price {
    margin-left: 8px;
    font-weight: 600;
    color: #2e7d32;
    white-space: nowrap;
}

/* Screen-reader live region */
.ppos-hn__live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Tablet */
@media (max-width: 1024px) {
    .ppos-hn__dropdown-body {
        padding: 24px;
        flex-direction: column;
    }

    .ppos-hn__featured {
        padding-left: 0;
        border-left: none;
        margin-left: 0;
        border-top: 1px solid #e5e5e5;
        padding-top: 20px;
        margin-top: 20px;
        flex-wrap: wrap;
    }

    .ppos-hn__card {
        width: 140px;
        height: 160px;
    }
}

/* Mobile — two-row nav bar */
@media (max-width: 768px) {
    .ppos-hn__bar {
        padding: 0;
        flex-wrap: wrap;
        overflow-x: visible;
    }

    /* Row 1: department buttons fill the width evenly */
    .ppos-hn__btn:not(.ppos-hn__btn--extra) {
        flex: 1 1 auto;
        justify-content: center;
        padding: 10px 8px;
        font-size: 13px;
        min-width: 60px;
    }

    /* Separator becomes a full-width row break */
    .ppos-hn__separator {
        flex-basis: 100%;
        width: 100%;
        height: 1px;
        margin: 0;
        align-self: auto;
    }

    /* Row 2: extra feature buttons, left-aligned, scroll if overflow */
    .ppos-hn__btn--extra {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 12px;
    }

    .ppos-hn__btn {
        font-size: 13px;
    }

    .ppos-hn__dropdown {
        max-height: 80vh;
    }

    .ppos-hn__dropdown-body {
        padding: 16px;
        flex-direction: column;
    }

    .ppos-hn__columns {
        flex-direction: column;
        gap: 20px;
    }

    .ppos-hn__featured {
        padding-left: 0;
        border-left: none;
        margin-left: 0;
        border-top: 1px solid #e5e5e5;
        padding-top: 16px;
        margin-top: 16px;
        flex-wrap: wrap;
    }
}

/* =====================================================
   EXTRA MENU OVERLAY — compact list rows in dropdown
   ===================================================== */

.ppos-hn__extra-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Compact row */
.ppos-hn__extra-item-link {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.12s ease;
}

.ppos-hn__extra-item-link:first-child {
    border-top: 1px solid #f0f0f0;
}

.ppos-hn__extra-item-link:hover {
    background: #f9f9f9;
}

/* 48px thumb | flexible name+price row */
.ppos-hn__extra-item {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
}

/* Fixed-size square thumbnail */
.ppos-hn__extra-item-image {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 4px;
    overflow: hidden;
    background: #f0f0f0;
    flex-shrink: 0;
}

.ppos-hn__extra-item-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    max-width: 100%;
}

.ppos-hn__extra-item-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e0e0e0, #bdbdbd);
}

/* Name + price side-by-side */
.ppos-hn__extra-item-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.ppos-hn__extra-item-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    line-height: 1.3;
}

.ppos-hn__extra-item-price-row {
    display: flex;
    gap: 4px;
    align-items: baseline;
    flex-shrink: 0;
}

.ppos-hn__extra-item-price {
    font-size: 13px;
    font-weight: 700;
    color: #2e7d32;
    white-space: nowrap;
}

/* Hide secondary details — compact rows show name + price only */
.ppos-hn__extra-item-size,
.ppos-hn__extra-item-metadata,
.ppos-hn__extra-item-barcode,
.ppos-hn__extra-item-description,
.ppos-hn__extra-item-image-count {
    display: none;
}
