/* Login Form Styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e1e1e 0%, #2a2a2a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-container {
    background: #2d2d2d;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    min-width: 400px;
    text-align: center;
    border: 1px solid #3a3a3a;
}

.login-header h2 {
    color: #ffffff;
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 600;
}

.login-header p {
    color: #b0b0b0;
    margin: 0 0 30px 0;
    font-size: 14px;
}

.login-form {
    width: 100%;
}

.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

#password-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #3a3a3a;
    background: #1a1a1a;
    color: #ffffff;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#password-input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

#password-input::placeholder {
    color: #666666;
}

#login-btn {
    padding: 12px 24px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
    min-width: 80px;
}

#login-btn:hover {
    background: #357abd;
    transform: translateY(-1px);
}

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

#login-btn:disabled {
    background: #666666;
    cursor: not-allowed;
    transform: none;
}

.error-message {
    color: #ff6b6b;
    font-size: 13px;
    margin-top: 8px;
    text-align: center;
    background: rgba(255, 107, 107, 0.1);
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid rgba(255, 107, 107, 0.2);
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #121212; /* Dark background */
    color: #e0e0e0; /* Light text */
    overflow-x: hidden;
}
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px;
    box-sizing: border-box;
    overflow-x: hidden;
}
header {
    background-color: #1f1f1f; /* Darker header background */
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-size: 24px;
    font-weight: bold;
}
.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}
.source-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 10;
}
.source-selector label {
    font-weight: bold;
    color: #e0e0e0; /* Light text */
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}
/* 单选按钮组替代了下拉选择 */
.source-radio-group {
    display: flex;
    gap: 6px;
    background-color: rgba(255, 255, 255, 0.1); /* Lighter background for contrast */
    padding: 3px;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.05);
}
.source-radio-group label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8); /* Brighter text for readability */
    transition: all 0.2s ease-out;
    font-size: 13px;
    min-width: 36px;
    text-align: center;
    position: relative;
    overflow: hidden;
    user-select: none;
}
.source-radio-group label:hover {
    background-color: rgba(255, 255, 255, 0.2); /* Lighter hover */
    color: white;
}
.source-radio-group label:active {
    transform: scale(0.95);
}
.source-radio-group input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.source-radio-group input[type="radio"]:checked + label,
.source-radio-group label:has(input[type="radio"]:checked) {
    background-color: #007bff; /* Adjusted primary color for dark theme */
    color: white;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.5); /* Adjusted shadow */
    font-weight: 500;
}
.source-radio-group input[type="radio"]:checked + label::after,
.source-radio-group label:has(input[type="radio"]:checked)::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 70%);
    opacity: 0;
    animation: fadeInOut 2s infinite;
}
@keyframes fadeInOut {
    0% { opacity: 0; }
    50% { opacity: 0.4; }
    100% { opacity: 0; }
}
.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
    width: 100%;
    overflow: visible;
}
.stat-card {
    background-color: #1e1e1e; /* Dark card background */
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3); /* Adjusted shadow for dark theme */
    padding: 15px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid #333; /* Subtle border */
}
.stat-card h3 {
    margin-top: 0;
    color: #e0e0e0; /* Light text for card headers */
    border-bottom: 1px solid #333; /* Darker border */
    padding-bottom: 10px;
}
.filter-bar {
    background-color: #2c2c2c; /* Darker filter bar */
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
}
.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.filter-item {
    display: flex;
    align-items: center;
    margin-bottom: 0;
}
.filter-item label {
    margin-right: 5px;
    font-weight: bold;
    font-size: 0.85rem;
    color: #cccccc; /* Light gray for labels */
}
.filter-item select {
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #444; /* Darker border for select */
    background-color: #333; /* Dark background for select */
    color: #e0e0e0; /* Light text for select */
    font-size: 0.85rem;
}
.filter-actions {
    display: flex;
    align-items: center;
}
.server-list {
    /* background-color: white; */
    /* border-radius: 8px; */
    /* box-shadow: 0 2px 4px rgba(0,0,0,0.1); */
    background-color: transparent; /* Keep transparent */
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 20px;
    overflow-x: auto;
    width: 100%;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}
