/* KPI Dashboard — Base: Variables, Reset, Sidebar, Header, Notifications, Section Scaffolding */

/* ================================================================
   CREA Cortex KPI Dashboard â€” Stylesheet
   Deep-Space Glassmorphic Neural | Space Grotesk
   ================================================================ */

:root {
    --bg-primary: #080A11;
    --bg-secondary: #0D111A;
    --bg-card: rgba(20, 24, 40, 0.4);
    --bg-card-hover: rgba(28, 34, 55, 0.5);
    --bg-glass: rgba(20, 24, 40, 0.4);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.25);
    --teal: #14b8a6;
    --teal-dim: #0d9488;
    --teal-glow: rgba(20, 184, 166, 0.15);
    --cyan: #00E5FF;
    --green: #10b981;
    --green-glow: rgba(16, 185, 129, 0.15);
    --blue: #3b82f6;
    --blue-glow: rgba(59, 130, 246, 0.15);
    --purple: #a78bfa;
    --purple-glow: rgba(167, 139, 250, 0.15);
    --amber: #f59e0b;
    --amber-glow: rgba(245, 158, 11, 0.15);
    --red: #ef4444;
    --red-glow: rgba(239, 68, 68, 0.15);
    --text: #FFFFFF;
    --text-primary: #F8F9FA;
    --text-muted: #94A3B8;
    --text-dim: #8B95A5;
    --color-text-muted: #a1adc0;
    --sidebar-width: 240px;
    --header-height: 72px;
    --glass-blur: blur(16px);
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-shadow: inset 1px 1px 0px rgba(255, 255, 255, 0.05), 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --color-neon-positive: #00FFCC;
    --color-neon-alert: #FF4D4D;
    --color-text-muted: #8B95A5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Space Grotesk', 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Neural background canvas â€” reduced to 18% opacity texture */
#neuralBg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    opacity: 0.18;
}

/* No gradient overlays â€” clean deep space */
body::before {
    display: none;
}

.hidden {
    display: none !important;
}

/* ================================================================
   SIDEBAR â€” True Glassmorphism
   ================================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: rgba(20, 24, 40, 0.4);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.3s cubic-bezier(.4, 0, .2, 1), transform 0.3s cubic-bezier(.4, 0, .2, 1);
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.03), 4px 0 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* Collapsed sidebar — icon-only mode */
.sidebar.collapsed {
    width: 64px;
}

.sidebar.collapsed .sidebar-logo {
    padding: 10px 8px 14px;
}

.sidebar.collapsed .brain-canvas {
    width: 42px;
    height: 42px;
}

.sidebar.collapsed .cortex-wordmark {
    display: none;
}

.sidebar.collapsed .nav-item span {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar.collapsed .nav-item {
    padding: 12px 0;
    justify-content: center;
    border-left: none;
}

.sidebar.collapsed .nav-item:hover {
    padding-left: 0;
}

.sidebar.collapsed .nav-item.active {
    padding-left: 0;
    border-left: none;
    background: rgba(0, 229, 255, 0.15);
    border-radius: 8px;
    margin: 0 6px;
    box-shadow: none;
}

.sidebar.collapsed .sidebar-user {
    padding: 12px 8px;
    justify-content: center;
}

.sidebar.collapsed .user-info {
    display: none;
}

.sidebar.collapsed .sidebar-nav {
    padding: 12px 6px;
}

.sidebar-logo {
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: radial-gradient(circle at 50% 45%, rgba(0, 229, 255, 0.08) 0%, rgba(0, 229, 255, 0.03) 40%, transparent 70%);
}

.sidebar-brain-wrap {
    position: relative;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(.34, 1.56, .64, 1);
}

.sidebar-brain-wrap:hover {
    transform: scale(1.12);
}

.sidebar-brain-svg {
    filter: drop-shadow(0 0 16px rgba(20, 184, 166, 0.4)) drop-shadow(0 0 32px rgba(139, 92, 246, 0.2));
    transition: filter 0.3s ease;
}

.sidebar-brain-wrap:hover .sidebar-brain-svg {
    filter: drop-shadow(0 0 20px rgba(20, 184, 166, 0.6)) drop-shadow(0 0 40px rgba(139, 92, 246, 0.35));
}

.cortex-wordmark {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: rgba(0, 229, 255, 0.9);
    letter-spacing: 8px;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.25);
    padding-left: 8px;
}

