/* =========================================
   DryHire Sidebar Navigation
   SAS-style vertical sidebar with hover expand
   Overlaps content on hover (no push)
   ========================================= */

:root {
    /* --sidebar-compact and --sidebar-expanded are in design-tokens.css */
    --sidebar-bg: #0c0a09;
    --sidebar-border: #27272a;
    --sidebar-active-bg: #4f46e5;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
    --sidebar-text: #a1a1aa;
    --sidebar-text-active: #ffffff;
    --sidebar-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   Sidebar - Desktop
   ========================================= */

.dryhire-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-compact);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    z-index: 210;
    overflow: hidden;
    transition: width var(--sidebar-transition);
    display: flex;
    flex-direction: column;
}

.dryhire-sidebar:hover {
    width: var(--sidebar-expanded);
}

/* Pinned state: sidebar stays expanded and pushes content */
.dryhire-sidebar.is-pinned {
    width: var(--sidebar-expanded);
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0 0 12px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

.sidebar-inner::-webkit-scrollbar {
    display: none;
}

/* =========================================
   Sidebar Pin (Hamburger) Button
   ========================================= */

.sidebar-pin {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 56px;
    padding: 0 18px;
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.sidebar-pin:hover {
    color: var(--sidebar-text-active);
}

.sidebar-pin svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Hide arrow on default hamburger */
.sidebar-pin .sidebar-pin-open .sidebar-pin-arrow {
    display: none;
}

/* Toggle between hamburger and open icons */
.sidebar-pin .sidebar-pin-close {
    display: none;
}

.dryhire-sidebar.is-pinned .sidebar-pin .sidebar-pin-open {
    display: none;
}

.dryhire-sidebar.is-pinned .sidebar-pin .sidebar-pin-close {
    display: block;
}

/* =========================================
   Content offset - static, no push on hover
   ========================================= */

@media (min-width: 1025px) {
    .wp-site-blocks {
        margin-left: var(--sidebar-compact);
        transition: margin-left var(--sidebar-transition);
    }

    /* Pinned: push content and topbar to expanded width */
    .dryhire-sidebar.is-pinned ~ .sidebar-overlay ~ .wp-site-blocks,
    body.sidebar-pinned .wp-site-blocks {
        margin-left: var(--sidebar-expanded);
    }

    body.sidebar-pinned .dryhire-topbar {
        left: var(--sidebar-expanded);
        transition: left var(--sidebar-transition);
    }
}

/* When pinned, show labels and sub-content */
.dryhire-sidebar.is-pinned .sidebar-menu-label,
.dryhire-sidebar.is-pinned .sidebar-datepicker-label .sidebar-menu-label {
    opacity: 1;
}

.dryhire-sidebar.is-pinned .sidebar-datepicker-content {
    display: block;
}

.dryhire-sidebar.is-pinned .sidebar-account-links {
    display: block;
}

/* =========================================
   Menu Items
   ========================================= */

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0 8px;
}

.sidebar-menu-item {
    margin-bottom: 2px;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
    gap: 14px;
}

.sidebar-menu-link:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text-active);
    text-decoration: none;
}

.sidebar-menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.sidebar-menu-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Override any inline fill on SVGs from the navigation block */
.sidebar-menu-icon .icon-container {
    color: inherit !important;
    width: 24px !important;
}

.sidebar-menu-icon .icon-container svg {
    fill: currentColor !important;
}

.sidebar-menu-label {
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    opacity: 0;
    transition: opacity 0.15s ease 0.05s;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dryhire-sidebar:hover .sidebar-menu-label {
    opacity: 1;
}

/* Active item - indigo pill */
.sidebar-menu-item.is-active .sidebar-menu-link {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-active);
}

.sidebar-menu-item.is-active .sidebar-menu-link:hover {
    background: #4338ca;
}

/* =========================================
   Divider
   ========================================= */

.sidebar-divider {
    height: 1px;
    background: var(--sidebar-border);
    margin: 8px 16px;
    flex-shrink: 0;
}

/* =========================================
   Account Section
   ========================================= */

.sidebar-account {
    padding: 0 8px;
    flex-shrink: 0;
}

/* Account header (avatar + "Min konto") */
.sidebar-account-header {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
    gap: 14px;
}

.sidebar-account-header:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text-active);
    text-decoration: none;
}

.sidebar-account-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
}

.sidebar-account-avatar img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

/* Sub-links (Mine ordrer, Adresser, Konto) */
.sidebar-account-links {
    list-style: none;
    margin: 0;
    padding: 0 0 0 6px;
    display: none;
}

.dryhire-sidebar:hover .sidebar-account-links {
    display: block;
}

.sidebar-sub-link {
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 10px 0 16px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
    gap: 12px;
    font-size: 13px;
}

.sidebar-sub-link:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text-active);
    text-decoration: none;
}

