:root {
    /* Brighter, More Vibrant Color Palette */
    --bg-dark: #8f94a0;       
    --bg-panel: #232736;      
    --bg-main: #ffffff;       /* Brighter, richer main background */
    --bg-sidebar: #202438;    /* Deep but saturated sidebar */
    --bg-card: #343a55;       /* Lighter floating cards to stand out */
    
    /* Text Colors */
    --text-main: #ffffff;     /* Pure white for higher contrast */
    --text-muted: #ffffff;    /* Softer, readable blue-gray */
    --primary: #00d5ff;       /* Vibrant Cyan / Teal */
    --primary-dim: rgba(0, 213, 255, 0.25);
    --success: #20c997;       /* Brighter mint/emerald */
    --warning: #ffb020;       /* Brighter gold/amber */
    --danger: #ff4757;        /* Vibrant crimson/pink */
    --border: #4a5275;        /* Lighter, more visible panel borders */
   
    /* Glow Effect Variables */
    --primary-glow: rgba(0, 213, 255, 0.4);
    --border: #76b7dd; 
    
    --success-glow: rgba(166, 227, 161, 0.3);
    --danger-glow: rgba(243, 139, 168, 0.3);

}
   
    
   
    

/* --- Header Layout Fix --- */
.dashboard-header {
    display: flex;
    justify-content: space-between; /* Pushes the title left, button right */
    align-items: center; /* Vertically centers them */
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
    width: 100%;
}

/* --- Global Button Styling --- */
.btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.btn i {
    margin-right: 8px; /* Adds space between the icon and text */
    font-size: 16px;
}

/* The glowing Cyan Primary Button */
.btn.primary {
    background-color: var(--primary); 
    color: #000; /* Dark text for contrast against the bright cyan */
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.2);
}

.btn.primary:hover {
    background-color: #00d2ff; /* Slightly brighter on hover */
    box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
    transform: translateY(-2px); /* Floats up slightly */
}