.cortex-tagline {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.6rem;
    font-weight: 500;
    color: rgba(148, 163, 184, 0.7);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    white-space: nowrap;
    font-style: italic;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px 14px 20px;
    border-radius: 0;
    color: #8B95A5;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    border-left: 2px solid transparent;
}

.nav-item:hover {
    padding-left: 24px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
    border-left: 2px solid rgba(255, 255, 255, 0.3);
    color: #FFFFFF;
}

.nav-item:hover svg {
    color: #FFFFFF;
    stroke: #FFFFFF;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.4));
}

.nav-item.active {
    padding-left: 24px;
    background: linear-gradient(90deg, rgba(0, 229, 255, 0.15) 0%, transparent 100%);
    border-left: 3px solid #00E5FF;
    color: #00E5FF;
    font-weight: 600;
    box-shadow: inset 4px 0 12px -4px rgba(0, 229, 255, 0.4), 0 0 15px rgba(0, 255, 200, 0.08);
}

.nav-item.active svg {
    stroke: #00E5FF;
    filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.8));
}

/* Sidebar nav group labels */
.nav-group-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #4A5568;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 12px 20px 4px;
    margin-top: 4px;
}

.nav-group-label:first-child {
    margin-top: 0;
    padding-top: 4px;
}

/* Open Issues heartbeat pulse */
@keyframes issuePulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.55;
    }
}

.kpi-grid>.kpi-card:nth-child(6) .kpi-icon {
    animation: issuePulse 2.5s ease-in-out infinite;
}

/* Glassmorphic profile module */
.sidebar-user {
    background: rgba(13, 17, 26, 0.4);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.sidebar-user:hover {
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(0, 229, 255, 0.4);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.15) 0%, rgba(0, 102, 255, 0.15) 100%);
    border: 1px solid rgba(0, 229, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #00E5FF;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.1);
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #E2E8F0;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.user-role {
    font-size: 13px;
    color: #8B95A5;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ================================================================
   MAIN CONTENT
   ================================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding-bottom: 40px;
    overflow-x: hidden;
    transition: margin-left 0.3s cubic-bezier(.4, 0, .2, 1);
}

.sidebar.collapsed~.main-content {
    margin-left: 64px;
}

.top-header {
    position: sticky;
    top: 0;
    min-height: var(--header-height);
    background: rgba(20, 24, 40, 0.4);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 10px 12px 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 50;
    gap: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 4px 30px rgba(0, 0, 0, 0.3);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.menu-toggle:hover {
    border-color: var(--teal);
    color: var(--teal);
    background: rgba(20, 184, 166, 0.08);
}

.page-subtitle {
    font-size: 14px;
    color: var(--text);
    margin-top: 2px;
    white-space: nowrap;
    font-weight: 600;
}

.page-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 38px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text), var(--teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 1;
    min-width: 0;
}

.date-range {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.btn-notification {
    position: relative;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 10px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-notification:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: notifPulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(220, 38, 38, 0.5);
}

@keyframes notifPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 6px rgba(220, 38, 38, 0.4);
    }

    50% {
        transform: scale(1.2);
        box-shadow: 0 0 18px rgba(220, 38, 38, 0.7), 0 0 40px rgba(220, 38, 38, 0.3);
    }
}

/* ================================================================
   NOTIFICATION DROPDOWN â€” Glassmorphic Alert Panel
   ================================================================ */
.notif-wrapper {
    position: relative;
}

.notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    max-height: 420px;
    background: rgba(13, 17, 26, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 200;
    overflow: hidden;
    animation: dropdownSlide 0.2s ease;
}

.notif-dropdown.show {
    display: block;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 700;
    color: #F8F9FA;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    letter-spacing: 0.3px;
}

.notif-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--teal);
    background: rgba(20, 184, 166, 0.12);
    padding: 2px 8px;
    border-radius: 99px;
    margin-left: 8px;
}

.notif-clear-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.notif-clear-btn:hover {
    color: var(--red);
    background: rgba(239, 68, 68, 0.1);
}

#notifList {
    max-height: 300px;
    overflow-y: auto;
}

#notifList::-webkit-scrollbar {
    width: 4px;
}

#notifList::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: background 0.2s;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.notif-item strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #E2E8F0;
    margin-bottom: 3px;
    line-height: 1.3;
}