.batch-actions {
    background-color: #2c2c2c; /* Darker background */
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 0;
    display: flex;
    gap: 8px;
    align-items: center;
}
.batch-actions-label {
    font-weight: bold;
    margin-right: 8px;
    font-size: 0.85rem;
    color: #cccccc; /* Light gray for label */
}
table {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    margin: 0;
    padding: 0;
}
th {
    background-color: #2a2a2a; /* Darker table header */
    color: #e0e0e0; /* Light text for table header */
    padding: 12px 15px;
    text-align: left;
    cursor: pointer;
    position: relative;
    border-bottom: 1px solid #444; /* Border for header */
}
th:hover {
    background-color: #333333; /* Slightly lighter hover for header */
}
th.sorted-asc::after {
    content: "↑";
    opacity: 1;
}
th.sorted-desc::after {
    content: "↓";
    opacity: 1;
}
td {
    padding: 12px 15px;
    border-top: 1px solid #333; /* Darker border for table cells */
    color: #c0c0c0; /* Slightly dimmer text for table data */
}
tr:hover {
    background-color: #252525; /* Darker hover for rows - general fallback */
}
.checkbox-cell {
    width: 40px;
    text-align: center;
}
.status-badge, .attribute-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}
.status-running {
    background-color: #28a745; /* Keep green, adjust text if needed */
    color: #ffffff;
}
.status-stopped {
    background-color: #dc3545; /* Keep red, adjust text if needed */
    color: #ffffff;
}
/* Base status-warning style for Service Status area (text-only) */
.status-warning {
    color: #ffeb3b !important; /* Bright yellow for visibility on dark background */
    font-weight: bold;
    background-color: rgba(255, 235, 59, 0.12); /* Very subtle yellow background */
    padding: 2px 6px;
    border-radius: 3px;
}
/* Specific styling for status badges in tables (has background) */
.status-badge.status-warning, .attribute-badge.status-warning {
    background-color: #ffc107 !important; /* Yellow background for badge */
    color: #121212 !important; /* Dark text on yellow background */
    padding: 4px 8px; /* Override the base padding for badges */
    border-radius: 12px !important; /* Ensure pill shape consistent with other badges */
}
.status-info {
    background-color: #17a2b8; /* Keep info blue, adjust text if needed */
    color: #ffffff;
}
.load-indicator {
    width: 80px;
    height: 8px;
    background-color: #444; /* Darker background for load indicator */
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.load-bar {
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
}
.load-low {
    width: 30%;
    background-color: #28a745;
}
.load-medium {
    width: 60%;
    background-color: #ffc107;
}
.load-high {
    width: 90%;
    background-color: #dc3545;
}
.action-buttons {
    display: flex;
    gap: 5px;
}
.btn {
    padding: 6px 10px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 12px;
}
.btn-primary {
    background-color: #007bff;
    color: white;
}
.btn-primary:hover {
    background-color: #0056b3;
}
.btn-success {
    background-color: #28a745;
    color: white;
}
.btn-success:hover {
    background-color: #1e7e34;
}
.btn-danger {
    background-color: #dc3545;
    color: white;
}
.btn-danger:hover {
    background-color: #b02a37;
}
.btn-warning {
    background-color: #ffc107;
    color: #212529; /* Keep dark text for warning button */
}
.btn-warning:hover {
    background-color: #d39e00;
}
.btn-secondary {
    background-color: #6c757d;
    color: white;
}
.btn-secondary:hover {
    background-color: #545b62;
}
.btn-orange {
    background-color: #ff6b35;
    color: white;
}
.btn-orange:hover {
    background-color: #e55a2b;
}
.btn-purple {
    background-color: #8e44ad;
    color: white;
}
.btn-purple:hover {
    background-color: #7d3c98;
}
.detail-view {
    background-color: #1e1e1e; /* Dark background for detail view */
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3); /* Adjusted shadow */
    padding: 20px;
    margin-top: 20px;
    display: block;
    border: 1px solid #333; /* Subtle border */
}
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #333; /* Darker border */
}
.detail-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}
.detail-group h4 {
    margin-top: 0;
    color: #bbbbbb; /* Lighter gray for group headers */
    border-bottom: 1px solid #333; /* Darker border */
    padding-bottom: 5px;
}
.detail-item {
    margin-bottom: 10px;
}
.detail-label {
    font-weight: bold;
    display: block;
    margin-bottom: 3px;
    color: #cccccc; /* Light gray for labels */
}
.checkbox-custom {
    width: 18px;
    height: 18px;
    cursor: pointer;
}
.stats-legend {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 10px;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    background-color: transparent; /* Ensure legend area itself is transparent */
}

