@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-glass: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-blue-light: rgba(59, 130, 246, 0.2);
    
    --risk-low: #eab308; /* Yellow */
    --risk-medium: #f97316; /* Orange */
    --risk-high: #ef4444; /* Red */
    --risk-very-high: #dc2626; /* Darker Red */
    
    --sidebar-width: 280px;
    --header-height: 70px;
    
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: var(--text-primary);
    transition: color var(--transition-fast);
}

ul {
    list-style: none;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
}

/* Typography */
h1, h2, h3, h4, h5 {
    color: var(--text-primary);
    font-weight: 600;
}

.text-muted {
    color: var(--text-secondary);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-light);
}

/* Login Layout */
.login-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
    position: relative;
    overflow: hidden;
}

.login-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
}

.login-blob-1 {
    width: 400px;
    height: 400px;
    background: rgba(59, 130, 246, 0.15);
    top: -100px;
    right: -100px;
}

.login-blob-2 {
    width: 500px;
    height: 500px;
    background: rgba(239, 68, 68, 0.1);
    bottom: -150px;
    left: -150px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 3rem;
    z-index: 1;
    position: relative;
    text-align: center;
}

.login-logo {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    font-size: 0.95rem;
}

/* App Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-medium);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
}

.menu-group {
    margin-bottom: 1.5rem;
}

.menu-group-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
    font-weight: 600;
}

.menu-item {
    margin-bottom: 0.25rem;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.menu-link i {
    width: 24px;
    font-size: 1.1rem;
    margin-right: 0.5rem;
}

.menu-link:hover, .menu-link.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.menu-link.active {
    background: var(--accent-blue-light);
    color: var(--accent-blue);
}

.submenu {
    padding-left: 2.5rem;
    margin-top: 0.25rem;
    display: none;
}

.menu-item.open .submenu {
    display: block;
}

.submenu-link {
    display: block;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.submenu-link:hover, .submenu-link.active {
    color: var(--text-primary);
}

.user-profile {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.user-info .name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-info .role {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: var(--header-height);
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--risk-high);
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Page Content */
.content-wrapper {
    padding: 2rem;
    flex: 1;
}

/* Dashboard Cards */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.stat-icon.red { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.stat-icon.yellow { background: rgba(234, 179, 8, 0.2); color: #facc15; }
.stat-icon.green { background: rgba(34, 197, 94, 0.2); color: #4ade80; }

.stat-info .value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-info .label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Dashboard Charts & Tables Area */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.panel {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.chart-container {
    height: 300px;
    width: 100%;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.risk-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
}

.risk-low { background: rgba(234, 179, 8, 0.2); color: #facc15; border: 1px solid rgba(234, 179, 8, 0.3); }
.risk-medium { background: rgba(249, 115, 22, 0.2); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.3); }
.risk-high { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.risk-very-high { background: rgba(220, 38, 38, 0.2); color: #f87171; border: 1px solid rgba(220, 38, 38, 0.3); }

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
}
.status-active { background: rgba(34, 197, 94, 0.2); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }
.status-inactive { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }
.status-draft { background: rgba(234, 179, 8, 0.2); color: #facc15; border: 1px solid rgba(234, 179, 8, 0.3); }


/* Tree View */
.tree-view {
    padding: 1rem 0;
}
.tree-node {
    margin-bottom: 0.5rem;
}
.tree-node-header {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--transition-fast);
}
.tree-node-header:hover {
    background: rgba(255, 255, 255, 0.05);
}
.tree-node-header i {
    width: 24px;
    color: var(--text-secondary);
}
.tree-children {
    padding-left: 24px;
    border-left: 1px dashed var(--border-color);
    margin-left: 12px;
    margin-top: 0.5rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-medium);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    width: 100%;
    max-width: 500px;
    transform: translateY(20px);
    transition: transform var(--transition-medium);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Responsiveness */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-toggle {
        display: block;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
}

/* 5x5 Risk Heatmap Matrix Styles */
.matrix-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.matrix-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.matrix-cell {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: transform var(--transition-fast), border var(--transition-fast), box-shadow var(--transition-fast);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.matrix-cell:hover {
    transform: scale(1.05);
    z-index: 10;
}

.matrix-cell.risk-low {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}
.matrix-cell.risk-medium {
    background: rgba(249, 115, 22, 0.18);
    color: #f97316;
}
.matrix-cell.risk-high {
    background: rgba(239, 68, 68, 0.22);
    color: #ef4444;
}
.matrix-cell.risk-very-high {
    background: rgba(220, 38, 38, 0.26);
    color: #f87171;
}

.cell-score {
    font-size: 1.1rem;
    font-weight: 700;
    opacity: 0.35;
}

.cell-badge {
    background: #ffffff;
    color: #0f172a;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 99px;
    position: absolute;
    top: 6px;
    right: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.matrix-cell.selected-filter {
    border: 2px solid #ffffff !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
    transform: scale(1.05);
    z-index: 10;
}

.matrix-labels-x {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    width: 100%;
    max-width: 420px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-weight: 600;
}

/* Executive Print View Override */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    
    .sidebar, .topbar, .btn, .icon-btn, .filter-group, .modal-overlay, .topbar-actions {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    .content-wrapper {
        padding: 0 !important;
    }
    
    .glass-panel {
        background: transparent !important;
        border: 1px solid #e2e8f0 !important;
        color: #000000 !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
    }
    
    .table th {
        color: #475569 !important;
        border-bottom: 2px solid #cbd5e1 !important;
    }
    
    .table td {
        border-bottom: 1px solid #e2e8f0 !important;
        color: #0f172a !important;
    }
    
    .risk-badge, .status-badge {
        border: 1px solid #94a3b8 !important;
        color: #0f172a !important;
        background: transparent !important;
    }
}