.sidebar-sub-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: inherit;
}

.sidebar-sub-icon svg {
    width: 18px;
    height: 18px;
}

/* Login button (logged out) */
.sidebar-account-login {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 10px;
    color: var(--sidebar-text);
    gap: 14px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-account-login:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text-active);
}

.sidebar-login-shortcode {
    display: flex;
    align-items: center;
}

/* Reset b2b-auth button styling inside sidebar */
.sidebar-b2b-login-btn {
    all: unset;
    color: inherit;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    cursor: pointer;
    white-space: nowrap;
}

/* Mobile: always show account sub-links when sidebar is open */
@media (max-width: 1024px) {
    .dryhire-sidebar.is-open .sidebar-account-links {
        display: block;
    }
}

/* =========================================
   Date Picker Section
   ========================================= */

.sidebar-datepicker {
    padding: 0 8px;
    flex-shrink: 0;
}

.sidebar-datepicker-label {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 10px;
    color: var(--sidebar-text);
    gap: 14px;
    white-space: nowrap;
}

.sidebar-datepicker-label svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    fill: currentColor;
}

.sidebar-datepicker-label .sidebar-menu-label {
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    opacity: 0;
    transition: opacity 0.15s ease 0.05s;
}

.dryhire-sidebar:hover .sidebar-datepicker-label .sidebar-menu-label {
    opacity: 1;
}

.sidebar-datepicker-content {
    display: none;
    padding: 4px 2px 8px;
}

.dryhire-sidebar:hover .sidebar-datepicker-content {
    display: block;
}

/* Override date picker for vertical sidebar layout */
.sidebar-datepicker-content.header-datepicker {
    border-radius: var(--radius-sm) !important;
}

.sidebar-datepicker-content .date-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    width: 100% !important;
}

.sidebar-datepicker-content .delivery-return-wrapper {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    width: 100% !important;
}

.sidebar-datepicker-content .delivery-picker,
.sidebar-datepicker-content .return-picker {
    width: 100% !important;
    flex: none !important;
}

.sidebar-datepicker-content .date-picker-button {
    width: 100% !important;
    overflow: visible;
}

.sidebar-datepicker-content .rental-picker {
    border-right: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-right: 0 !important;
    padding-bottom: 6px;
}

.sidebar-datepicker-content .delivery-picker {
    border-right: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 0 !important;
}

.sidebar-datepicker-content .return-picker {
    padding-left: 0 !important;
    padding-top: 6px;
}

/* =========================================
   Mobile Overlay Backdrop
   ========================================= */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 140;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-overlay.is-active {
    display: block;
    opacity: 1;
}

/* =========================================
   Mobile (<1024px)
   ========================================= */

@media (max-width: 1024px) {
    .dryhire-sidebar {
        width: calc(100vw - 48px);
        transform: translateX(-100%);
        transition: transform var(--sidebar-transition);
        top: 0;
    }

    .dryhire-sidebar:hover {
        width: calc(100vw - 48px);
    }

    .dryhire-sidebar.is-open {
        transform: translateX(0);
    }

    /* Always show labels on mobile since sidebar is full-width when open */
    .dryhire-sidebar .sidebar-menu-label,
    .dryhire-sidebar .sidebar-datepicker-label .sidebar-menu-label {
        opacity: 1;
    }

    /* Always show date picker on mobile when sidebar is open */
    .dryhire-sidebar.is-open .sidebar-datepicker-content {
        display: block;
    }

    .wp-site-blocks {
        margin-left: 0 !important;
    }
}

/* =========================================
   Top Bar - Hamburger visibility
   ========================================= */

#sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #fff;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
    line-height: 0;
}

#sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

#sidebar-toggle svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

@media (max-width: 1024px) {
    #sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* =========================================
   Admin Bar Offset
   ========================================= */

.admin-bar .dryhire-topbar {
    top: 32px;
}

.admin-bar .dryhire-sidebar {
    top: 32px;
}

.admin-bar .wp-site-blocks {
    padding-top: calc(56px + 32px);
}

@media (max-width: 782px) {
    .admin-bar .dryhire-topbar {
        top: 46px;
    }

    .admin-bar .dryhire-sidebar {
        top: 46px;
    }

    .admin-bar .wp-site-blocks {
        padding-top: calc(56px + 46px);
    }
}

/* =========================================
   Print: hide sidebar
   ========================================= */

@media print {
    .dryhire-sidebar,
    .sidebar-overlay,
    .dryhire-topbar {
        display: none !important;
    }

    .wp-site-blocks {
        margin-left: 0 !important;
        padding-top: 0 !important;
    }
}

/* =========================================
   Fix modals moved from sidebar to body
   ========================================= */

#date-selector-modal .date-selector-modal-overlay {
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

body > #b2b-auth-modal {
    z-index: 99999;
}