/* Target common elements ANYWHERE within stats-legend that might have their own background */
.stats-legend div,
.stats-legend span,
.stats-legend p,
.stats-legend li,
.stats-legend a,
.stats-legend label { /* For legend items that might be links or labels */
    background-color: transparent; /* Override potential white backgrounds */
    color: #e0e0e0; /* Explicitly set light text color, matching parent card */
    border-color: #444; /* Adjust border color if they have one to be dark-theme friendly */
    /* If items have specific classes setting background, those might need direct targeting or !important */
}

/* 添加旋转动画关键帧 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Styles for the card components */
.metrics-card,
.service-status-card,
.stats-dashboard-card,
.filter-card,
.actions-card,
.server-list-card {
    background-color: #1e1e1e; /* Dark card background */
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); /* Adjusted shadow */
    padding: 12px;
    margin-bottom: 15px;
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
    max-width: 100%;
    border: 1px solid #333; /* Subtle border */
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    position: relative;
}

/* Color variations for different card types */
.service-status-card {
    background-color: #232323; /* Slightly different dark shade */
    /* border-left: 4px solid #4e73df; */ /* Consider removing or changing color for dark theme */
    position: relative;
    z-index: 5;
}

.metrics-card {
    /* border-left: 4px solid #1cc88a; */
    position: relative;
    z-index: 10;
}

.stats-dashboard-card {
    /* border-left: 4px solid #f6c23e; */
}

.filter-card {
    /* border-left: 4px solid #36b9cc; */
}

.actions-card {
    /* border-left: 4px solid #e74a3b; */
}

.server-list-card {
    /* border-left: 4px solid #6f42c1; */
    background-color: transparent; /* Keep transparent */
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    border: none; /* Remove border for transparent card */
}

.metrics-container {
    overflow-x: auto;
    width: 100%;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 10;
}

.metrics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.metrics-table th,
.metrics-table td {
    border: 1px solid #333; /* Darker border */
    padding: 8px 12px;
    text-align: right;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.metrics-table th:first-child,
.metrics-table td:first-child {
    text-align: left;
    font-weight: 500;
}

.metrics-table th {
    background-color: #2a2a2a; /* Darker header */
    font-weight: 600;
    color: #e0e0e0; /* Light text */
}

.metrics-table tr:nth-child(even) {
    background-color: #252525; /* Slightly different dark for even rows */
}

.metrics-table tr:hover {
    background-color: #303030; /* Darker hover */
}

/* 服务状态卡片样式 */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    padding-bottom: 0;
}

.card-header h3,
.metrics-card h3,
.stats-dashboard-card h3,
.filter-card h3,
.actions-card h3,
.server-list-card h3 {
    margin: 0;
    color: #e0e0e0; /* Light text for card headers */
    padding-bottom: 3px;
    border-bottom: none;
    font-size: 1.1rem;
}

.toggle-details-btn {
    background-color: #333; /* Dark background for button */
    color: #007bff; /* Blue text, or a lighter color */
    border: 1px solid #444; /* Darker border */
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.toggle-details-btn:hover {
    background-color: #444; /* Lighter dark on hover */
}

.toggle-details-btn:active {
    background-color: #555; /* Even lighter on active */
}

.toggle-details-btn:after {
    content: '▼';
    font-size: 0.7rem;
    margin-left: 5px;
}

.toggle-details-btn.active:after {
    content: '▲';
}

.service-status-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.service-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 5px;
    background-color: #2c2c2c; /* Darker row background */
    border-radius: 5px;
    border: 1px solid #444; /* Darker border */
    padding: 10px;
    overflow: visible;
    width: 100%;
    box-sizing: border-box;
}

.details-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
    max-height: 500px;
    opacity: 1;
    overflow: visible;
}

