/*
 * Nexus Panel - CSS Styling
 * A modern, dark-mode glassmorphism server control panel.
 */

:root {
    /* Colors */
    --bg-base: #0B0E14;
    --bg-panel: rgba(18, 22, 31, 0.6);
    --bg-panel-border: rgba(255, 255, 255, 0.05);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #8b5cf6;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Metrics */
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --sidebar-width: 260px;
    
    /* Effects */
    --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.2);
    --glass-blur: blur(12px);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    overflow-x: hidden;
    /* Adding a subtle gradient background mesh effect */
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    background-attachment: fixed;
}

/* Typography & Utils */
h1, h2, h3, h4, h5, h6 { font-weight: 600; }
a { text-decoration: none; color: inherit; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger) !important; }
.text-small { font-size: 0.85rem; }

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

/* Glassmorphism Panel Utility */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--bg-panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-subtle);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border-right: 1px solid var(--bg-panel-border);
    background: rgba(11, 14, 20, 0.8);
    backdrop-filter: var(--glass-blur);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 10;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.sidebar-header {
    margin-bottom: 3rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}
.logo i {
    color: var(--primary);
    font-size: 1.8rem;
}
.logo span span {
    color: var(--text-muted);
    font-weight: 300;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
}

.nav-links li a i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.nav-links li a:hover, .nav-links li.active a {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.nav-links li.active a {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.05) 100%);
    border-left: 3px solid var(--primary);
}

.sidebar-footer {
    display: flex;
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}

summary::-webkit-details-marker {
    display: none;
}
summary {
    outline: none;
}
summary:hover {
    color: var(--primary) !important;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
}
.sidebar-footer a:hover {
    background: rgba(255, 255, 255, 0.05);
}

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

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2.5rem;
    border-bottom: 1px solid var(--bg-panel-border);
    background: rgba(11, 14, 20, 0.5);
    backdrop-filter: var(--glass-blur);
    position: sticky;
    top: 0;
    z-index: 5;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0,0,0,0.2);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--bg-panel-border);
    flex: 1;
    max-width: 800px;
}
.search-bar i { color: var(--text-muted); }
.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-main);
    outline: none;
    width: 100%;
    font-family: inherit;
    font-size: 0.95rem;
}
.search-bar input::placeholder { color: var(--text-muted); }

.user-profile {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.notifications {
    position: relative;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: var(--transition);
}
.notifications:hover { color: var(--text-main); }
.notifications .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    height: 16px;
    width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.notif-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: -10px;
    width: 360px;
    max-height: 440px;
    background: rgba(15, 19, 28, 0.98);
    border: 1px solid var(--bg-panel-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-subtle);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.notif-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--bg-panel-border);
    font-weight: 600;
    font-size: 0.95rem;
}
.notif-panel-list {
    max-height: 350px;
    overflow-y: auto;
    padding: 0.4rem 0;
}
.notif-panel-list .timeline-item {
    padding: 0.65rem 1.1rem;
    border-radius: 0;
    cursor: default;
}
.notif-panel-list .timeline-item + .timeline-item {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.notif-panel-list .timeline-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    cursor: pointer;
}

/* Dashboard Area */
.dashboard-content {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}
.page-header .subtitle {
    color: var(--text-muted);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.stat-header .title {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.stat-header i {
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.05);
}
.icon-cpu { color: var(--primary); }
.icon-ram { color: var(--warning); }
.icon-disk { color: var(--success); }
.icon-network { color: var(--info); }

.stat-body .value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}
.progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.progress-bar .fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 1s ease-in-out;
}
.progress-bar .fill.warning { background: var(--warning); }
.progress-bar .fill.success { background: var(--success); }
.progress-bar .fill.info { background: var(--info); }

.stat-body .description {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Modules Grid */
.modules-grid {
    display: flex;
    gap: 1.5rem;
}
.modules-grid.secondary {
    margin-top: 0.5rem;
}
.flex-2 { flex: 2; }
.module-card {
    padding: 1.5rem;
    flex: 1;
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.module-header h2 {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.module-header h2 i {
    color: var(--primary);
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover {
    background: rgba(99, 102, 241, 0.1);
}
.btn-text {
    background: transparent;
    color: var(--primary);
}
.btn-text:hover {
    text-decoration: underline;
}
.btn-icon {
    padding: 0.5rem;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
}
.btn-icon:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
}

/* Lists & Tables */
.module-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.module-list.space-compact {
    gap: 0.5rem;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.02);
    transition: var(--transition);
}
.list-item:hover {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.08);
}
.list-item.minimal {
    padding: 0.75rem 1rem;
}

.item-info h4 {
    margin-bottom: 0.25rem;
}

.tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.tag-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.tag-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }

