/* ============================================================
   RCN Header & Footer
   ============================================================ */

.rcn-skiplink {
    position: absolute;
    top: -40px;
    left: 8px;
    background: var(--rcn-brand);
    color: white;
    padding: 8px 16px;
    border-radius: var(--rcn-radius);
    z-index: 9999;
    transition: top var(--rcn-transition);
}
.rcn-skiplink:focus { top: 8px; }

[x-cloak] { display: none !important; }

/* ====== HEADER ====== */
.rcn-header {
    position: sticky;
    top: 0;
    z-index: var(--rcn-z-sticky);
    background: var(--rcn-dark);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 4px 12px rgba(0, 0, 0, 0.18);
}

.rcn-header__bar {
    border-bottom: 1px solid var(--rcn-border-dark);
}
.rcn-header__inner {
    display: flex;
    align-items: center;
    gap: var(--rcn-space-4);
    height: var(--rcn-header-h);
}

/* Logo */
.rcn-header__logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}
.rcn-header__logo img { height: 40px; width: auto; }
.rcn-header__logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}
.rcn-header__logo-mark {
    background: var(--rcn-brand);
    color: white;
    padding: 4px 8px;
    border-radius: var(--rcn-radius-sm);
    font-weight: 900;
    font-size: 16px;
    letter-spacing: 0.5px;
}
.rcn-header__logo-name {
    color: white;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 3px;
    font-weight: 600;
    opacity: 0.7;
}

/* Primary nav (desktop) */
.rcn-header__nav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: var(--rcn-space-8);
    flex: 1;
}
.rcn-header__link,
.rcn-header__link-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    color: rgba(255, 255, 255, 0.78);
    font-size: var(--rcn-text-sm);
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--rcn-radius);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--rcn-transition);
    font-family: inherit;
    line-height: 1;
}
.rcn-header__link:hover,
.rcn-header__link-toggle:hover {
    color: white;
    background: rgba(255, 255, 255, 0.06);
}

/* Categories dropdown panel */
.rcn-header__dropdown {
    position: relative;
}
.rcn-header__menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--rcn-surface);
    border-radius: var(--rcn-radius-lg);
    box-shadow: var(--rcn-shadow-lg);
    padding: var(--rcn-space-3);
    min-width: 560px;
    z-index: var(--rcn-z-dropdown);
}
.rcn-header__menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}
.rcn-header__menu-item {
    display: flex;
    align-items: center;
    gap: var(--rcn-space-3);
    padding: var(--rcn-space-3);
    border-radius: var(--rcn-radius);
    color: var(--rcn-text);
    text-decoration: none;
    transition: background var(--rcn-transition);
}
.rcn-header__menu-item:hover { background: var(--rcn-surface-alt); }
.rcn-header__menu-item svg { color: var(--rcn-brand); flex-shrink: 0; }
.rcn-header__menu-title {
    font-weight: 700;
    font-size: var(--rcn-text-sm);
    color: var(--rcn-text);
}
.rcn-header__menu-desc {
    font-size: var(--rcn-text-xs);
    color: var(--rcn-text-muted);
    margin-top: 2px;
}

/* Right actions */
.rcn-header__actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.rcn-header__icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--rcn-radius);
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    border: none;
    cursor: pointer;
    transition: all var(--rcn-transition);
    text-decoration: none;
}
.rcn-header__icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}
.rcn-header__badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--rcn-brand);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--rcn-dark);
    line-height: 1;
}

/* User dropdown */
.rcn-header__user {
    position: relative;
}
.rcn-header__user-trigger {
    width: 40px;
    height: 40px;
    padding: 4px;
}
.rcn-header__user-trigger .rcn-avatar {
    border-color: rgba(255, 255, 255, 0.2);
}
.rcn-header__user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--rcn-surface);
    border-radius: var(--rcn-radius-lg);
    box-shadow: var(--rcn-shadow-lg);
    padding: var(--rcn-space-2);
    min-width: 260px;
    z-index: var(--rcn-z-dropdown);
}
.rcn-header__user-info {
    padding: var(--rcn-space-3);
    border-bottom: 1px solid var(--rcn-border);
    margin-bottom: var(--rcn-space-2);
}
.rcn-header__user-name {
    font-weight: 700;
    font-size: var(--rcn-text-sm);
    color: var(--rcn-text);
}
.rcn-header__user-email {
    font-size: var(--rcn-text-xs);
    color: var(--rcn-text-muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rcn-header__user-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px var(--rcn-space-3);
    border-radius: var(--rcn-radius-sm);
    color: var(--rcn-text);
    font-size: var(--rcn-text-sm);
    font-weight: 500;
    text-decoration: none;
    transition: background var(--rcn-transition);
}
.rcn-header__user-link:hover {
    background: var(--rcn-surface-alt);
    color: var(--rcn-brand);
}
.rcn-header__user-link svg { color: var(--rcn-text-muted); flex-shrink: 0; }
.rcn-header__user-link:hover svg { color: var(--rcn-brand); }
.rcn-header__user-link-danger { color: var(--rcn-danger); }
.rcn-header__user-link-danger:hover { background: var(--rcn-danger-bg); color: var(--rcn-danger); }
.rcn-header__user-link-danger svg { color: var(--rcn-danger); }

/* Sell button */
.rcn-header__sell-btn {
    margin-left: 6px;
}

/* ====== Mobile slide-out menu ====== */
.rcn-header__mobile {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: var(--rcn-z-overlay);
    backdrop-filter: blur(2px);
}
.rcn-header__mobile-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 90vw;
    height: 100%;
    background: var(--rcn-surface);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: rcnSlideIn 240ms cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes rcnSlideIn {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}
.rcn-header__mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--rcn-space-4) var(--rcn-space-5);
    border-bottom: 1px solid var(--rcn-border);
}
.rcn-header__mobile-head .rcn-header__icon-btn {
    color: var(--rcn-text);
}
.rcn-header__mobile-head .rcn-header__icon-btn:hover {
    background: var(--rcn-surface-alt);
}
.rcn-header__mobile-nav {
    padding: var(--rcn-space-3);
    overflow-y: auto;
    flex: 1;
}
.rcn-header__mobile-link {
    display: flex;
    align-items: center;
    gap: var(--rcn-space-3);
    padding: 12px var(--rcn-space-3);
    color: var(--rcn-text);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--rcn-text-base);
    border-radius: var(--rcn-radius-sm);
    transition: background var(--rcn-transition);
}
.rcn-header__mobile-link:hover {
    background: var(--rcn-surface-alt);
    color: var(--rcn-brand);
}
.rcn-header__mobile-link svg { color: var(--rcn-brand); flex-shrink: 0; }

/* ====== Main wrapper ====== */
.rcn-main { min-height: calc(100vh - var(--rcn-header-h) - 200px); }

/* ====== Mobile responsive ====== */
@media (max-width: 991px) {
    .rcn-header__inner { gap: var(--rcn-space-2); }
    .rcn-header__logo-name { display: none; }
    .rcn-header__sell-btn span { display: none; }
    .rcn-header__sell-btn { padding: 0; width: 40px; height: 40px; }
}

/* Hide old Motors header on RCN pages */
.rcn-theme #top-bar,
.rcn-theme > #header,
.rcn-theme #wrapper > #header { display: none !important; }
