:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass: rgba(255, 255, 255, 0.05);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.15) 0px, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

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

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

/* Sidebar */
.sidebar {
    width: 280px;
    height: 100vh;
    position: fixed;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 3rem;
    background: linear-gradient(to right, #818cf8, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    background: var(--glass);
    color: var(--text-main);
}

.nav-link.active {
    background: rgba(99, 102, 241, 0.2);
    border-left: 4px solid var(--primary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
}

/* Cards */
.card {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.5s ease;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    outline: none;
    transition: border-color 0.3s;
}

input:focus, select:focus {
    border-color: var(--primary);
}

.btn {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

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

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

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

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

tr:hover {
    background: var(--glass);
}

/* Login Page */
.login-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
}

/* Notifications */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-success { background: rgba(16, 185, 129, 0.1); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.2); }
.alert-danger { background: rgba(239, 68, 68, 0.1); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.2); }

/* Ping Dashboard Specifics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.stat-card {
    text-align: center;
    padding: 0.75rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 2px;
}

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

.terminal-window {
    background: #000;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    font-family: 'Fira Code', 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: #a6acb9;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #333;
    position: relative;
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-bottom: 1px solid #222;
    padding-bottom: 5px;
}

.terminal-line {
    margin-bottom: 4px;
    line-height: 1.4;
}

.terminal-line .time { color: #5c6370; margin-right: 10px; }
.terminal-line .success { color: #98c379; }
.terminal-line .error { color: #e06c75; }
.terminal-line .info { color: #61afef; }
.terminal-line .warning { color: #d19a66; }

.badge-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
}
.badge-stopped { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.badge-running { background: rgba(16, 185, 129, 0.2); color: #34d399; }

/* Responsive Improvements */
@media (max-width: 992px) {
    .sidebar {
        width: 70px;
        padding: 1rem 0.5rem;
    }
    .sidebar .logo span, .nav-link span {
        display: none;
    }
    .main-content {
        margin-left: 70px;
        padding: 1rem;
    }
    .sidebar-footer span { display: none; }
}

@media (max-width: 600px) {
    .sidebar {
        width: 60px;
    }
    .main-content {
        margin-left: 60px;
        padding: 10px;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .card {
        padding: 1rem;
    }
    .header h1 {
        font-size: 1.2rem;
    }
    .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--bg-dark);
    margin: 5% auto;
    padding: 2rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    color: var(--text-muted);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

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

pre {
    background: #000;
    padding: 1.5rem;
    border-radius: 8px;
    color: #98c379;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    border: 1px solid #333;
}

.db-rename-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 5px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.7rem;
    background: transparent;
    border: none;
}
.db-rename-btn:hover { color: var(--primary); }
