/* ============================================
   SideNav - Modern Collapsible Sidebar
   ============================================ */

html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* ============ Content Topbar (authenticated) ============ */
.content-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1020;
}

@media (max-width: 991.98px) {
    .content-topbar {
        padding-left: 64px;
    }
}

/* Mobile: center card content */
@media (max-width: 767.98px) {
    .job-list {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .job-list .job-list-details,
    .job-list .job-list-info,
    .job-list .job-list-title {
        text-align: center;
        width: 100%;
    }

    .job-list .job-list-title h5 {
        text-align: center;
    }

    .job-list .job-list-option ul {
        justify-content: center;
        flex-wrap: wrap;
    }

    .job-list .job-list-favourite-time {
        text-align: center;
        width: 100%;
        justify-content: center;
    }

    .rz-datalist-data .rz-card {
        text-align: center;
    }

    .rz-datalist-data .rz-card .d-flex {
        flex-direction: column;
        align-items: center;
    }
}

.content-topbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.content-topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.content-topbar-profile {
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    outline: none;
}

.content-topbar-caret {
    font-size: 0.65rem;
    color: #94a3b8;
    transition: transform 0.2s;
}

.content-topbar-profile:focus-within .content-topbar-caret {
    transform: rotate(180deg);
}

.content-topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}

.content-topbar-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.875rem;
}

/* Profile dropdown - hidden by default, shown on focus-within */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    padding: 8px 0;
    z-index: 1070;
    display: none;
    animation: dropdownFadeIn 0.12s ease-out;
}

.content-topbar-profile:focus-within .profile-dropdown {
    display: block;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.profile-dropdown-item {
    display: block;
    padding: 10px 16px;
    color: #475569;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s;
}

.profile-dropdown-item:hover {
    background: #f1f5f9;
    color: #1e293b;
    text-decoration: none;
}

.profile-dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 4px 0;
}

.profile-dropdown-logout {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    width: 100%;
    text-align: left;
}

.profile-dropdown-logout:hover {
    color: #dc2626;
}

/* ============ Guest Header (not authenticated) ============ */
.guest-header {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.guest-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 24px;
}

.guest-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.guest-header-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
}

.guest-header-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e293b;
}

.guest-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

:root {
    --sidenav-width: 260px;
    --sidenav-collapsed-width: 68px;
    --sidenav-bg: #ffffff;
    --sidenav-text: #475569;
    --sidenav-text-hover: #1e293b;
    --sidenav-active-bg: rgba(99, 102, 241, 0.1);
    --sidenav-active-text: #6366f1;
    --sidenav-border: #e2e8f0;
    --sidenav-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main sidebar container */
.sidenav {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidenav-width);
    height: 100vh;
    z-index: 1040;
    transition: width var(--sidenav-transition);
}

.sidenav-inner {
    display: flex;
    flex-direction: column;
    width: var(--sidenav-width);
    height: 100%;
    background: var(--sidenav-bg);
    border-right: 1px solid var(--sidenav-border);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition: width var(--sidenav-transition);
}

.sidenav.collapsed .sidenav-inner {
    width: var(--sidenav-collapsed-width);
}

.sidenav.collapsed {
    width: var(--sidenav-collapsed-width);
}

/* Overlay for mobile */
.sidenav-overlay {
    display: none;
}

/* Header: logo + actions */
.sidenav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--sidenav-border);
    min-height: 56px;
    flex-shrink: 0;
    gap: 8px;
}

.sidenav-logo {
    max-height: 40px;
    max-width: 100%;
    width: auto;
    object-fit: contain;
}

.sidenav.collapsed .sidenav-logo {
    display: none;
}

.sidenav-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
}

.sidenav-toggle {
    background: none;
    border: 1px solid var(--sidenav-border);
    color: var(--sidenav-text);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.sidenav-toggle:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.sidenav.collapsed .sidenav-toggle {
    margin: 0 auto;
}

/* Profile section */
.sidenav-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--sidenav-border);
    overflow: hidden;
    white-space: nowrap;
    flex-shrink: 0;
}

