/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* 登录页面样式 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

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

.login-header h1 {
    font-size: 32px;
    color: #667eea;
    margin-bottom: 8px;
}

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

.login-form .form-group {
    margin-bottom: 20px;
}

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

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

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

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    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, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

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

/* 仪表板样式 */
.dashboard-container {
    min-height: 100vh;
    padding: 20px;
}

.dashboard-header {
    background: white;
    border-radius: 12px;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

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

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

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

.nav-link {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.3s;
}

.nav-link:hover {
    background: #e8ebfd;
}

.username {
    color: #333;
    font-weight: 500;
}

.btn-secondary {
    padding: 8px 20px;
    background: #f5f5f5;
    color: #333;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.dashboard-main {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

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

.btn-refresh {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f5f5f5;
    color: #667eea;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-refresh:hover {
    background: #e8ebfd;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.service-card {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.service-card h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 8px;
}

.service-port {
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
}

.service-status {
    display: inline-block;
    margin-top: 12px;
    padding: 4px 12px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state svg {
    margin-bottom: 20px;
    color: #ccc;
}

.empty-state h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 8px;
}

.empty-state .hint {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
    color: #667eea;
    display: inline-block;
    margin-top: 16px;
}

/* 端口列表页面样式 */
.ports-container {
    overflow-x: auto;
}

.port-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.port-table th {
    text-align: left;
    padding: 12px 16px;
    background: #f5f5f5;
    color: #333;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
}

.port-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e8e8e8;
    vertical-align: top;
}

.port-table tr:hover td {
    background: #f9f9ff;
}

.port-table tr.row-self td {
    background: #eef2ff;
    border-left: 3px solid #667eea;
}

.port-table tr.row-self:hover td {
    background: #e4eaff;
}

.port-number {
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
    white-space: nowrap;
}

.badge-self {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
}

.port-pids {
    font-family: "SF Mono", Menlo, monospace;
    font-size: 13px;
    color: #555;
    white-space: nowrap;
}

.port-command code {
    background: #f0f0f5;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: "SF Mono", Menlo, monospace;
    font-size: 12px;
    color: #333;
    display: inline-block;
    word-break: break-all;
}

.port-cwd {
    color: #888;
    font-size: 12px;
    font-family: "SF Mono", Menlo, monospace;
    word-break: break-all;
}

.port-actions {
    white-space: nowrap;
}

.btn-kill {
    padding: 6px 14px;
    background: #fee;
    color: #c33;
    border: 1px solid #f5c6c6;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-kill:hover {
    background: #fdd;
}

.btn-kill:active {
    transform: translateY(1px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

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

    .services-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}