.details-section.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    margin-bottom: 0;
    overflow: hidden;
    pointer-events: none;
    visibility: hidden;
}

.service-status-item {
    flex: 1;
    min-width: 150px;
    margin-bottom: 5px;
}

.service-status-item.full-width {
    min-width: unset;
    width: 100%;
    overflow: visible;
    box-sizing: border-box;
}

.status-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #aaaaaa; /* Lighter gray for status labels */
    margin-bottom: 3px;
}

.status-value {
    font-size: 0.85rem;
    color: #d0d0d0; /* Light gray for status values */
    font-weight: 500;
}

/* 确保 Other Instances 和 Schedule 独立滚动 */
#other-instances-container, 
#schedule-container {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: visible;
    border: 1px solid #444; /* Darker border */
    padding: 5px;
    border-radius: 4px;
    width: 100%;
    min-width: unset;
    box-sizing: border-box;
    margin-top: 5px;
    background-color: #252525; /* Dark background */
}

.schedule-item {
    display: flex;
    align-items: center;
    background-color: #232323; /* Dark background for schedule items */
    border-radius: 5px;
    padding: 4px 6px;
    font-size: 0.85rem;
    /* 移除左侧高亮竖条 */
    border-left: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15); /* Adjusted shadow */
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    white-space: normal;
    width: auto; /* 修复宽度问题 */
}

.schedule-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 5px rgba(0,0,0,0.25); /* Adjusted shadow */
}

.schedule-date {
    font-weight: 600;
    color: #aaaaaa; /* Lighter gray */
    margin-right: 8px;
    flex-shrink: 0;
    min-width: 70px;
    display: inline-block;
}

.schedule-user {
    color: #d0d0d0; /* Light gray */
    font-weight: 500;
    flex: 1;
    word-break: break-word;
}

.schedule-item.current-user {
    background-color: #2d5a2d !important; /* Dark green background for current user */
    border: 2px solid #28a745 !important; /* Green border */
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3) !important; /* Green glow */
}

.schedule-item.current-user .schedule-user {
    color: #90ee90 !important; /* Light green text for current user */
    font-weight: bold;
}

.schedule-item.current-user .schedule-date {
    color: #b8e6b8 !important; /* Light green for date */
}

/* 状态文本样式 */
.status-success {
    color: #28a745 !important; /* Keep green */
    font-weight: bold;
}

.status-danger {
    color: #dc3545 !important; /* Keep red */
    font-weight: bold;
}

.status-warning {
    color: #ffc107 !important; /* Keep yellow */
    font-weight: bold;
}

.time-error {
    color: #dc3545 !important; /* Red color for time errors */
    font-weight: bold;
}


/* Other Instances 样式 */
.instances-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
    width: 100%;
    overflow: visible;
    min-width: unset;
}

.instance-badge {
    display: inline-flex;
    align-items: center;
    background-color: #333; /* Darker badge background */
    border-radius: 5px;
    padding: 6px 10px;
    font-size: 0.85rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15); /* Adjusted shadow */
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    /* 移除左侧高亮竖条 */
    border-left: none;
    width: auto;
    color: #e0e0e0; /* Light text for badge */
}

.instance-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 5px rgba(0,0,0,0.25); /* Adjusted shadow */
}

.instance-name {
    font-weight: 600;
    color: #e0e0e0; /* Light text */
}

.instance-count {
    margin-left: 8px;
    background-color: #007bff; /* Primary blue for count */
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: bold;
}

/* 内联详情视图样式 */
.inline-detail-view {
    padding: 20px;
    background-color: #232323; /* Darker background for inline detail */
    border-left: 4px solid #007bff; /* Blue accent, or choose another */
    margin: 10px 5px 20px 5px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); /* Adjusted shadow */
    cursor: auto;
}

.inline-detail-view .detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #444; /* Darker border */
    padding-bottom: 10px;
}

.inline-detail-view .detail-header h3 {
    margin: 0;
    color: #e0e0e0; /* Light text */
    font-size: 1.25rem;
}

.inline-detail-view .detail-content {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    user-select: text;
}

.inline-detail-view .detail-group {
    background-color: #2c2c2c; /* Darker group background */
    border-radius: 5px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); /* Adjusted shadow */
    flex: 1 1 220px;
    min-width: 220px;
}

