/* NovaDash Admin Panel Glassmorphism Stylesheet */
:root {
    /* Default Dark Theme Variables */
    --bg-base: 240 10% 3.9%;
    --bg-sidebar: 240 10% 6%;
    --bg-card: 240 10% 7% / 0.65;
    --border: 240 3.7% 15.9% / 0.7;
    --border-hover: 240 3.7% 25% / 0.8;
    --text-main: 0 0% 98%;
    --text-muted: 240 5% 64.9%;
    
    --accent: 262.1 83.3% 57.8%; /* Purple */
    --accent-glow: 263 90% 60%;
    
    --blue: 217.2 91.2% 59.8%;
    --purple: 270.7 91% 65.1%;
    --green: 142.1 76.2% 36.3%;
    --danger: 346.8 77.2% 49.8%;
    
    --font-sans: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Light Theme Variables */
body.light-theme {
    --bg-base: 240 20% 97%;
    --bg-sidebar: 0 0% 100%;
    --bg-card: 0 0% 100% / 0.7;
    --border: 240 5.9% 90% / 0.8;
    --border-hover: 240 5.9% 80% / 0.9;
    --text-main: 240 10% 3.9%;
    --text-muted: 240 3.8% 46.1%;
    
    --accent: 262.1 83.3% 57.8%;
    
    --blue: 221.2 83.2% 53.3%;
    --purple: 271.5 81.3% 55.9%;
    --green: 142.1 76.2% 36.3%;
    --danger: 346.8 77.2% 49.8%;
}

/* Reset & Global */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: hsl(var(--bg-base));
    color: hsl(var(--text-main));
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Spotlight Glowing Nodes */
.dash-glow {
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    filter: blur(150px);
    opacity: 0.08;
    pointer-events: none;
    z-index: -1;
}

.spotlight-1 {
    background: radial-gradient(circle, hsl(var(--accent)) 0%, transparent 70%);
    top: -100px;
    left: -100px;
}

.spotlight-2 {
    background: radial-gradient(circle, hsl(var(--blue)) 0%, transparent 70%);
    bottom: -100px;
    right: -100px;
}

/* Dashboard Layout Grid */
.dashboard-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    background-color: hsl(var(--bg-sidebar));
    border-right: 1px solid hsl(var(--border));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-brand {
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-icon {
    color: hsl(var(--accent));
    width: 24px;
    height: 24px;
}

.accent-color {
    color: hsl(var(--accent));
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-radius: 8px;
    color: hsl(var(--text-muted));
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.menu-item i {
    width: 20px;
    height: 20px;
}

.menu-item:hover, .menu-item.active {
    color: hsl(var(--text-main));
    background-color: hsla(240, 5%, 15%, 0.15);
}

body.dark-theme .menu-item:hover, body.dark-theme .menu-item.active {
    background-color: hsla(0, 0%, 100%, 0.05);
}

.menu-item.active {
    border: 1px solid hsl(var(--border));
    background-color: hsla(var(--accent), 0.1) !important;
    color: hsl(var(--text-main));
}

.menu-item.active i {
    color: hsl(var(--accent));
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid hsl(var(--border));
}

.profile-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(var(--accent)), hsl(var(--blue)));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-size: 0.85rem;
    font-weight: 600;
}

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

/* Main Dashboard Panel */
.main-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
}

/* Top Navigation Bar */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid hsl(var(--border));
    padding-bottom: 1.5rem;
}

.dash-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: hsl(var(--text-main));
    cursor: pointer;
    margin-right: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.breadcrumbs .crumb.parent {
    color: hsl(var(--text-muted));
}

.breadcrumbs .crumb-separator {
    color: hsl(var(--text-muted));
}

