/* --- 基本样式 --- */
:root {
    --primary: #7C3AED;
    --secondary: #4F46E5;
    --surface: rgba(255, 255, 255, 0.96);
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --button-text: white;
    --button-bg: linear-gradient(45deg, var(--primary), var(--secondary));
    --button-hover-shadow: 0 4px 8px rgba(124, 58, 237, 0.2);
    --button-disabled-bg: #D1D5DB; /* NEW: Disabled button background */
    --button-disabled-text: #9CA3AF; /* NEW: Disabled button text */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #F3E8FF 0%, #E0E7FF 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.main-container {
    width: 100%;
    max-width: 480px;
    background: var(--surface);
    border-radius: 1.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

/* --- 按钮通用样式 --- */
.action-button {
    position: absolute;
    top: 1rem;
    color: var(--button-text);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: var(--button-bg);
}

.action-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--button-hover-shadow);
}

.action-button:active:not(:disabled) {
    transform: translateY(0);
}

.action-button:disabled {
    background: var(--button-disabled-bg);
    color: var(--button-disabled-text);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* --- 特定按钮位置 --- */
.cancel-button {
    right: 1rem; /* Position cancel button */
}

.refresh-button {
    left: 1rem; /* Position refresh button */
}

.cancel-tip {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    min-height: 1.2em; /* Prevents layout shift when text appears */
}

.cancel-tip.visible {
    opacity: 1;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative; /* Keep for absolute positioned buttons within */
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: inline-block;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.status-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    min-height: 1.4em; /* Prevents layout shift */
}

.progress-container {
    height: 4px;
    background: #EDE9FE;
    border-radius: 2px;
    margin: 1rem 0 2rem 0;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.4s ease;
}

.node-list {
    display: grid;
    gap: 1rem;
}

.node-card {
    padding: 1.25rem;
    background: white;
    border-radius: 1rem;
    border: 1px solid #EDE9FE;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    opacity: 0; /* Start hidden for animation */
    transform: translateY(10px); /* Start slightly lower for animation */
    animation: cardEnter 0.6s forwards;
}

.node-card:hover {
    transform: translateY(-2px); /* Adjust transform based on new starting point if needed */
    box-shadow: 0 6px 12px rgba(124, 58, 237, 0.08);
}

/* --- Status Dot Styles --- */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.75rem;
    flex-shrink: 0;
    background-color: #D1D5DB; /* Default gray (for failed/unchecked) */
    display: inline-block;
    vertical-align: middle;
}

.status-dot.active { /* Green for available 'other' nodes (or CF) */
    background-color: #10B981; /* Green */
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); /* Subtle glow */
}

.status-dot.main { /* Yellow for available 'main' node (as per original CSS) */
    background-color: #F59E0B; /* Yellow */
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); /* Subtle glow with yellow */
}

/* Note: .status-dot.primary rule removed as it seemed unused in the JS */

/* Adjust Node Header to use Flex */
.node-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.node-name {
    font-weight: 500;
    color: var(--text-primary);
    /* Removed flex-grow: 1 as it might not be needed if dot is fixed width */
}

.node-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    min-height: 1.3em; /* Prevents layout shift */
}

.node-details span:first-child { /* Selects the status text span */
    color: #4B5563;
    font-size: 0.8rem;
}

.latency {
    background: #F5F3FF;
    color: var(--primary);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: -0.5px; /* Can make small text slightly denser */
    white-space: nowrap; /* Prevent latency from wrapping */
}

/* --- Animations --- */
@keyframes cardEnter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}