.inline-detail-view .detail-group h4 {
    margin-top: 0;
    color: #0095ff; /* Lighter blue for group titles */
    border-bottom: 1px solid #444; /* Darker border */
    padding-bottom: 8px;
    margin-bottom: 12px;
    font-size: 1rem;
}

/* 展开行的样式 */
#server-table tbody tr.shown {
    background-color: #2a2a2a; /* Darker background for shown rows */
}

/* 添加箭头指示器 */
#server-table tbody tr:not(.child) {
    cursor: pointer;
    position: relative;
}


/* 移动设备响应式设计 */
@media (max-width: 768px) {
    header {
        padding: 10px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .header-controls {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .source-selector {
        width: 100%;
        margin: 0;
    }
    
    .user-controls {
        width: 100%;
        justify-content: flex-start;
    }
    
    .stats-dashboard {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    #server-table {
        font-size: 0.75rem;
        overflow-x: auto;
        display: block;
        white-space: nowrap;
    }
    
    .service-status-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .service-status-item {
        margin-bottom: 10px;
        text-align: left;
        margin-left: 0;
    }
    
    /* 移动设备滚动提示 */
    .metrics-container::after {
        content: '← 滑动查看更多 →';
        display: block;
        text-align: center;
        font-size: 0.8rem;
        color: #aaaaaa;
        margin-top: 5px;
        font-style: italic;
    }
    
    .server-list::after {
        content: '← 滑动查看更多列 →';
        display: block;
        text-align: center;
        font-size: 0.8rem;
        color: #aaaaaa;
        margin-top: 5px;
        font-style: italic;
    }
}

/* 滚动容器通用样式 */
.metrics-container, 
.server-list {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    box-sizing: border-box;
}

.service-status-item.full-width, 
.schedule-container, 
.instances-container {
    overflow-x: visible;
    width: 100%;
}

/* 确保details section在移动设备上可滚动查看 */
.details-section:not(.collapsed) {
    max-height: unset;
    overflow-x: auto;
}

/* Properties显示样式 */
.property-item {
    padding: 3px 0;
    border-bottom: 1px dashed #444; /* Darker dashed border */
}

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

.property-key {
    font-weight: 600;
    color: #0095ff; /* Lighter blue for property keys */
    margin-right: 5px;
}

.property-value {
    color: #d0d0d0; /* Light gray for property values */
}

/* JSON格式化样式 */
.detail-item span:has(br) {
    font-family: monospace;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow-x: auto;
    display: block;
    max-height: 150px;
    overflow-y: auto;
    background-color: #2c2c2c; /* Darker background for JSON */
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #444; /* Darker border */
    color: #e0e0e0; /* Light text for JSON */
}

/* 为所有表格添加水平滚动能力 */
table {
    min-width: 100%;
}

/* 为stat-card内部内容添加响应式设计 */
.stats-legend {
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* 替换auto-fill为auto-fit以更好地填充可用空间 */
@media (min-width: 1400px) {
    .stats-dashboard {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .container {
        padding: 20px;
    }
    
    /* 在大屏幕上移除表格的最小宽度，让它填充可用空间 */
    #server-table {
        min-width: 0;
        table-layout: auto;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .stats-dashboard {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .stats-dashboard {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 修复服务器列表表格滚动问题 */
.server-list {
    overflow-x: auto;
    width: 100%;
    box-sizing: border-box;
}

#server-table {
    width: 100%;
    min-width: 900px;
    box-sizing: border-box;
}

/* 让表格列宽自动适应内容 */
#server-table th {
    white-space: nowrap;
    box-sizing: border-box;
}

#server-table td {
    white-space: normal;
    box-sizing: border-box;
    border-top: none; /* This was the original line color and style */
    border-bottom: 1px solid #444; /* Darker border for table rows */
    border-left: none;
    border-right: none;
    color: #d0d0d0; /* Light text color for server list items */
}

/* Server table row striping - similar to metrics table */
#server-table tbody tr {
    background-color: #1f1f1f; /* Default dark background for odd rows */
}

#server-table tbody tr:nth-child(even) {
    background-color: #252525; /* Slightly different dark for even rows */
}

/* Override general hover for server table */
#server-table tbody tr:hover {
    background-color: #303030; /* Darker hover effect */
}

/* Ensure expanded detail rows don't interfere with striping */
#server-table tbody tr.child {
    background-color: #232323 !important; /* Dark background for detail rows */
}