.sidenav-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #e2e8f0;
}

.sidenav-user-name {
    color: #1e293b;
    font-size: 0.875rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--sidenav-transition);
}

.sidenav.collapsed .sidenav-user-name {
    opacity: 0;
    width: 0;
}

/* Navigation */
.sidenav-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
}

.sidenav-nav::-webkit-scrollbar {
    width: 4px;
}

.sidenav-nav::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.sidenav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidenav-item {
    margin: 2px 8px;
}

.sidenav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--sidenav-text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sidenav-link i:first-child {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.sidenav-link span {
    transition: opacity var(--sidenav-transition);
}

.sidenav.collapsed .sidenav-link span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidenav-link:hover {
    background: #f1f5f9;
    color: var(--sidenav-text-hover);
    text-decoration: none;
}

.sidenav-link.active {
    background: var(--sidenav-active-bg);
    color: var(--sidenav-active-text);
}

/* Groups / Dropdown */
.sidenav-arrow {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.sidenav.collapsed .sidenav-arrow {
    display: none;
}

.sidenav-group.open > .sidenav-link .sidenav-arrow {
    transform: rotate(180deg);
}

.sidenav-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.sidenav-group.open > .sidenav-submenu {
    max-height: 500px;
}

.sidenav-submenu .sidenav-link {
    padding: 8px 12px 8px 44px;
    font-size: 0.8125rem;
}

.sidenav.collapsed .sidenav-submenu {
    display: none;
}

/* Footer */
.sidenav-footer {
    border-top: 1px solid var(--sidenav-border);
    padding: 12px 8px;
    flex-shrink: 0;
}

.sidenav-footer-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidenav-logout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--sidenav-text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sidenav-logout-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.sidenav-auth-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidenav-signout form {
    margin: 0;
}

/* Mobile toggle */
.sidenav-mobile-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1050;
    background: #ffffff;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============ Responsive ============ */

/* Desktop: sidebar always visible */
@media (min-width: 992px) {
    .sidenav-mobile-toggle {
        display: none !important;
    }

    .sidenav-overlay {
        display: none !important;
    }
}

/* Mobile: off-canvas sidebar */
@media (max-width: 991.98px) {
    .sidenav {
        width: 0;
        overflow: hidden;
    }

    .sidenav.mobile-open {
        width: var(--sidenav-width);
    }

    .sidenav.mobile-open .sidenav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }

    .sidenav.collapsed {
        width: 0;
    }

    .sidenav.collapsed.mobile-open {
        width: var(--sidenav-width);
    }

    .sidenav.collapsed.mobile-open .sidenav-inner {
        width: var(--sidenav-width);
    }

    .sidenav.collapsed.mobile-open .sidenav-brand-text,
    .sidenav.collapsed.mobile-open .sidenav-user-name,
    .sidenav.collapsed.mobile-open .sidenav-link span {
        opacity: 1;
        width: auto;
    }

    .sidenav.collapsed.mobile-open .sidenav-arrow {
        display: inline;
    }
}

/* ============ Layout push ============ */

/* Default: no offset (not authenticated, no sidebar) */
.site-wrapper {
    margin-left: 0;
    transition: margin-left var(--sidenav-transition);
    min-height: 100vh;
    overflow-x: hidden;
}

/* When sidebar is present, push content */
body:has(.sidenav) .site-wrapper {
    margin-left: var(--sidenav-width);
}

body:has(.sidenav.collapsed) .site-wrapper {
    margin-left: var(--sidenav-collapsed-width);
}

@media (max-width: 991.98px) {
    .site-wrapper {
        margin-left: 0 !important;
    }
}

/* Reduce top padding on page sections inside the sidebar layout */
.site-wrapper .space-ptb {
    padding-top: 1rem;
}

/* Ensure notification panel renders above the sidebar */
.notif-backdrop {
    z-index: 1060;
}

.notif-panel {
    z-index: 1061;
}