*{
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.dashboard {
    display: flex;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 240px; 
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0; /* Prevents the main content from squishing it */
    z-index: 10;    /* Keeps it strictly above the background */
}

/* --- Force Logo and Text Side-by-Side --- */
.sidebar-header {
    display: flex;
    align-items: center; /* Centers them vertically together */
    justify-content: center; /* Adjust to flex-start if you want it aligned left */
    gap: 10px; /* Adds perfect spacing between the image and text */
    padding: 15px; /* Gives it some breathing room */
}

/* Optional: remove the margin-left from the h2 we added earlier 
   since the 'gap: 10px' above now handles the spacing perfectly! */

/* Sidebar Header & Logo */
.sidebar-header h2 {
    font-size: 22px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    
  /* Create a gradient pulling from your gem colors */
    background: linear-gradient(90deg, #b794f6, #00d2ff);
    -webkit-background-clip: text;
    background-clip: text; /* <--- Add this line here */
    -webkit-text-fill-color: transparent;
    
    /* Adds a subtle cyan glow behind the text */
    text-shadow: 0px 4px 15px rgba(0, 210, 255, 0.25);
    margin-left: 10px;
}

.sidebar-logo {
    width: 75px; /* Scaled down just a fraction to balance the layout */
    height: 75px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background-color: var(--bg-dark); /* Fills empty space if image is broken */
    color: transparent; /* Hides the messy alt text when image is broken */
}

.sidebar h2 {
    color: var(--primary);
    font-weight: 700;
    font-size: 19px; /* Tweaked slightly to ensure it fits */
    margin: 0;
    padding: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 10px var(--primary-dim);
    white-space: nowrap; /* Forces text to stay on one straight line */
}

/* --- Sidebar Navigation Menu --- */
.sidebar-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Custom Scrollbar for the sidebar */
.sidebar-scroll-area::-webkit-scrollbar {
    width: 6px;
}
.sidebar-scroll-area::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-scroll-area::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 10px;
}

/* Standalone Links (Home, Logout) */
.nav-single-link {
    display: block;
    padding: 10px 15px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-single-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-single-link.active {
    background-color: var(--primary-dim);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.logout-link {
    color: var(--danger);
    margin-top: auto; /* Pushes logout to the very bottom if there's space */
}
.logout-link:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Grouped Navigation Boxes */
.nav-group-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
    padding-left: 5px;
    letter-spacing: 0.5px;
}

.nav-group-box {
    list-style: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.15); /* Slightly darker inset background */
    padding: 5px 0;
    overflow: hidden;
}

.nav-group-box li a {
    display: block;
    padding: 8px 15px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

.nav-group-box li a:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    padding-left: 20px; /* Slide effect */
    border-left-color: var(--primary);
}
/* --- Icon Styling & Spacing --- */
.nav-single-link i {
    width: 24px;
    text-align: center;
    margin-right: 8px;
    opacity: 0.8;
}

.nav-group-title i {
    color: var(--primary);
    margin-right: 8px;
    width: 20px;
    text-align: center;
    text-shadow: 0 0 8px var(--primary-dim);
}

.nav-group-box li a i {
    width: 20px;
    text-align: center;
    margin-right: 12px;
    opacity: 0.5; /* Dimmed by default */
    transition: all 0.2s ease;
}

.nav-group-box li a:hover i {
    opacity: 1; /* Lights up on hover */
    color: var(--primary);
    text-shadow: 0 0 8px var(--primary-dim);
}
/* --- Dashboard Home Layout --- */
.dashboard-header {
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 40px; /* Slightly larger padding for breathing room */
    overflow-y: auto;
    background: radial-gradient(circle at top right, #8f94a0, var(--bg-dark));
    width: calc(100% - 290px); /* Strictly calculate space leftover from sidebar */
}

/* Center Content on Wide Screens */
.dashboard-header,
.dashboard-row,
.stats-grid {
    max-width: 1400px; /* Stops it from stretching to infinity */
    margin-left: auto; /* Pushes to the center */
    margin-right: auto; /* Pushes to the center */
    width: 100%;
}

.page-title {
    font-size: 26px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.dashboard-row {
    margin-bottom: 25px;
}

/* --- The Cool Boxes (Base Card Styling) --- */
.card {
    background-color: var(--bg-card); 
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    padding: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* --- Main Node Card --- */
.system-info-card {
    /* Adds a sleek gradient and a cyan accent line on the left */
    background: linear-gradient(145deg, var(--bg-card) 0%, rgba(16, 22, 35, 0.8) 100%);
    border-left: 4px solid var(--primary);
}

.system-info-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.system-info-card .card-header h3 {
    margin: 0;
    color: var(--primary);
    font-size: 16px;
    text-shadow: 0 0 10px var(--primary-dim);
}

.system-info-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-group {
    display: flex;
    font-size: 14px;
}

.info-label {
    width: 140px;
    color: var(--text-muted);
    font-weight: 600;
}

.info-value {
    color: var(--text-main);
    flex: 1;
}

.info-group.description {
    margin-top: 10px;
    padding-top: 15px;
    border-top: 1px dashed rgba(255, 255, 255, 0.05);
    flex-direction: column;
    gap: 8px;
}

.info-group.description .info-value {
    line-height: 1.5;
}

/* --- Stats Grid & Hover Effects --- */
.stats-grid {
    display: grid;
    /* This forces the 4 boxes to sit side-by-side! */
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
    gap: 20px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 25px 20px;
    position: relative;
    overflow: hidden;
}

/* Makes the boxes float and glow when you hover over them */
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 242, 254, 0.08);
    border-color: rgba(0, 242, 254, 0.3);
}

.stat-icon {
    font-size: 28px;
    color: var(--primary);
    opacity: 0.9;
    text-shadow: 0 0 15px var(--primary-dim);
    /* Puts a dark, subtly glowing box behind the icons */
    background: rgba(0, 242, 254, 0.05); 
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(0, 242, 254, 0.1);
}

.stat-details h3 {
    margin: 0 0 6px 0;
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-details p {
    margin: 0;
    font-size: 20px; /* Scaled down just a fraction to fit perfectly */
    font-weight: bold;
    color: var(--text-main);
    white-space: nowrap; /* Forces the text to stay on one straight line */
}

/* --- Modals & Popups --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Made the modal significantly wider (from 450px to 600px) */
.modal-card {
    width: 90%;
    max-width: 600px; 
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    padding: 25px 30px; /* Added more inner breathing room */
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.modal-header h2 {
    font-size: 20px; /* Slightly larger title */
    color: var(--primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Forms Inside Modals */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

/* Shared styling for Inputs AND Dropdowns */
.styled-input,
.styled-select {
    width: 100%;
    background-color: #05080f;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 12px 15px;
    border-radius: 4px;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.styled-input:focus,
.styled-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 8px var(--primary-dim);
}

/* Specific fix for the ugly white dropdown */
.styled-select {
    appearance: none; /* Strips away the browser's default styling */
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    /* Adds a custom, theme-matching dropdown arrow */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%238b9bb4%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 15px top 50%;
    background-size: 12px auto;
}

.styled-select option {
    background-color: var(--bg-card);
    color: var(--text-main);
    padding: 10px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

/* --- Sidebar Action Button Styling --- */
.sidebar-action-btn {
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    display: block;
    padding: 8px 15px;
    color: var(--text-muted);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

.sidebar-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    padding-left: 20px; /* Gives it the same slide effect as the links */
    border-left-color: var(--primary);
}

.sidebar-action-btn i {
    width: 20px;
    text-align: center;
    margin-right: 12px;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.sidebar-action-btn:hover i {
    opacity: 1;
    color: var(--primary);
    text-shadow: 0 0 8px var(--primary-dim);
}
/* --- Force Modal Button Styling --- */
.modal-footer .btn {
    padding: 10px 24px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-family: inherit;
    background: transparent; /* Clears the default browser grey */
}

/* Cancel Button */
.modal-footer .btn.warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border-color: var(--warning);
}

.modal-footer .btn.warning:hover {
    background-color: rgba(245, 158, 11, 0.2);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
    transform: translateY(-2px);
}

/* Save User Button */
.modal-footer .btn.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: var(--success);
}

.modal-footer .btn.success:hover {
    background-color: rgba(16, 185, 129, 0.2);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

/* ========================================= */
/* --- VIEW TOGGLING (SPA LOGIC) ---         */
/* ========================================= */
.page-view {
    display: none; /* Hides all views by default */
    animation: fadeIn 0.3s ease;
}

.page-view.active {
    display: block; /* Only shows the view with the 'active' class */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================= */
/* --- USER MANAGEMENT PAGE STYLING ---      */
/* ========================================= */

/* Toolbar (Search & Filter) */
.toolbar-card {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    gap: 15px;
    margin-bottom: 20px;
}

.search-box {
    flex: 1;
    display: flex;
    align-items: center;
    background: #05080f;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0 15px;
}

.search-box i {
    color: var(--text-muted);
    margin-right: 10px;
}

.search-box input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 10px 0;
    outline: none;
    font-family: inherit;
}

/* Data Tables */
.table-card {
    padding: 0;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    padding: 15px 20px;
    border-bottom: 2px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 14px;
    color: var(--text-main);
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* User Avatars and Badges inside the table */
.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: var(--primary);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.avatar.client { background-color: var(--text-muted); color: #fff; }
.avatar.admin { background-color: var(--primary); color: #000; }

.user-name { font-weight: 600; color: var(--text-main); margin-bottom: 2px; }
.user-email { font-size: 12px; color: var(--text-muted); }

.role-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.role-badge.admin { background-color: rgba(0, 242, 254, 0.15); color: var(--primary); border: 1px solid var(--primary); }
.role-badge.client { background-color: rgba(139, 155, 180, 0.15); color: var(--text-muted); border: 1px solid var(--text-muted); }

.text-right { text-align: right; }

/* ========================================= */
/* --- ROLE MANAGEMENT SPECIFIC STYLES ---   */
/* ========================================= */

/* Extra Badge Colors */
.role-badge.warning { 
    background-color: rgba(245, 158, 11, 0.15); 
    color: var(--warning); 
    border: 1px solid var(--warning); 
}

.role-badge.success { 
    background-color: rgba(16, 185, 129, 0.15); 
    color: var(--success); 
    border: 1px solid var(--success); 
}

/* Permission Text Styling */
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }

.permission-item {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- Modern Horizontal Server Card Styles --- */

/* Add smooth transitions for any interactive elements */
* {
    transition: all 0.2s ease-in-out;
}

/* Ensure the card container allows for single-column cards per row */
.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Spacing between rows of cards */
    padding: 20px;
}

.service-card {
    display: flex;
    flex-direction: row; /* Main layout is horizontal */
    align-items: center; /* Vertically center content */
    background: #111827; /* Dark background consistent with your theme */
    border: 1px solid #1f2937; /* Subtle border */
    border-radius: 8px;
    padding: 15px 20px;
    gap: 20px; /* Spacing between sections within the card */
    width: 100%;
    box-sizing: border-box; /* Ensure padding doesn't affect width */
    color: #e5e7eb; /* Standard text color */
}

.service-card:hover {
    border-color: #3b82f6; /* Highlight border on hover */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* --- Section 1: Icon & Banner --- */
.card-icon-col {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    flex-shrink: 0;
}

/* New Wide Banner Image */
.card-banner-col {
    width: 180px; /* Wide format like Steam library assets */
    height: 80px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 6px;
    flex-shrink: 0;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5); /* Inner shadow for depth */
    border: 5px solid var(--border);
}

/* --- Section 2: Core Details (Name, Game, IP/Port) --- */
.card-details-col {
    flex: 2; /* Takes up 2/5 of available space after icon/actions */
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.card-details-col h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #f9fafb; /* Brighter color for the name */
}

.card-details-col .game-label {
    font-size: 14px;
    color: #9ca3af; /* Muted color for game label */
}

.card-details-col .ip-port {
    font-family: monospace;
    font-size: 13px;
    color: #9ca3af; /* Monospace for technical details */
}

/* --- Section 3: Status and Resources --- */
.card-status-resources-col {
    flex: 3; /* Takes up 3/5 of available space */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Status Indicator */
.card-status-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Dynamic status colors - update these based on actual status names in JS */
.status-indicator-dot.online { background-color: #10b981; } /* Green */
.status-indicator-dot.starting { background-color: #f59e0b; } /* Orange */
.status-indicator-dot.offline { background-color: #ef4444; } /* Red */
/* Add styles for any other statuses */

.card-status-text {
    font-size: 14px;
    font-weight: 500;
}

.card-status-text.online { color: #10b981; }
.card-status-text.starting { color: #f59e0b; }
.card-status-text.offline { color: #ef4444; }


/* Resources Section */
.card-resources {
    display: flex;
    flex-direction: row; /* Resources side-by-side */
    gap: 15px;
    align-items: center;
    font-size: 13px;
    color: #9ca3af;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.resource-item i {
    width: 15px; /* Consistent icon width */
    text-align: center;
    color: #6b7280; /* Muted icon color */
}

/* Slots display */
.resource-item.slots {
    color: #e5e7eb;
}

/* (Optional) Simple style for inline numbers, could be made dynamic with Gauges later */
.resource-value {
    font-weight: 500;
    color: #e5e7eb;
}

/* --- Section 4: Action Buttons --- */
.card-actions-col {
    /* Removed the strict 160px width so buttons can breathe */
    display: flex;
    flex-direction: row; 
    gap: 10px;
    justify-content: flex-end; 
    flex-shrink: 0; 
}

/* Force standard button colors so they aren't white/broken */
.card-actions-col .btn {
    color: #fff;
    border: none;
    padding: 8px 15px;
    box-shadow: none; /* Removes modal glow effects */
}

/* Solid background colors for the server cards */
.card-actions-col .btn.success { background-color: #10b981; }
.card-actions-col .btn.success:hover { background-color: #059669; }

.card-actions-col .btn.info { background-color: #3b82f6; }
.card-actions-col .btn.info:hover { background-color: #2563eb; }

.card-actions-col .btn.secondary { background-color: #4b5563; }
.card-actions-col .btn.secondary:hover { background-color: #374151; }

.card-actions-col .btn.danger { background-color: #ef4444; }
.card-actions-col .btn.danger:hover { background-color: #dc2626; }

.card-actions-col .btn.warning { background-color: #f59e0b; }
.card-actions-col .btn.warning:hover { background-color: #d97706; }

/* Existing button styles should work, just make sure they look good aligned horizontally */
.btn {
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Specifically style the power buttons if needed for horizontal alignment */
.btn-power {
    padding: 8px;
}

/* ==========================================
   GAMESTACK CARD UI
   ========================================== */
.gs-header-row {
    display: flex;
    padding: 0 15px 10px 15px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 15px;
}

.gs-card {
    display: flex;
    align-items: center;
    background: #343a55; /* Darker card background */
    border-radius: 6px;
    padding: 12px;
    border: 2px solid var(--border);
    margin-bottom: 10px;
    gap: 20px;
}

.action-group-box {
    border: 1px solid #2b3040;
    border-radius: 4px;
    padding: 12px 6px 6px 6px;
    position: relative;
    display: flex;
    gap: 5px;
    background: rgba(0,0,0,0.15);
}

.action-group-title {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1d24; /* Matches card background to mask border */
    padding: 0 6px;
    font-size: 9px;
    color: #6b7280;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
}

.gs-btn {
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    transition: 0.2s;
}

.gs-btn i { font-size: 11px; }
.gs-btn:hover { filter: brightness(1.2); }

/* Specific Button Colors from Screenshot */
.gs-btn-orange { background: #f59e0b; }
.gs-btn-green { background: #10b981; }
.gs-btn-red { background: #ef4444; }
.gs-btn-blue { background: #3b82f6; }
.gs-btn-purple { background: #6366f1; }
.gs-btn-dark { background: #252b3b; border: 1px solid #32394e; }
.gs-btn-dark:hover { background: #2f364a; }

/* Status Badges */
.gs-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.gs-badge.offline { color: #ef4444; border: 1px solid #ef4444; }
.gs-badge.online { color: #10b981; border: 1px solid #10b981; }
.gs-badge.starting { color: #f59e0b; border: 1px solid #f59e0b; }

/* --- Sidebar Category Icon Colors --- */

/* Home Icon (Cyan) */
.nav-single-link[data-target="view-dashboard"] i {
    color: #00d2ff;
    text-shadow: 0 0 8px rgba(0, 210, 255, 0.4);
}

/* 1. User Management Group (Soft Purples) */
.nav-group:nth-of-type(1) .nav-group-title i,
.nav-group:nth-of-type(1) .nav-group-box i {
    color: #a78bfa; 
    text-shadow: 0 0 8px rgba(167, 139, 250, 0.4);
}

/* 2. Service Management Group (Emerald Greens) */
.nav-group:nth-of-type(2) .nav-group-title i,
.nav-group:nth-of-type(2) .nav-group-box i {
    color: #34d399; 
    text-shadow: 0 0 8px rgba(52, 211, 153, 0.4);
}

/* 3. Server Management Group (Amber/Oranges) */
.nav-group:nth-of-type(3) .nav-group-title i,
.nav-group:nth-of-type(3) .nav-group-box i {
    color: #fbbf24; 
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

/* 4. System Group (Cool Blues) */
.nav-group:nth-of-type(4) .nav-group-title i,
.nav-group:nth-of-type(4) .nav-group-box i {
    color: #60a5fa;
    text-shadow: 0 0 8px rgba(96, 165, 250, 0.4);
}

/* FIREWALL MANAGER STYLES */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    color: #ffffff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Firewall Table Specifics */
#firewall-table-body tr {
    border-bottom: 1px solid #2a2d35;
    transition: background-color 0.2s;
}

#firewall-table-body tr:hover {
    background-color: #252830;
}

#firewall-table-body td {
    padding: 15px 12px;
    vertical-align: middle;
}

.fw-empty-state {
    text-align: center;
    padding: 40px !important;
    color: #888;
    font-style: italic;
    background-color: transparent !important;
}

.fw-protocol-badge {
    background-color: #2a2d35;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #00d2ff;
    font-weight: bold;
}

/* OVERRIDE TO FORCE MODAL TO THE FRONT */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgba(0, 0, 0, 0.85) !important;
    z-index: 999999 !important; 
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #1e2128;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #2a2d35;
    z-index: 1000000 !important;
    width: 400px;
    max-width: 90%;
    color: #ffffff;
    box-shadow: 0px 10px 30px rgba(0,0,0,0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2a2d35;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

/* ==========================================
   SYSTEM SETTINGS STYLES
   ========================================== */
.settings-container {
    padding: 30px;
    box-sizing: border-box;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.p-20 {
    padding: 20px;
}

.mt-15 {
    margin-top: 15px;
}

.card-title {
    color: #ffffff;
    margin: 0 0 10px 0;
    font-size: 1.2rem;
}

.divider {
    border: none;
    border-top: 1px dashed var(--border);
    margin: 15px 0;
}

.input-helper {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    margin-bottom: 0;
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group .styled-input {
    flex: 1;
}

/* ==========================================
   UNIVERSAL FLUID RESPONSIVENESS
   ========================================== */

/* 1. Fluid Layout for Main Dashboard Wrapper */
.dashboard {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.main-content {
    flex: 1; /* Takes exactly the remaining space next to the sidebar */
    min-width: 0; /* CRITICAL: Prevents flex children from pushing past the screen edge */
    overflow-y: auto;
    overflow-x: hidden;
}

/* 2. Fluid Math Grids (Auto-Fit) */
/* These will automatically stretch, or drop to the next row if the window gets too small */
.stats-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    gap: 20px;
}

.settings-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
    gap: 20px;
}

#view-batch-updates .dashboard-content {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)) !important;
    gap: 20px;
}

/* 3. Flexible Server Cards */
.gs-card {
    display: flex;
    flex-wrap: wrap; /* Allows the card contents to wrap to a new line */
    align-items: center;
    gap: 15px;
}



/* 4. Responsive Tables */
/* Prevents long tables from breaking the page width. Adds a horizontal scrollbar just for the table. */
.table-card, 
#firewall-manager-view > div, 
#view-mysql-manager > div, 
#view-backups > div {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    min-width: 700px; /* Forces table scroll instead of squeezing text to unreadable sizes */
}

/* 5. Responsive Modals */
.modal-card {
    width: 90% !important;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

/* 6. Tablet / Small Laptop Specific Tweaks */
@media (max-width: 1200px) {
    .sidebar {
        width: 240px; /* Shrink sidebar slightly on smaller laptops */
    }
    
    /* Stack the Mass Emails grid */
    #view-mass-emails > div {
        grid-template-columns: 1fr !important;
    }
}

/* ========================================== */
/* INVISIBLE SCROLLBARS                       */
/* ========================================== */

/* Hide scrollbar for Chrome, Safari and Edge */
::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for Firefox */
* {
    scrollbar-width: none;
}

/* ========================================== */
/* SETTINGS PAGE GRID CLEANUP                 */
/* ========================================== */
.settings-grid {
    display: grid;
    /* This forces the cards to be at least 350px wide. If they can't fit 4 in a row, it neatly drops them to the next line! */
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); 
    gap: 20px;
    /* This is the magic line: It tells the cards to only be as tall as their content, stopping the weird stretching! */
    align-items: start; 
}

/* ========================================== */
/* GLOBAL NEON BORDER GLOWS                   */
/* ========================================== */

/* 1. Make all Cards and Modals emit a soft blue glow */
.card, .modal-card, .sidebar {
    border: 1px solid var(--border) !important;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5), 0 0 12px var(--primary-glow) !important;
    transition: all 0.3s ease;
}

/* Make cards glow slightly brighter when you hover over them! */
.card:hover {
    border-color: var(--primary) !important;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5), 0 0 18px var(--primary-glow) !important;
}

/* 2. Button Glows (Color-coded to match their function) */
.btn.primary {
    border: 1px solid var(--primary) !important;
    box-shadow: 0 0 12px var(--primary-glow) !important;
}

.btn.success {
    border: 1px solid var(--success) !important;
    box-shadow: 0 0 12px var(--success-glow) !important;
}

.btn.danger {
    border: 1px solid var(--danger) !important;
    box-shadow: 0 0 12px var(--danger-glow) !important;
}

/* 3. Input Box Glows (Only glow when you click to type in them) */
.styled-input, .styled-select {
    border: 1px solid var(--border) !important;
    transition: all 0.3s ease;
}

.styled-input:focus, .styled-select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 15px var(--primary-glow) !important;
    outline: none;
}

/* ========================================== */
/* SLEEK SETTINGS PAGE OVERRIDES              */
/* ========================================== */
#view-settings .settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 15px; /* Tighter spacing between the cards */
}

#view-settings .card {
    padding: 15px !important; /* Forces the bulky 20px+ padding to shrink */
    border-radius: 8px;
}

#view-settings .card-title {
    font-size: 15px;
    margin-bottom: 8px;
    margin-top: 0;
}

#view-settings .divider {
    margin: 8px 0 12px 0;
    border-color: rgba(255, 255, 255, 0.05);
}

#view-settings .form-group {
    margin-bottom: 12px !important;
}

#view-settings .form-group label {
    font-size: 12px; /* Crisper, smaller labels */
    margin-bottom: 4px;
    display: inline-block;
}

#view-settings .styled-input,
#view-settings .form-control {
    padding: 8px 12px !important; /* Thinner input boxes */
    font-size: 13px !important;
}

#view-settings .input-helper,
#view-settings small {
    font-size: 10.5px !important; /* Neater helper text */
    line-height: 1.4;
    margin-top: 4px !important;
}

/* Force the Banner Search popup to always sit on top of other popups */
#modal-banner-search {
    z-index: 9999 !important;
}



/* ==========================================
   MASTER AVATAR SIZING OVERRIDE
========================================== */
/* This forces BOTH images and letters in the table to be exactly 45px */
tbody td img, 
tbody td .avatar, 
tbody td .avatar-circle,
tbody td [class*="avatar"] {
    width: 45px !important;
    height: 45px !important;
    min-width: 45px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    
    /* These 3 lines ensure the letter 'B' stays perfectly centered in the new larger circle */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important; 
}

/* ==========================================
   SIDEBAR AVATAR SIZING OVERRIDE (THE FINAL FIX)
========================================== */
/* Targets images ONLY inside the menu list, leaving the header logo completely alone */
aside ul img,
aside nav img,
.sidebar ul img,
.sidebar nav img,
.sidebar-menu img {
    width: 45px !important;
    height: 45px !important;
    min-width: 45px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
}

/* The ultimate safeguard: Force the main panel logo back to its normal size and shape */
.sidebar .logo img,
.sidebar .brand-logo img,
aside .brand img {
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    border-radius: 0 !important;
}

/* ==========================================
   SLEEK ACTION BUTTON SCROLLBAR
========================================== */
.action-scroll-container::-webkit-scrollbar {
    height: 6px;
}
.action-scroll-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}
.action-scroll-container::-webkit-scrollbar-thumb {
    background: #313244;
    border-radius: 4px;
}
.action-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #45475a;
}

/* ==========================================
   DASHBOARD SPLIT ROW (COMMUNITY & AUDIT)
========================================== */
.dashboard-split-row {
    display: grid;
    /* THE FIX: Use the exact same 4-column grid as your stat boxes! */
    grid-template-columns: repeat(4, 1fr); 
    gap: 20px;
    margin-top: 20px;
}

.dashboard-split-row .community-card {
    grid-column: span 1; /* Takes exactly 1 box width (Aligns perfectly under CPU) */
}

.dashboard-split-row .terminal-card {
    grid-column: span 3; /* Takes exactly 3 box widths (Aligns perfectly under RAM, Storage, and Network) */
}

/* On small screens, safely stack them on top of each other */
@media (max-width: 1100px) {
    .dashboard-split-row {
        grid-template-columns: 1fr;
    }
    .dashboard-split-row .community-card,
    .dashboard-split-row .terminal-card {
        grid-column: span 1;
    }
}

/* Community Stats Styling */
.community-stat-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.comm-icon {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.comm-details {
    display: flex;
    flex-direction: column;
}

.comm-title {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.comm-value {
    font-size: 22px;
    font-weight: bold;
    color: var(--text-main);
}

.comm-value small {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: normal;
}

/* ==========================================
   TERMINAL AUDIT LOG STYLING
========================================== */
.terminal-card {
    display: flex;
    flex-direction: column;
    padding: 0 !important; /* Strips standard card padding */
    overflow: hidden;
    background: #0d1117 !important; /* Pitch black GitHub-style background */
    border: 1px solid #30363d !important;
}

.terminal-card .card-header {
    background: #161b22;
    padding: 15px 20px;
    border-bottom: 1px solid #30363d;
}

.terminal-window {
    flex: 1;
    padding: 15px 20px;
    background: #0d1117;
    height: 220px; /* Locks the height so it doesn't stretch the page */
    overflow-y: auto;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Custom minimal scrollbar for the terminal */
.terminal-window::-webkit-scrollbar { width: 6px; }
.terminal-window::-webkit-scrollbar-track { background: transparent; }
.terminal-window::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }

/* Individual Log Entries */
.log-entry {
    display: flex;
    gap: 15px;
    line-height: 1.4;
    padding: 4px 0;
    border-bottom: 1px dashed rgba(255,255,255,0.05);
}
.log-entry:last-child { border-bottom: none; }

.log-time { color: #8b949e; flex-shrink: 0; width: 75px; }
.log-user { color: #58a6ff; font-weight: bold; }
.log-action { color: #c9d1d9; }
.log-target { color: #7ee787; }

/* The flashing red "Live" indicator */
.pulse-indicator {
    background: rgba(248, 81, 73, 0.1);
    color: #f85149;
    border: 1px solid #f85149;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 6px;
}
.pulse-indicator::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #f85149;
    border-radius: 50%;
    box-shadow: 0 0 8px #f85149;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* ==========================================
   THE PERFECT 12-COLUMN DASHBOARD GRID
========================================== */
.master-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    margin-top: 20px;
    align-items: stretch;
}

/* Mobile Fallback: Stack everything neatly on small screens */
@media (max-width: 1100px) {
    .master-dashboard-grid {
        grid-template-columns: 1fr;
    }
    .master-dashboard-grid > div {
        grid-column: span 1 !important;
    }
}

/* Premium Settings Grid System */
.settings-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
    gap: 25px;
    align-items: start; /* Prevents short cards from stretching */
    width: 100%;
    margin-top: 20px;
}

.settings-card {
    background: #1e1e2e;
    border: 1px solid #313244;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.settings-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}

.settings-card h3 {
    color: #89b4fa;
    margin: 0 0 5px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #313244;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 11px;
    color: #a6adc8;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}