#server-table tbody tr.child:hover {
    background-color: #2a2a2a !important; /* Slightly lighter on hover for detail rows */
}

/* Ensure table itself and headers have no borders */
#server-table,
#server-table th {
    border: none;
}

/* 移除宽度限制，让容器自适应可用空间 */
.service-status-item.full-width {
    min-width: unset;
    width: 100%;
    overflow: visible;
}

/* 移除Schedule容器的最小宽度和嵌套滚动 */
.schedule-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 6px;
    margin-top: 5px;
    width: 100%;
    box-sizing: border-box;
}

/* 确保实例容器不限制宽度 */
.instances-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
    width: 100%;
    overflow: visible;
    min-width: unset;
}

/* 修复滚动容器通用样式 */
.metrics-container, 
.server-list {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    box-sizing: border-box;
}

/* 确保溢出容器内的内容不会导致水平滚动 */
#other-instances-container,
#schedule-container {
    width: 100%;
    overflow: visible;
    box-sizing: border-box;
    min-width: unset;
    background-color: transparent; /* Transparent as wrapper has color */
}

/* 清除重复的服务器表格样式 */
#server-table {
    width: 100%;
    min-width: 900px; /* 较小屏幕时允许滚动 */
    max-width: 100%; /* 大屏幕时不强制最小宽度 */
    box-sizing: border-box;
    table-layout: fixed; /* 使表格更好地适应可用空间 */
}

@media (min-width: 1400px) {
    /* 在大屏幕上移除表格的最小宽度，让它填充可用空间 */
    #server-table {
        min-width: 0;
        table-layout: auto;
    }
}

/* Service Status area specific status-warning styling */
.service-status-item .status-warning,
#service-state.status-warning {
    color: #ffeb3b !important; /* Brighter yellow for better visibility on dark background */
    font-weight: bold;
    background-color: rgba(255, 235, 59, 0.12); /* Very subtle yellow background for better contrast */
    padding: 2px 6px;
    border-radius: 3px;
}

/* Highlight styles for low bandwidth values */
.low-bandwidth {
    background-color: #ffc107; /* Yellow background like btn-warning */
    color: #212529 !important; /* Dark text like btn-warning */
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Loading indicator styles optimized for dark mode */
#loading-indicator {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(18, 18, 18, 0.85); /* Dark semi-transparent background */
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

#loading-indicator .loading-content {
    text-align: center;
}

#loading-indicator .spinner {
    border: 5px solid #333; /* Dark border for spinner */
    border-top: 5px solid #007bff; /* Blue accent color */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 2s linear infinite;
    margin: 0 auto;
}

#loading-indicator .loading-text {
    margin-top: 10px;
    font-weight: 500;
    font-size: 16px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
}

.modal-content {
    background-color: #2c2c2c;
    margin: 10% auto;
    padding: 0;
    border-radius: 8px;
    width: 600px;
    max-width: 90%;
    color: #e0e0e0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

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

.modal-header h4 {
    margin: 0;
    color: #e0e0e0;
}

.close {
    color: #aaa;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #fff;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 24px;
    border-top: 1px solid #444;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #e0e0e0;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 14px;
    background-color: #3c3c3c;
    color: #e0e0e0;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.radio-item input[type="radio"] {
    margin: 0;
}

.radio-item label {
    margin: 0;
    cursor: pointer;
    font-weight: normal;
}

/* Properties form styles */
.properties-container {
    display: flex;
    gap: 20px;
    align-items: flex-end;
}

.property-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 120px;
}

.property-item label {
    font-weight: bold;
    color: #e0e0e0;
    margin-bottom: 0;
}

.property-select {
    background-color: #444;
    border: 1px solid #555;
    color: #e0e0e0;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
}

.attribute-value-group {
    display: none;
}

.attribute-value-group.show {
    display: block;
}

/* Progress Modal Styles */
.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #444;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background-color: #28a745;
    transition: width 0.3s ease;
}

