/* ================================================================
   rc-category-bar.css
   Horizontal category mega-menu bar — appears below the main nav.
   Logged-in users only. Inspired by Amazon/Flipkart layout.
   ================================================================ */

/* ── Bar wrapper ──────────────────────────────────────────────── */
.rc-cat-bar {
    background: var(--rc-navy, #0b1b3f);
    border-bottom: 1px solid rgba(255,255,255,.08);
    position: relative;
    z-index: 900;
}

.rc-cat-bar-inner {
    max-width: var(--rc-max-w);
    margin: 0 auto;
    padding: 0 var(--rc-pad);
    display: flex;
    align-items: stretch;
    gap: 0;
    overflow: visible;
}

/* Scroll wrapper — separate from the item container so
   position:absolute megas are not clipped */
.rc-cat-bar-scroll {
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

    .rc-cat-bar-scroll::-webkit-scrollbar {
        display: none;
    }

/* ── "All Categories" button (leftmost, always visible) ─────── */
.rc-cat-all-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1.1rem;
    font-size: .82rem;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    cursor: pointer;
    background: var(--rc-primary);
    border: none;
    border-right: 1px solid rgba(255,255,255,.12);
    flex-shrink: 0;
    transition: background .18s;
    text-decoration: none;
    letter-spacing: .02em;
    position: relative;
}

    .rc-cat-all-btn:hover,
    .rc-cat-all-btn.rc-cat-active {
        background: var(--rc-primary, #f47b20);
        color: #fff;
    }

    .rc-cat-all-btn .fa {
        font-size: .9rem;
    }

/* ── Individual category items ───────────────────────────────── */
.rc-cat-item {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    flex-shrink: 0;
}

.rc-cat-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem .6rem;
    font-size: .8rem;
    font-weight: 500;
    color: rgba(255,255,255,.82);
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color var(--rc-ease, .18s), border-color var(--rc-ease, .18s), background var(--rc-ease, .18s);
}

    .rc-cat-link .fa {
        font-size: .8rem;
        opacity: .7;
    }

.rc-cat-item:hover > .rc-cat-link,
.rc-cat-item.rc-cat-open > .rc-cat-link {
    color: #fff;
    border-bottom-color: var(--rc-accent, #ffb547);
    background: rgba(255,255,255,.06);
}

/* ── Mega dropdown panel ─────────────────────────────────────── */
.rc-cat-mega {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 540px;
    max-width: 700px;
    background: var(--rc-surface, #fff);
    border: 1px solid var(--rc-border, #e5e7eb);
    border-top: 3px solid var(--rc-primary, #f47b20);
    border-radius: 0 var(--rc-r-md, 8px) var(--rc-r-md, 8px) var(--rc-r-md, 8px);
    box-shadow: 0 12px 40px rgba(0,0,0,.14);
    padding: 1.25rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity .18s, visibility .18s, transform .18s;
    z-index: 9999;
}

/* First item: keep mega aligned to left edge of bar */
/*.rc-cat-item:first-of-type .rc-cat-mega {
    left: 0;
}*/

.rc-cat-item:hover > .rc-cat-mega,
.rc-cat-item.rc-cat-open > .rc-cat-mega {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

/* Prevent right-edge overflow */
.rc-cat-item:last-child .rc-cat-mega,
.rc-cat-item:nth-last-child(2) .rc-cat-mega {
    left: auto;
    right: 0;
}

/* ── Mega header ─────────────────────────────────────────────── */
.rc-cat-mega-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: .85rem;
    border-bottom: 1px solid var(--rc-border);
    margin-bottom: 1rem;
}

.rc-cat-mega-title {
    font-family: var(--rc-font-h);
    font-size: .88rem;
    font-weight: 500;
    color: var(--rc-text);
    display: flex;
    align-items: center;
    gap: .4rem;
}

    .rc-cat-mega-title .fa {
        color: var(--rc-primary, #f47b20);
    }

/* ── Sub-category grid inside mega ──────────────────────────── */
.rc-cat-sub-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .35rem .75rem;
}

.rc-cat-sub-link {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .48rem .65rem;
    font-size: .8rem;
    color: var(--rc-text, #111);
    text-decoration: none;
    border-radius: var(--rc-r-sm, 4px);
    transition: background var(--rc-ease, .18s), color var(--rc-ease, .18s);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .rc-cat-sub-link .fa {
        font-size: .72rem;
        color: var(--rc-primary, #f47b20);
        flex-shrink: 0;
        width: 14px;
    }

    .rc-cat-sub-link:hover {
        background: rgba(244,123,32,.07);
        color: var(--rc-primary, #f47b20);
    }

/* ── Mega footer: "Post Requirement" CTA ────────────────────── */
.rc-cat-mega-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: .85rem;
    margin-top: .85rem;
    border-top: 1px solid var(--rc-border, #e5e7eb);
    gap: .75rem;
    flex-wrap: wrap;
}

.rc-cat-mega-cta {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .42rem 1rem;
    font-size: .78rem;
    font-weight: 500;
    background: var(--rc-primary, #f47b20);
    color: #fff;
    border-radius: var(--rc-r-sm, 4px);
    text-decoration: none;
    transition: background var(--rc-ease, .18s), transform var(--rc-ease, .18s);
    white-space: nowrap;
}

    .rc-cat-mega-cta:hover {
        background: var(--rc-primary-dk, #d45a35);
        color: #fff;
        transform: translateY(-1px);
    }

.rc-cat-mega-count {
    font-size: .76rem;
    color: var(--rc-text-muted, #6b7280);
}

/* ── "All Categories" full-panel dropdown ────────────────────── */
.rc-cat-all-panel {
    position: absolute;
    top: 100%;
    left: 0;
    width: min(800px, 96vw);
    max-height: 72vh;
    overflow-y: auto;
    background: var(--rc-surface, #fff);
    border: 1px solid var(--rc-border, #e5e7eb);
    border-top: 3px solid var(--rc-primary, #f47b20);
    border-radius: 0 var(--rc-r-md, 8px) var(--rc-r-md, 8px) var(--rc-r-md, 8px);
    box-shadow: 0 14px 48px rgba(0,0,0,.16);
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity .2s, visibility .2s, transform .2s;
    z-index: 9999;
}

    .rc-cat-all-btn:hover + .rc-cat-all-panel,
    .rc-cat-all-btn.rc-cat-active + .rc-cat-all-panel,
    .rc-cat-all-panel:hover {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
    }

.rc-cat-all-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .85rem;
}

.rc-cat-all-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: .4rem;
    padding: .85rem .65rem;
    border-radius: var(--rc-r-md, 8px);
    border: 1px solid var(--rc-border, #e5e7eb);
    text-decoration: none;
    color: var(--rc-text, #111);
    transition: border-color var(--rc-ease, .18s), box-shadow var(--rc-ease, .18s), transform var(--rc-ease, .18s);
}

    .rc-cat-all-card:hover {
        border-color: var(--rc-primary, #f47b20);
        box-shadow: 0 0 0 3px rgba(244,123,32,.1);
        transform: translateY(-2px);
        color: var(--rc-primary, #f47b20);
    }

    .rc-cat-all-card .fa {
        font-size: 1.4rem;
        color: var(--rc-primary, #f47b20);
    }

.rc-cat-all-card-name {
    font-size: .76rem;
    font-weight: 600;
    line-height: 1.3;
}

.rc-cat-all-card-count {
    font-size: .68rem;
    color: var(--rc-text-muted, #6b7280);
}

/* ── Login-required teaser shown to guests ───────────────────── */
.rc-cat-login-bar {
    background: var(--rc-navy, #0b1b3f);
    border-bottom: 1px solid rgba(255,255,255,.08);
    padding: .55rem 0;
}

.rc-cat-login-bar-inner {
    max-width: var(--rc-max-w);
    margin: 0 auto;
    padding: 0 var(--rc-pad);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.rc-cat-login-msg {
    font-size: .8rem;
    color: rgba(255,255,255,.65);
    display: flex;
    align-items: center;
    gap: .5rem;
}

    .rc-cat-login-msg .fa {
        color: var(--rc-accent, #ffb547);
    }

.rc-cat-login-actions {
    display: flex;
    gap: .5rem;
    flex-shrink: 0;
}

.rc-cat-login-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .32rem .85rem;
    font-size: .76rem;
    font-weight: 500;
    border-radius: var(--rc-r-sm, 4px);
    text-decoration: none;
    transition: all .18s;
}

    .rc-cat-login-btn.primary {
        background: var(--rc-primary, #f47b20);
        color: #fff;
    }

        .rc-cat-login-btn.primary:hover {
            background: var(--rc-primary-dk, #d45a35);
        }

    .rc-cat-login-btn.outline {
        border: 1px solid rgba(255,255,255,.35);
        color: rgba(255,255,255,.85);
    }

        .rc-cat-login-btn.outline:hover {
            border-color: #fff;
            color: #fff;
        }

/* ── Dark mode ───────────────────────────────────────────────── */
[data-theme="dark"] .rc-cat-mega,
[data-theme="dark"] .rc-cat-all-panel {
    background: var(--rc-surface);
    border-color: var(--rc-border);
    box-shadow: 0 12px 40px rgba(0,0,0,.4);
}

[data-theme="dark"] .rc-cat-all-card {
    border-color: var(--rc-border);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
    .rc-cat-bar-inner {
        gap: 0;
    }

    .rc-cat-link {
        padding: .55rem .65rem;
        font-size: .75rem;
    }

    .rc-cat-all-btn {
        padding: .55rem .85rem;
        font-size: .75rem;
    }

    .rc-cat-mega,
    .rc-cat-all-panel {
        position: fixed;
        top: auto;
        left: 0 !important;
        right: 0;
        bottom: 0;
        max-width: 100%;
        width: 100%;
        border-radius: var(--rc-r-lg, 12px) var(--rc-r-lg, 12px) 0 0;
        border-top: 3px solid var(--rc-primary);
        max-height: 75vh;
        overflow-y: auto;
        transform: translateY(100%);
    }

    .rc-cat-item:hover > .rc-cat-mega,
    .rc-cat-item.rc-cat-open > .rc-cat-mega,
    .rc-cat-all-btn.rc-cat-active + .rc-cat-all-panel {
        transform: translateY(0);
    }

    .rc-cat-sub-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .rc-cat-all-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .rc-cat-bar-menu {
        display: none;
    }
}

@media (max-width: 480px) {
    .rc-cat-sub-grid {
        grid-template-columns: 1fr 1fr;
    }

    .rc-cat-all-grid {
        grid-template-columns: 1fr 1fr;
    }
}