.item-actions {
    display: flex;
    gap: 0.5rem;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--bg-panel-border);
}
.data-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
}
.data-table tbody tr:last-child td {
    border-bottom: none;
}
.data-table tbody tr {
    transition: background 0.2s;
}
.data-table tbody tr:hover {
    background: rgba(255,255,255,0.02);
}

/* Timeline */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    padding-left: 1rem;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 19px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background: var(--bg-panel-border);
}
.timeline-item {
    display: flex;
    gap: 1rem;
    position: relative;
}
.timeline-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--bg-base);
    z-index: 1;
}
.timeline-icon.warning { background: var(--warning); }
.timeline-icon.success { background: var(--success); }
.timeline-content h4 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}
.timeline-content p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.timeline-content .time {
    font-size: 0.75rem;
    color: rgba(148, 163, 184, 0.5);
}

/* Responsive */
@media (max-width: 1024px) {
    .modules-grid { flex-direction: column; }
    .search-bar { width: 300px; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; }
    .topbar { padding: 1rem; }
    .search-bar { display: none; }
    .dashboard-content { padding: 1rem; }
}

/* Modals */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; opacity: 0; pointer-events: none;
    transition: var(--transition);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content {
    background: rgba(18, 22, 31, 0.95);
    border: 1px solid var(--bg-panel-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 450px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: var(--transition);
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-header.close { cursor: pointer; color: var(--text-muted); }
.modal-header h3 { font-size: 1.25rem; }
.modal-close { cursor: pointer; color: var(--text-muted); background: none; border: none; font-size: 1.2rem; }
.modal-close:hover { color: var(--danger); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; color: var(--text-muted); font-size: 0.9rem; }
.form-control {
    width: 100%; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-main); padding: 0.75rem; border-radius: var(--radius-sm); font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); }
.modal-footer { display: flex; justify-content: flex-end; gap: 1rem; margin-top: 1.5rem; }

/* Status messages inside UI */
#action-status { margin-top: 1rem; font-size: 0.9rem; padding: 0.5rem; border-radius: 4px; display: none; }
#action-status.success { background: rgba(16, 185, 129, 0.2); color: var(--success); display: block; }
#action-status.error { background: rgba(239, 68, 68, 0.2); color: var(--danger); display: block; }

/* ── Tabs ──────────────────────────────────────────────── */
.tab-bar {
    display: flex; gap: .25rem; padding: .5rem; border-radius: var(--radius-lg);
}
.tab-btn {
    padding: .55rem 1.25rem; border-radius: var(--radius-sm); border: none;
    background: transparent; color: var(--text-muted); font-family: 'Outfit',sans-serif;
    font-size: .9rem; cursor: pointer; transition: all .2s;
}
.tab-btn:hover { color: var(--text-main); background: rgba(255,255,255,.05); }
.tab-btn.active {
    background: var(--primary); color: #fff; font-weight: 600;
    box-shadow: 0 4px 14px rgba(99,102,241,.35);
}

/* ── Policy toggles ────────────────────────────────────── */
.policy-toggle {
    display: flex; align-items: center; gap: .5rem;
    padding: .45rem .9rem; border-radius: 8px;
    background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
    cursor: pointer; font-size: .85rem; color: var(--text-muted);
    transition: all .2s; user-select: none;
}
.policy-toggle:hover { background: rgba(99,102,241,.12); border-color: rgba(99,102,241,.3); color: var(--text-main); }
.policy-toggle input { accent-color: var(--primary); }

/* ── VHost cards ───────────────────────────────────────── */
.vhost-card {
    border: 1px solid rgba(255,255,255,.06); border-radius: var(--radius-lg);
    padding: 1rem 1.25rem; margin-bottom: .75rem;
    background: rgba(255,255,255,.025); transition: border-color .2s;
}
.vhost-card:hover { border-color: rgba(99,102,241,.3); }
.vhost-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.vhost-card-meta { display: flex; flex-wrap: wrap; gap: .5rem 2rem; font-size: .82rem; color: var(--text-muted); }
