/* ============================================================================
   SIDEBAR V2 — Icon Rail + Expandable Panel (Orvimo-style)
   Warm neutral dark grey palette matching Orvimo --colors--dark-70 (#2e2e2e)
   ============================================================================ */

/* ── Icon Rail (always visible, 80px wide) ──────────────────────────────── */

.sidebar-rail {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 80px;
    background: #2e2e2e;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: none;
}

[data-theme="dark"] .sidebar-rail {
    background: #242424;
}

.rail-logo {
    width: 80px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 900;
    color: #f0f0f0;
    letter-spacing: -0.05em;
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
    user-select: none;
}

/* ── Rail nav items ───────────────────────────────────────────────────────── */

.rail-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 4px;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

.rail-nav::-webkit-scrollbar { display: none; }

.rail-item {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    border-radius: 11px;
    border: none;
    background: transparent;
    color: #9a9a9a;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
    outline: none;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    overflow: visible;
    padding: 0;
}

.rail-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #e0e0e0;
}

.rail-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.rail-item i {
    font-size: 22px;
    line-height: 1;
    display: block;
    flex-shrink: 0;
}

/* Notification dot badge */
.rail-badge-dot {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #f97316;
    border: 1.5px solid #2e2e2e;
    display: none;
}

.rail-badge-dot.visible { display: block; }

/* Tooltip — sleek dark pill appearing to the right of the icon */
.rail-item[data-tooltip]::after,
.rail-avatar-btn[data-tooltip]::after,
.rail-theme-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #1a1a1a;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 7px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    border: none;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
    z-index: 2000;
    letter-spacing: 0;
    line-height: 1;
    text-transform: none;
}

.rail-item[data-tooltip]:hover::after,
.rail-avatar-btn[data-tooltip]:hover::after,
.rail-theme-btn[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(2px);
}

/* ── Bottom rail section (settings + avatar) ─────────────────────────────── */

.rail-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0 14px;
    gap: 4px;
    width: 100%;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.rail-bottom-sep {
    width: 28px;
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 2px 0;
    border-radius: 1px;
}

.rail-avatar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #3a3a3a;
    color: #e0e0e0;
    font-size: 12px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    border: 1.5px solid rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    margin: 2px auto 0;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.rail-avatar-btn:hover {
    border-color: rgba(255,255,255,0.35);
    color: #ffffff;
    background: rgba(255,255,255,0.12);
}

/* When notification dropdown is open, show as active */
#railNotifBtn.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* ── Rail theme toggle button — identical to rail-item ───────────────────── */

.rail-theme-btn {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    border: none;
    background: transparent;
    color: #9a9a9a;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
    outline: none;
    font-size: 22px;
    -webkit-tap-highlight-color: transparent;
    overflow: visible;
    padding: 0;
}

.rail-theme-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #e0e0e0;
}

/* ── Suppress tooltip when panel is open ─────────────────────────────────── */
.sidebar-rail.panel-open .rail-item[data-tooltip]::after,
.sidebar-rail.panel-open .rail-avatar-btn[data-tooltip]::after {
    opacity: 0 !important;
    pointer-events: none;
}

/* ── Expandable Panel ─────────────────────────────────────────────────────── */

.sidebar-panel {
    position: fixed;
    top: 0;
    left: 80px;
    bottom: 0;
    width: 212px;
    background: #1f1f1f;
    z-index: 1000;
    border-right: 1px solid rgba(255,255,255,0.06);
    transform: translateX(-100%);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.panel-header {
    height: 68px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.panel-header-title {
    font-size: 11px;
    font-weight: 700;
    color: #505050;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-family: 'Inter', sans-serif;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: #3a3a3a transparent;
}

.panel-body::-webkit-scrollbar { width: 3px; }
.panel-body::-webkit-scrollbar-track { background: transparent; }
.panel-body::-webkit-scrollbar-thumb {
    background: #3a3a3a;
    border-radius: 3px;
}

/* Show only the active group */
.panel-group { display: none; }
.panel-group.active { display: block; }

.panel-section-label {
    font-size: 10px;
    font-weight: 700;
    color: #505050;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 10px 8px 4px;
    font-family: 'Inter', sans-serif;
}

.panel-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: #848484;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.12s ease, color 0.12s ease;
    margin-bottom: 1px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}

.panel-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #dedede;
    text-decoration: none;
}

.panel-link.active {
    background: rgba(255, 255, 255, 0.07);
    color: #f0f0f0;
    font-weight: 600;
}

.panel-link i {
    font-size: 15px;
    width: 15px;
    flex-shrink: 0;
    line-height: 1;
}

.panel-link-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
    color: #b0b0b0;
    padding: 2px 6px;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
}

/* ── Click-outside overlay ────────────────────────────────────────────────── */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 998;
    cursor: default;
}

.sidebar-overlay.active { display: block; }

/* ── Suppress tooltip when panel is open ────────────────────────────────── */
.sidebar-rail.panel-open .rail-item[data-tooltip]::after,
.sidebar-rail.panel-open .rail-theme-btn[data-tooltip]::after,
.sidebar-rail.panel-open .rail-avatar-btn[data-tooltip]::after {
    opacity: 0 !important;
    pointer-events: none;
}

/* ── Smooth panel link hover on touch devices ────────────────────────────── */
@media (hover: none) {
    .rail-item[data-tooltip]::after { display: none; }
}

/* ============================================================================
   Sidebar always warm neutral dark (#252525 rail, #1f1f1f panel).
   Body bg-outer (#2e2e2e) matches the rail and creates seamless layer effect.
   ============================================================================ */

/* ── Dark theme sidebar overrides ────────────────────────────────────────── */
[data-theme="dark"] .sidebar-rail {
    background: #242424;
}

[data-theme="dark"] .sidebar-panel {
    background: #242424;
    border-right-color: rgba(0,0,0,0.4);
}

[data-theme="dark"] .panel-header {
    border-bottom-color: rgba(0,0,0,0.4);
}

[data-theme="dark"] .rail-bottom {
    border-top-color: rgba(0,0,0,0.4);
}

/* Notification dot border matches new rail bg */
[data-theme="dark"] .rail-badge-dot {
    border-color: #242424;
}

/* Tooltip adapts to darker bg */
[data-theme="dark"] .rail-item[data-tooltip]::after,
[data-theme="dark"] .rail-avatar-btn[data-tooltip]::after,
[data-theme="dark"] .rail-theme-btn[data-tooltip]::after {
    background: #1a1a1a;
    box-shadow: 0 4px 18px rgba(0,0,0,0.7);
}