/* Progress details container with scrolling */
#progress-details {
    max-height: 350px; /* Increased height for better space utilization */
    overflow-y: auto;
    border: 1px solid #444;
    border-radius: 4px;
    background: #3c3c3c;
    margin-top: 10px;
}

.progress-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #444;
}

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

.progress-server-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    margin-right: 12px;
}

.progress-server-main {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-icon {
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.progress-server-ip {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #0095ff;
    font-size: 14px;
    margin-right: 8px;
}

.progress-server-main .status-badge, .progress-server-main .attribute-badge {
    font-size: 10px;
    padding: 2px 6px;
    margin-left: auto; /* Push to the right within the main row */
}

.progress-server-details {
    font-size: 11px;
    color: #b0b0b0;
    font-style: italic;
    margin-left: 26px; /* Align with IP address (icon width + gap) */
}

/* Progress details scrollbar styling for dark theme */
#progress-details::-webkit-scrollbar {
    width: 8px;
}

#progress-details::-webkit-scrollbar-track {
    background: #2c2c2c;
    border-radius: 4px;
}

#progress-details::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

#progress-details::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Server list in confirmation modal */
.server-list-container {
    margin: 10px 0;
    border: 1px solid #555;
    border-radius: 4px;
    background: #3c3c3c;
}

.server-list-container.scrollable {
    max-height: 300px; /* Increased height to match wider modal */
    overflow-y: auto;
}

.server-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.server-item {
    border-bottom: 1px solid #555;
}

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

.server-info {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #e0e0e0;
}

.server-main-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.server-ip {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #0095ff;
    font-size: 14px;
}

.server-details {
    font-size: 12px;
    color: #b0b0b0;
    font-style: italic;
}

.server-status {
    font-size: 0.85em;
    margin-left: 12px;
    flex-shrink: 0;
}

/* Scrollbar styling for dark theme */
.server-list-container.scrollable::-webkit-scrollbar {
    width: 8px;
}

.server-list-container.scrollable::-webkit-scrollbar-track {
    background: #2c2c2c;
    border-radius: 4px;
}

.server-list-container.scrollable::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.server-list-container.scrollable::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Utilities */
.progress-status {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    flex-shrink: 0;
}

.status-completed { 
    background: #d4edda; 
    color: #155724; 
}

.status-processing { 
    background: #cce5ff; 
    color: #004085; 
}

.status-pending { 
    background: #fff3cd; 
    color: #856404; 
}

.status-failed { 
    background: #f8d7da; 
    color: #721c24; 
}

.status-cancelled {
    background: #d1ecf1;
    color: #0c5460;
}

/* Create Instance Styles */
.instance-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #333;
}

.instance-actions-label {
    font-weight: bold;
    color: #e0e0e0;
    margin-right: 10px;
}

/* Create Instance Confirmation Styles */
.create-instance-params {
    text-align: left;
}

.create-instance-params h5 {
    margin: 0 0 15px 0;
    color: #e0e0e0;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
}

.param-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 20px;
    margin-bottom: 15px;
}

.param-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.param-label {
    font-weight: bold;
    color: #b0b0b0;
    min-width: 120px;
}

.param-value {
    color: #e0e0e0;
    text-align: right;
    font-family: monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

.create-instance-note {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 4px;
    padding: 10px;
    margin-top: 15px;
}

.create-instance-note p {
    margin: 0;
    color: #ffc107;
    font-size: 0.9em;
}

/* Responsive Design for Param Grid */
@media (max-width: 768px) {
    .param-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* Create Instance Form Optimizations */
.form-group-inline {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.form-group-inline label {
    display: block;
    margin-bottom: 0;
    font-weight: 500;
    color: #e0e0e0;
    min-width: 140px;
    flex-shrink: 0;
}

.form-group-inline .form-control {
    flex: 1;
    min-width: 200px;
}

.radio-group-inline {
    display: flex;
    flex-direction: row;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-group-inline .radio-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* Compact modal for create instance */
.create-instance-modal .modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

.create-instance-modal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
    padding: 15px 20px;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .form-group-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .form-group-inline label {
        min-width: auto;
    }

    .radio-group-inline {
        flex-direction: column;
        gap: 8px;
    }
} 