/* ==========================================================================
   SIDEBAR STYLES
   APM IT Manager Dashboard
   White nav rail with a per-section icon tint and a blue active state,
   matching the light "clean SaaS" theme defined in dashboard.css.
   ========================================================================== */

.sidebar {
    width: var(--sidebar-width);
    background: var(--color-panel);
    color: var(--color-text-main);
    border-right: 1px solid var(--color-border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 30;
    transition: width 0.25s ease;
    overflow-x: hidden;
}

.app-shell.sidebar-collapsed .sidebar {
    width: var(--sidebar-width-collapsed);
}

/* Dark panel behind the logo — the logo art itself is light gray/white text
   with a transparent background (designed to sit on a dark surface), so it's
   nearly invisible directly on the sidebar's white background. Giving it its
   own dark header strip restores contrast without altering the logo file. */
.sidebar-brand {
    min-height: var(--topbar-height);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    gap: 4px;
    background: #0b1220;
}

.sidebar-logo-img {
    max-width: 130px;
    width: 100%;
    height: auto;
    object-fit: contain;
    transition: max-width 0.25s ease;
}

.brand-tagline {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #7dd3fc;
    text-align: center;
    line-height: 1.3;
}

.app-shell.sidebar-collapsed .brand-tagline {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    overflow-y: auto;
}

.sidebar-nav ul {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid transparent;
    color: var(--color-text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-item a:hover {
    background: #f1f5f9;
    color: var(--color-text-main);
}

.nav-item.active a {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 600;
}

.nav-item.active a::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--color-primary);
    border-radius: 0 3px 3px 0;
}

/* Per-section icon tint, keyed off the nav item's data-view */
.nav-icon-box {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.nav-icon-box i {
    font-size: 0.85rem;
    color: var(--icon-c, var(--color-text-muted));
}

.nav-item.active .nav-icon-box i {
    color: var(--color-primary);
}

.nav-item[data-view="dashboard"]      { --icon-c: var(--color-success); }
.nav-item[data-view="team-overview"]  { --icon-c: var(--color-cyan); }
.nav-item[data-view="clients"]        { --icon-c: var(--color-purple); }
.nav-item[data-view="tickets"]        { --icon-c: var(--color-warning); }
.nav-item[data-view="projects"]       { --icon-c: var(--color-blue-accent); }
.nav-item[data-view="analytics"]      { --icon-c: var(--color-pink); }
.nav-item[data-view="reports"]        { --icon-c: var(--color-teal); }
.nav-item[data-view="settings"]       { --icon-c: var(--color-orange); }

/* Operations section */
.nav-item[data-view="smart-kpi"]      { --icon-c: var(--color-warning); }
.nav-item[data-view="ecsat"]          { --icon-c: var(--color-success); }
.nav-item[data-view="ai-insight"]     { --icon-c: var(--color-pink); }
.nav-item[data-view="ticket-quality"] { --icon-c: var(--color-warning); }
.nav-item[data-view="alerts"]         { --icon-c: var(--color-danger); }

/* Team section */
.nav-item[data-view="level-up"]       { --icon-c: #22d3ee; }
.nav-item[data-view="shifts"]         { --icon-c: var(--color-blue-accent); }

/* AI Agents section */
.nav-item[data-view="qa-agent"]         { --icon-c: var(--color-cyan); }
.nav-item[data-view="dispatcher"]       { --icon-c: var(--color-purple); }
.nav-item[data-view="ai-troubleshoot"]  { --icon-c: var(--color-cyan); }
.nav-item[data-view="ai-helpdesk"]      { --icon-c: var(--color-purple); }
.nav-item[data-view="ai-voice"]         { --icon-c: var(--color-success); }
.nav-item[data-view="ai-outbound"]      { --icon-c: var(--color-blue-accent); }
.nav-item[data-view="ai-onboarding"]    { --icon-c: var(--color-warning); }
.nav-item[data-view="ai-qbr"]           { --icon-c: var(--color-pink); }
.nav-item[data-view="ai-builder"]       { --icon-c: var(--color-purple); }

.sidebar-section-title {
    margin: 18px 16px 8px;
    padding-top: 14px;
    border-top: 1px solid var(--color-border);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.sidebar-nav ul:first-child .sidebar-section-title:first-child,
.sidebar-section-title:first-child {
    padding-top: 0;
    border-top: none;
}

.nav-label {
    flex: 1;
    transition: color 0.2s ease;
}

.sidebar-footer {
    padding: 16px 12px 24px;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-profile-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 8px 10px;
    border-radius: var(--radius-md);
    background: #f8fafc;
    border: 1px solid var(--color-border);
}

.sidebar-profile-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.sidebar-profile-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
    flex: 1;
}

.sidebar-profile-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-profile-role {
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

.app-shell.sidebar-collapsed .sidebar-profile-text {
    display: none;
}

/* Small red pulsing dot next to "Emergency Alerts" when there are active
   critical tickets — hidden by default via the `hidden` attribute. */
.alert-pulse-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-danger);
    margin-left: 6px;
    animation: alert-pulse 1.4s ease-in-out infinite;
}

.alert-pulse-dot[hidden] {
    display: none;
}

@keyframes alert-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.4); }
}

/* Small icon button that sits right in the profile row, next to the photo
   and name, rather than a separate full-width row above it. */
.sidebar-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: #ffffff;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sidebar-logout-btn:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: var(--color-danger);
    transform: scale(1.06);
}

.sidebar-logout-btn:active {
    transform: scale(0.96);
}

/* Collapsed state: hide text labels, center icons */
.app-shell.sidebar-collapsed .sidebar-brand {
    padding: 14px 8px;
}

.app-shell.sidebar-collapsed .sidebar-logo-img {
    max-width: 44px;
}

.app-shell.sidebar-collapsed .nav-item a .nav-label {
    display: none;
}

.app-shell.sidebar-collapsed .nav-item a {
    justify-content: center;
}

.app-shell.sidebar-collapsed .sidebar-profile-card {
    justify-content: center;
    padding: 8px;
}
