/**
 * SRVCP - Server Control Panel
 * Main Stylesheet
 */

/* === Variables === */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #06b6d4;

    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-input: #1e293b;
    --bg-secondary: #1e293b;
    --bg-warning: rgba(245, 158, 11, 0.1);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border: #334155;
    --border-light: #475569;

    --sidebar-width: 250px;
    --header-height: 60px;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: var(--bg-dark);
    color: var(--text-primary);
}

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

a:hover {
    text-decoration: underline;
}

/* === Utilities === */
.hidden {
    display: none !important;
}

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-muted); }

/* === Login Page === */
#login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-light);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
}

/* === Forms === */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

select {
    cursor: pointer;
}

.error-message {
    color: var(--error);
    font-size: 13px;
    margin-top: 8px;
    min-height: 20px;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #475569;
}

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

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

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

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

.btn-outline:hover:not(:disabled) {
    background: var(--bg-card-hover);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 8px;
    min-width: 36px;
}

/* === Main Layout === */
#main-app {
    display: flex;
    min-height: 100vh;
}

/* === Sidebar === */
#sidebar {
    width: var(--sidebar-width);
    background: var(--bg-darker);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-light);
}

.nav-menu {
    list-style: none;
    padding: 16px 0;
    flex: 1;
    overflow-y: auto;
}

.nav-menu li {
    margin: 2px 8px;
}

.nav-link {
    display: block;
    padding: 12px 16px;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

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

.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.user-info span {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === Main Content === */
#content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    min-height: 100vh;
    background: var(--bg-dark);
}

.page-content {
    max-width: 1400px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
}

/* === Cards === */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
}

.card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-card.success {
    border-color: var(--success);
}

.stat-card.warning {
    border-color: var(--warning);
}

.stat-card.error {
    border-color: var(--error);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon::before {
    content: '';
    width: 24px;
    height: 24px;
    background-size: contain;
    background-repeat: no-repeat;
    filter: brightness(0) invert(1);
    opacity: 0.7;
}

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

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* === Dashboard Grid === */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.chart-container {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* Fix for chart.js canvas growing issue */
.card canvas,
.chart-card canvas {
    max-height: 250px !important;
}

.chart-card {
    position: relative;
    min-height: 280px;
}

.list-container {
    max-height: 250px;
    overflow-y: auto;
}

.list-item {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background: var(--bg-card-hover);
}

/* === Filters === */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input {
    min-width: 250px;
}

.filter-select {
    min-width: 150px;
}

/* === Tables === */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}

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

thead {
    background: var(--bg-darker);
}

th {
    text-align: left;
    padding: 14px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* === Status Badges === */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-online, .status-completed, .status-ok {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.status-online::before, .status-completed::before, .status-ok::before {
    background: var(--success);
}

.status-warning, .status-pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-warning::before, .status-pending::before {
    background: var(--warning);
}

.status-offline, .status-failed, .status-critical {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.status-offline::before, .status-failed::before, .status-critical::before {
    background: var(--error);
}

.status-running {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-light);
}

.status-running::before {
    background: var(--primary-light);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* === Tabs === */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    transition: all 0.2s;
    position: relative;
}

.tab-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary-light);
    background: var(--bg-card);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.tab-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
}

/* === Modal === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.2s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: scale(1);
    transition: transform 0.2s;
}

.modal.hidden .modal-content {
    transform: scale(0.95);
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

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

#modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-darker);
}

/* === Toast Notifications === */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 300px;
    max-width: 450px;
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.warning {
    border-left-color: var(--warning);
}

.toast.error {
    border-left-color: var(--error);
}

.toast-message {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* === Server Details === */
.server-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.metric-box {
    background: var(--bg-dark);
    padding: 16px;
    border-radius: var(--radius-md);
    text-align: center;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.metric-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* === Progress Bar === */
.progress {
    height: 8px;
    background: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s;
}

.progress-bar.warning {
    background: var(--warning);
}

.progress-bar.critical {
    background: var(--error);
}

/* === Actions Cell === */
.actions {
    display: flex;
    gap: 8px;
}

.actions .btn {
    padding: 6px 10px;
}

/* === Security Page === */
.ip-list {
    max-height: 400px;
    overflow-y: auto;
}

.ip-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.ip-entry:last-child {
    border-bottom: none;
}

.ip-address {
    font-family: monospace;
    font-size: 14px;
}

.ip-reason {
    color: var(--text-muted);
    font-size: 13px;
}

/* === Log Page === */
.log-entry {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-family: monospace;
    font-size: 13px;
}

.log-entry:hover {
    background: var(--bg-card-hover);
}

.log-level {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-right: 10px;
}

.log-level.error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.log-level.warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.log-level.info {
    background: rgba(6, 182, 212, 0.2);
    color: var(--info);
}

.log-time {
    color: var(--text-muted);
    margin-right: 10px;
}

.log-device {
    color: var(--primary-light);
    margin-right: 10px;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    margin-bottom: 20px;
}

/* === Code Block === */
.code-block {
    background: var(--bg-darker);
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    overflow-x: auto;
    border: 1px solid var(--border);
}

/* === Responsive === */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    #sidebar.open {
        transform: translateX(0);
    }

    #content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .server-metrics {
        grid-template-columns: 1fr 1fr;
    }

    .filters {
        flex-direction: column;
    }

    .search-input,
    .filter-select {
        min-width: 100%;
    }
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* === Checkbox & Radio === */
input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* === Spinner === */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-muted);
}

