/* ===== Global Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f7fa;
    color: #333;
}

/* ===== Login Page Styles ===== */
body.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.login-page #app {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
}

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

.login-header h1 {
    color: #333;
    font-size: 24px;
    margin-bottom: 8px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

/* ===== Main Layout with Sidebar ===== */
.main-layout {
    display: flex;
    min-height: 100vh;
    padding-top: 64px; /* Header height */
}

.main-content {
    flex: 1;
    margin-left: 250px; /* Sidebar width */
    padding: 24px;
    transition: margin-left 0.3s;
}

/* ===== Header Styles ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    height: 64px;
}

.header-left h1 {
    font-size: 24px;
    color: #667eea;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.current-time {
    font-size: 14px;
    color: #666;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #f5f7fa;
    border-radius: 6px;
    font-size: 14px;
    color: #666;
}

/* ===== Buttons ===== */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-logout {
    background: #f44336;
    color: white;
}

.btn-logout:hover {
    background: #d32f2f;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-login:hover {
    transform: translateY(-2px);
}

.btn-login:active {
    transform: translateY(0);
}

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

.btn-refresh {
    background: #667eea;
    color: white;
}

.btn-refresh:hover {
    background: #5568d3;
}

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

.btn-start {
    background: #4caf50;
    color: white;
}

.btn-start:hover { background: #43a047; }

.btn-stop {
    background: #f44336;
    color: white;
}

.btn-stop:hover { background: #e53935; }

.btn-restart {
    background: #ff9800;
    color: white;
}

.btn-restart:hover { background: #fb8c00; }

.btn-logs {
    background: #2196f3;
    color: white;
}

.btn-logs:hover { background: #1976d2; }

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

.form-group label {
    display: block;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-success {
    background: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* ===== Container ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== System Stats ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.cpu { background: #e3f2fd; color: #1976d2; }
.stat-icon.memory { background: #f3e5f5; color: #7b1fa2; }
.stat-icon.disk { background: #e8f5e9; color: #388e3c; }

.stat-info h3 {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.stat-info p {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-top: 4px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    transition: width 0.5s;
    border-radius: 4px;
}

.progress-fill.low { background: #4caf50; }
.progress-fill.medium { background: #ff9800; }
.progress-fill.high { background: #f44336; }

/* ===== Services Section ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 20px;
    color: #333;
}

/* ===== Service Cards ===== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.service-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.service-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.service-title h3 {
    font-size: 16px;
    color: #333;
    margin: 0;
}

.service-title a {
    color: #667eea;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.service-title a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.service-title p {
    font-size: 12px;
    color: #666;
    margin: 0;
}

.service-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.service-port {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #e3f2fd;
    color: #1565c0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.service-port i {
    font-size: 10px;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-badge.running {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-badge.exited {
    background: #ffebee;
    color: #c62828;
}

.status-badge.paused {
    background: #fff3e0;
    color: #ef6c00;
}

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

.service-stats {
    display: flex;
    gap: 16px;
}

.service-stat {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.service-stat strong {
    color: #333;
    font-weight: 600;
}

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

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    font-size: 18px;
    color: #333;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
}

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

.logs-container {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 16px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 500px;
    overflow-y: auto;
}

/* ===== Loading ===== */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading i {
    font-size: 48px;
    color: #667eea;
    animation: spin 1s linear infinite;
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
    }

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

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

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

    .service-actions {
        flex-wrap: wrap;
    }

    .header-right {
        gap: 10px;
    }

    .current-time {
        display: none;
    }
}