.notif-meta {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Alert levels â€” left accent border */
.notif-item.notif-critical {
    border-left: 3px solid var(--red);
    background: rgba(239, 68, 68, 0.06);
}

.notif-item.notif-warning {
    border-left: 3px solid var(--amber);
    background: rgba(245, 158, 11, 0.04);
}

.notif-item.notif-info {
    border-left: 3px solid var(--blue);
    background: rgba(59, 130, 246, 0.04);
}

.notif-dismiss {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
    flex-shrink: 0;
    transition: all 0.2s;
    line-height: 1;
}

.notif-dismiss:hover {
    color: var(--red);
    background: rgba(239, 68, 68, 0.12);
}

.notif-empty {
    padding: 24px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.notif-footer {
    padding: 10px 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--teal);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: background 0.2s;
}

.notif-footer:hover {
    background: rgba(20, 184, 166, 0.08);
}

/* Premium frosted-glass export controls */
.btn-export {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(13, 17, 26, 0.5);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #8B95A5;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-export:hover {
    transform: translateY(-1px);
    color: #00E5FF;
    border-color: rgba(0, 229, 255, 0.3);
    background: rgba(0, 229, 255, 0.06);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.15), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-actions-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 10px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-actions-menu:hover {
    border-color: var(--teal);
    color: var(--teal);
    background: rgba(20, 184, 166, 0.08);
}

.actions-dropdown {
    min-width: 240px;
}

/* ================================================================
   DASHBOARD SECTIONS
   ================================================================ */
.dashboard-section {
    padding: 0 32px;
    margin-top: 14px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.8, 0.25, 1),
        transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.dashboard-section.revealed {
    opacity: 1;
    transform: translateY(0);
}

.dashboard-section:first-of-type {
    margin-top: 2px;
}

.section-banner {
    text-align: center;
    padding: 4px 32px 0;
}

.banner-subtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 700;
    background: linear-gradient(90deg, rgba(20, 184, 166, 0.5), var(--teal), rgba(103, 232, 249, 0.9), var(--teal), rgba(20, 184, 166, 0.5));
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 5px;
    text-transform: uppercase;
    position: relative;
    animation: bannerShimmer 4s ease infinite;
    filter: drop-shadow(0 0 12px rgba(0, 229, 255, 0.3));
}

@keyframes bannerShimmer {

    0%,
    100% {
        background-position: 0% 50%;
        filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.2));
    }

    50% {
        background-position: 100% 50%;
        filter: drop-shadow(0 0 20px rgba(0, 229, 255, 0.5));
    }
}

.banner-subtitle::after {
    content: '';
    display: block;
    width: 60%;
    height: 2px;
    margin: 10px auto 0;
    background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.5), rgba(20, 184, 166, 0.8), rgba(0, 229, 255, 0.5), transparent);
    border-radius: 2px;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
}

.dashboard-section:nth-child(2) {
    animation-delay: 0.05s;
}

.dashboard-section:nth-child(3) {
    animation-delay: 0.1s;
}

.dashboard-section:nth-child(4) {
    animation-delay: 0.15s;
}

.dashboard-section:nth-child(5) {
    animation-delay: 0.2s;
}

.dashboard-section:nth-child(6) {
    animation-delay: 0.25s;
}

.dashboard-section:nth-child(7) {
    animation-delay: 0.3s;
}

.dashboard-section:nth-child(8) {
    animation-delay: 0.35s;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 4px;
}

.section-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--teal), rgba(20, 184, 166, 0.1), transparent);
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.section-badge {
    font-size: 14px;
    font-weight: 700;
    padding: 5px 16px;
    border-radius: 99px;
    text-shadow: 0 0 8px currentColor;
}

.section-badge.warning {
    background: var(--amber-glow);
    color: var(--amber);
}

.section-badge.success {
    background: var(--green-glow);
    color: var(--green);
}

.section-badge.info {
    background: var(--blue-glow);
    color: var(--blue);
}

.section-badge.ai-badge {
    background: linear-gradient(135deg, var(--purple-glow), var(--teal-glow));
    color: var(--purple);
    border: 1px solid rgba(167, 139, 250, 0.2);
}

.section-badge.pulse-badge {
    background: linear-gradient(135deg, var(--teal-glow), var(--green-glow));
    color: var(--teal);
    border: 1px solid rgba(20, 184, 166, 0.25);
    position: relative;
    padding-left: 22px;
}

.section-badge.pulse-badge::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--teal);
    animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {

    0%,
    100% {
        transform: translateY(-50%) scale(1);
        box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.4);
    }

    50% {
        transform: translateY(-50%) scale(1.3);
        box-shadow: 0 0 12px 4px rgba(20, 184, 166, 0.2);
    }
}


/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}