/* === Tooltip === */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: var(--bg-darker);
    color: var(--text-primary);
    font-size: 12px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 100;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* === Form Modal === */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 500px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* === Settings Page === */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* === Badges === */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: var(--primary);
    color: white;
}

.badge-secondary {
    background: var(--secondary);
    color: white;
}

.badge-success {
    background: var(--success);
    color: white;
}

.badge-warning {
    background: var(--warning);
    color: black;
}

.badge-danger {
    background: var(--error);
    color: white;
}

/* === Nav Separator === */
.nav-separator {
    margin: 16px 20px;
    border-top: 1px solid var(--border);
}

/* === Admin Only === */
.admin-only {
    opacity: 0.9;
}

.admin-only::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--warning);
    border-radius: 50%;
    margin-left: 8px;
    vertical-align: middle;
}

/* === Alerts === */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--warning);
    color: var(--warning);
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--error);
    color: var(--error);
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-info {
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid var(--info);
    color: var(--info);
}

.alert strong {
    display: block;
    margin-bottom: 8px;
}

/* === Geo-Blocking Specific === */
.country-checkbox:hover {
    background: var(--bg-card-hover) !important;
}

.country-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* === Fail2Ban Specific === */
.jail-card {
    background: var(--bg-card);
}

.jail-card h5 {
    color: var(--text-primary);
}

/* === Badge Icon Button === */
.btn-icon {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    line-height: 1;
}

.btn-icon:hover {
    opacity: 0.7;
}

/* === Warning Background === */
.bg-warning {
    background: rgba(245, 158, 11, 0.1) !important;
    border: 1px solid var(--warning);
}

/* === Log Viewer === */
.log-viewer {
    background: var(--bg-darker);
    border-radius: var(--radius-md);
    padding: 16px;
    max-height: 600px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
}

.log-line {
    padding: 4px 8px;
    border-radius: 2px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

.log-line:hover {
    background: rgba(255, 255, 255, 0.05);
}

.log-line-error {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--error);
}

.log-line-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid var(--warning);
}

.log-line-info {
    border-left: 3px solid transparent;
}

.log-line-debug {
    opacity: 0.6;
    border-left: 3px solid var(--secondary);
}

.log-timestamp {
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 150px;
}

.log-level {
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    text-transform: uppercase;
    min-width: 50px;
    text-align: center;
}

.log-level-error {
    background: var(--error);
    color: white;
}

.log-level-warning {
    background: var(--warning);
    color: black;
}

.log-level-info {
    background: var(--info);
    color: white;
}

.log-level-debug {
    background: var(--secondary);
    color: white;
}

.log-source {
    color: var(--primary-light);
    font-weight: 500;
    min-width: 100px;
}

.log-message {
    color: var(--text-primary);
    flex: 1;
    word-break: break-word;
}