.breadcrumbs .crumb.active {
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Theme Switcher Toggle buttons */
.theme-switcher-wrapper {
    background-color: hsla(240, 5%, 15%, 0.1);
    border: 1px solid hsl(var(--border));
    border-radius: 20px;
    padding: 3px;
    display: flex;
}

body.dark-theme .theme-switcher-wrapper {
    background-color: hsla(0, 0%, 100%, 0.03);
}

.theme-btn {
    background: none;
    border: none;
    color: hsl(var(--text-muted));
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.theme-btn i {
    width: 16px;
    height: 16px;
}

.theme-btn:hover, .theme-btn.active {
    color: hsl(var(--text-main));
}

.theme-btn.active {
    background-color: hsl(var(--accent));
    color: white;
}

.user-avatar-indicator {
    position: relative;
    cursor: pointer;
}

.avatar-letter {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: hsla(var(--accent), 0.15);
    border: 1px solid hsl(var(--border));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.pulse-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: hsl(var(--green));
    border: 2px solid hsl(var(--bg-base));
}

/* Glassmorphism Cards */
.glass-card {
    background-color: hsl(var(--bg-card));
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    padding: 1.5rem;
    transition: var(--transition);
}

.glass-card:hover {
    border-color: hsl(var(--border-hover));
}

/* Metrics Grid styling */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: hsl(var(--text-muted));
}

.metric-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-icon-box i {
    width: 18px;
    height: 18px;
}

.blue-box { background-color: hsla(var(--blue), 0.15); color: hsl(var(--blue)); }
.purple-box { background-color: hsla(var(--purple), 0.15); color: hsl(var(--purple)); }
.green-box { background-color: hsla(var(--green), 0.15); color: #22c55e; }

.metric-val {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
}

.metric-trend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.metric-trend i {
    width: 14px;
    height: 14px;
}

.metric-trend.up { color: #22c55e; }
.metric-trend.stability { color: hsl(var(--text-muted)); }

/* Charts card styling */
.charts-row {
    display: grid;
    grid-template-columns: 1fr;
}

.chart-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.chart-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.chart-actions {
    display: flex;
    gap: 0.5rem;
    background-color: hsla(240, 5%, 15%, 0.1);
    border-radius: 20px;
    padding: 2px;
}

body.dark-theme .chart-actions {
    background-color: hsla(0, 0%, 100%, 0.03);
}

.chart-tab {
    background: none;
    border: none;
    color: hsl(var(--text-muted));
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.chart-tab.active {
    background-color: hsl(var(--accent));
    color: white;
}

.chart-visual-wrapper {
    position: relative;
    height: 220px;
    width: 100%;
}

.telemetry-svg {
    width: 100%;
    height: 100%;
}

/* User Directory CRUD Card */
.user-table-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.table-title-box h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.table-title-box p {
    font-size: 0.85rem;
    color: hsl(var(--text-muted));
}

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

.table-search-bar {
    position: relative;
    width: 240px;
}

.table-search-bar input {
    width: 100%;
    background-color: hsla(240, 5%, 15%, 0.05);
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    font-size: 0.85rem;
    color: hsl(var(--text-main));
    transition: var(--transition);
}

body.dark-theme .table-search-bar input {
    background-color: hsla(0,0%,100%, 0.03);
}

.table-search-bar input:focus {
    outline: none;
    border-color: hsl(var(--accent));
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: hsl(var(--text-muted));
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    border-radius: 6px;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-full {
    width: 100%;
    padding: 0.75rem;
}

.btn-accent {
    background-color: hsl(var(--accent));
    color: white;
}

.btn-accent:hover {
    background-color: hsl(var(--accent-glow));
    transform: translateY(-1px);
}

.table-overflow-wrapper {
    overflow-x: auto;
    width: 100%;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.user-table th {
    padding: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: hsl(var(--text-muted));
    border-bottom: 1px solid hsl(var(--border));
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.user-table td {
    padding: 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid hsl(var(--border));
}

.user-table tbody tr:hover {
    background-color: hsla(240, 5%, 15%, 0.03);
}

body.dark-theme .user-table tbody tr:hover {
    background-color: hsla(0, 0%, 100%, 0.01);
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar-text {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: hsla(var(--accent), 0.15);
    color: hsl(var(--text-main));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.user-info-text {
    display: flex;
    flex-direction: column;
}

.user-info-text .user-name {
    font-weight: 600;
}

.user-info-text .user-email {
    font-size: 0.75rem;
    color: hsl(var(--text-muted));
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.active {
    background-color: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.status-badge.inactive {
    background-color: hsla(240, 5%, 50%, 0.15);
    color: hsl(var(--text-muted));
}

.actions-col {
    text-align: right;
}

.actions-cell {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: none;
    color: hsl(var(--text-muted));
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    color: hsl(var(--text-main));
    background-color: hsla(240, 5%, 15%, 0.05);
}

body.dark-theme .btn-icon:hover {
    background-color: hsla(0, 0%, 100%, 0.05);
}

.btn-icon.delete:hover {
    color: hsl(var(--danger));
}

.btn-icon i {
    width: 16px;
    height: 16px;
}

/* Telemetry Stats tab panels */
.telemetry-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.telemetry-bar-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bar-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 500;
}

.bar-track {
    height: 8px;
    background-color: hsl(var(--border));
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background-color: hsl(var(--accent));
    border-radius: 4px;
    transition: width 1s ease-in-out;
}

.bar-fill.warning {
    background-color: hsl(var(--warning));
}

/* Settings tab components */
.settings-card h2, .glass-card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.settings-form {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 500px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: hsl(var(--text-muted));
}

.form-input, .form-select {
    background-color: hsla(240, 5%, 15%, 0.05);
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    padding: 0.65rem 1rem;
    color: hsl(var(--text-main));
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: var(--transition);
}

body.dark-theme .form-input, body.dark-theme .form-select {
    background-color: hsla(0, 0%, 100%, 0.03);
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: hsl(var(--accent));
}

/* Modal Overlay & Form Box */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

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

.modal-container {
    width: 500px;
    max-width: 90%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: hsl(var(--text-muted));
    transition: var(--transition);
}

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

.modal-close i {
    width: 18px;
    height: 18px;
}

.modal-subtitle {
    font-size: 0.85rem;
    color: hsl(var(--text-muted));
    margin-bottom: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.flex-1 { flex: 1; }

/* AI Forecasting UI Controls and Card */
.chart-header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-ai-forecast {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: linear-gradient(135deg, hsl(217, 91.2%, 59.8%), hsl(270.7, 91%, 65.1%));
    border: 1px solid hsl(var(--border));
    color: white;
    padding: 0.45rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-ai-forecast:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.4);
    border-color: hsl(270.7, 91%, 65.1%);
}

.btn-ai-forecast i {
    width: 14px;
    height: 14px;
}

.ai-forecast-card {
    margin-top: 1.5rem;
    border: 1px dashed rgba(6, 182, 212, 0.5);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.05), rgba(124, 58, 237, 0.05));
    border-radius: 12px;
    padding: 1.25rem;
    animation: fadeIn 0.4s ease-out;
}

.ai-forecast-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: #06b6d4;
}

.ai-forecast-header h4 {
    font-size: 1.05rem;
    font-weight: 700;
}

.ai-forecast-content {
    font-size: 0.875rem;
    color: hsl(var(--text-muted));
    line-height: 1.6;
}

.ai-forecast-list {
    margin-top: 0.75rem;
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ai-forecast-list li {
    list-style-type: square;
    color: hsl(var(--text-muted));
}

.ai-forecast-list li strong {
    color: #06b6d4;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.d-none {
    display: none !important;
}

/* Responsive Dashboard Breakpoints */
@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        width: 260px;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .main-content {
        padding: 1.5rem;
    }
    
    .dash-menu-toggle {
        display: block;
    }
}

@media (max-width: 768px) {
    .card-table-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .table-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .table-search-bar {
        width: 100%;
        flex-grow: 1;
    }
    
    .btn-sm {
        width: 100%;
    }
}