/* Log Stats */
.log-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.log-stat-error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.log-stat-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.log-stat-info {
    background: rgba(6, 182, 212, 0.2);
    color: var(--info);
}

.log-stat-count {
    font-weight: 700;
}

/* Card Header */
.card-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

/* IP with Flag */
.ip-with-flag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ip-flag {
    width: 16px;
    height: 12px;
    border-radius: 2px;
    box-shadow: 0 0 1px rgba(0,0,0,0.3);
}

.ip-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
    align-items: center;
}

.ip-entry.pending {
    border-left: 3px solid var(--warning);
}

/* Global Bans Styles */
.global-bans-header .stats-grid {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 768px) {
    .global-bans-header .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Server Grid Cards */
.server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.server-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
}

.server-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.server-card.offline {
    opacity: 0.7;
    border-left: 3px solid var(--error);
}

.server-card.warning {
    border-left: 3px solid var(--warning);
}

.server-card.online {
    border-left: 3px solid var(--success);
}

.server-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
}

.server-info {
    flex: 1;
    min-width: 0;
}

.server-hostname {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.server-ip {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-left: 10px;
}

.status-indicator.status-online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-indicator.status-offline {
    background: var(--error);
}

.status-indicator.status-warning {
    background: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

.status-indicator.status-unknown {
    background: var(--text-muted);
}

.server-card-body {
    padding: 16px;
}

.server-metrics {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.usage-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.usage-label {
    font-size: 11px;
    color: var(--text-muted);
    width: 32px;
    text-transform: uppercase;
}

.usage-bar-container {
    flex: 1;
    height: 6px;
    background: var(--bg-darker);
    border-radius: 3px;
    overflow: hidden;
}

.usage-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.usage-bar-ok {
    background: var(--success);
}

.usage-bar-warning {
    background: var(--warning);
}

.usage-bar-critical {
    background: var(--error);
}

.usage-value {
    font-size: 12px;
    font-weight: 600;
    width: 40px;
    text-align: right;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.usage-value.ok {
    color: var(--success);
}

.usage-value.warning {
    color: var(--warning);
}

.usage-value.critical {
    color: var(--error);
}

.server-meta {
    display: flex;
    gap: 15px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.meta-item {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta-item i {
    font-style: normal;
}

.server-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-darker);
    border-top: 1px solid var(--border);
}

.last-seen {
    font-size: 11px;
    color: var(--text-muted);
}

.server-actions {
    display: flex;
    gap: 6px;
}

.btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
}

.btn-icon.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--error);
}

/* Server Detail Metrics */
.metric-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.metric-card:hover {
    border-color: var(--primary);
}

.metric-card.ok {
    border-left: 4px solid var(--success);
}

.metric-card.warning {
    border-left: 4px solid var(--warning);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(245, 158, 11, 0.1) 100%);
}

.metric-card.critical {
    border-left: 4px solid var(--error);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(239, 68, 68, 0.1) 100%);
}

.metric-icon {
    font-size: 28px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darker);
    border-radius: var(--radius-md);
}

.metric-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-bar-container {
    height: 8px;
    background: var(--bg-darker);
    border-radius: 4px;
    overflow: hidden;
}

.metric-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.metric-bar-ok {
    background: linear-gradient(90deg, var(--success), #34d399);
}

.metric-bar-warning {
    background: linear-gradient(90deg, var(--warning), #fbbf24);
}

.metric-bar-critical {
    background: linear-gradient(90deg, var(--error), #f87171);
}

.metric-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-card.ok .metric-value {
    color: var(--success);
}

.metric-card.warning .metric-value {
    color: var(--warning);
}

.metric-card.critical .metric-value {
    color: var(--error);
}

.metric-value-large {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Server Detail Header */
#page-server-detail .page-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

#page-server-detail .page-header h1 {
    flex: 1;
    margin: 0;
}

/* Server Tabs Styling */
.server-tabs {
    margin: 24px 0;
    border-bottom: 2px solid var(--border);
    display: flex;
    gap: 4px;
    overflow-x: auto;
}

.server-tabs .tab-btn {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.server-tabs .tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.server-tabs .tab-btn.active {
    color: var(--primary);
}

.server-tabs .tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

@media (max-width: 900px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}
