/* Modern CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-900: #111827;

    /* Spacing System */
    --spacing-2: 0.5rem;
    --spacing-3: 0.75rem;
    --spacing-4: 1rem;
    --spacing-6: 1.5rem;
    --spacing-8: 2rem;
    --spacing-12: 3rem;

    /* Typography */
    --font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

    /* Border Radius */
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

body {
    font-family: var(--font-family-sans);
    background-color: var(--color-gray-50);
    color: var(--color-gray-900);
    line-height: 1.6;
    min-height: 100vh;
}

/* Uptime Kuma Style Header */
.header {
    background: white;
    border-radius: 12px;
    margin: 20px auto 24px auto;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-width: 1160px;
    width: calc(100% - 40px);
}

.header-content {
    text-align: center;
}

/* Countdown Header Styles */
.countdown-header {
    text-align: center;
}

.countdown-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 16px;
    letter-spacing: -0.025em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.countdown-progress-container {
    background: #e2e8f0;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 16px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.countdown-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    border-radius: 3px;
    transition: width 1s ease;
    width: 0%;
}

.countdown-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.countdown-time-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    font-weight: 500;
}

.last-update-info {
    font-weight: 500;
}

/* Container */
.container {
    max-width: 1160px;
    margin: 0 auto 20px auto;
    padding: 0;
    width: calc(100% - 40px);
}

/* Modern Loading State */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-12) 0;
    color: var(--color-gray-600);
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid var(--color-gray-200);
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: var(--spacing-4);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Uptime Kuma Style Monitor Group */
.site-item {
    background: white;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Uptime Kuma Style Monitor Item */
.site-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s ease;
    cursor: pointer;
    height: 60px;
    box-sizing: border-box;
}

.site-header:hover {
    background: #f8fafc;
}

.site-item.failed .site-header:hover {
    background: #f8fafc;
}

.site-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

/* Status Indicator (Uptime Kuma style) */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
}

.status-indicator.success {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.status-indicator.failed {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.site-name {
    font-weight: 600;
    color: #1e293b;
    flex-shrink: 0;
    font-size: 1rem;
}

.site-item.failed .site-name {
    color: #1e293b;
}

.best-url {
    font-size: 0.875rem;
    color: #64748b;
    font-family: 'Courier New', monospace;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.failed-url {
    color: #64748b;
    font-weight: 500;
}

/* Monitor Stats */
.monitor-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.response-badge {
    background: #dcfce7;
    color: #166534;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 80px;
    max-width: 120px;
    text-align: center;
    display: inline-block;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.response-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.response-badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Status History */
.status-history, .backup-status-history {
    display: flex;
    gap: 2px;
    margin-left: 16px;
    height: 20px;
    align-items: center;
}

/* 统一所有状态点样式 */
.status-dot {
    width: 6px;
    height: 18px;
    border-radius: 2px;
    background: #e2e8f0;
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.status-dot:hover {
    height: 20px;
    transform: translateY(-2px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* 自定义工具提示 */
.tooltip {
    position: fixed;
    background: white;
    color: #333;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 1000;
    pointer-events: none;
    max-width: 300px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: none;
    text-align: center;
    border: 1px solid #eee;
}

/* 工具提示中的状态文本颜色 */
.tooltip .status-online {
    color: var(--color-success);
    font-weight: 600;
}

.tooltip .status-offline {
    color: var(--color-danger);
    font-weight: 600;
}

/* 移除之前复杂的工具提示内部结构 */
.tooltip .tooltip-time,
.tooltip .tooltip-status,
.tooltip .tooltip-latency {
    display: inline;
    font-size: 12px;
    margin: 0;
    padding: 0;
    font-weight: normal;
    background: transparent;
    color: inherit;
}

.status-dot span {
    display: none;
}

.status-dot.success, .status-dot.up {
    background: #10b981;
    box-shadow: 0 0 2px rgba(16, 185, 129, 0.4);
}

.status-dot.failed, .status-dot.down {
    background: #ef4444;
    box-shadow: 0 0 2px rgba(239, 68, 68, 0.4);
}

.status-dot.no_data {
    background: #cbd5e1;
    opacity: 0.5;
}

/* Backup URLs Expansion Area */
.site-details {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.site-item.expanded .site-details {
    /* max-height will be set dynamically by JavaScript */
    padding: 0;
}

.url-list {
    padding: 0;
}

.url-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    height: 60px;
    box-sizing: border-box;
}

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

.backup-url-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.backup-url-name {
    font-weight: 600;
    color: #64748b;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.url-text {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: #475569;
    flex: 1;
    min-width: 0;
}

.backup-url-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.backup-status-history {
    display: flex;
    gap: 2px;
    margin-left: 16px;
}



/* Responsive Design */
@media (max-width: 768px) {
    .header {
        margin: 10px auto;
        padding: 20px;
        width: calc(100% - 20px);
    }

    .countdown-header h1 {
        font-size: 1.5rem;
    }

    .countdown-info {
        flex-direction: row;
        justify-content: space-between;
        gap: 8px;
        text-align: left;
        font-size: 0.8rem;
    }

    .countdown-time-info, .last-update-info {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .countdown-progress-container {
        margin: 0 auto;
        order: unset;
    }

    .container {
        margin: 0 auto 10px auto;
        padding: 0;
        width: calc(100% - 20px);
    }

    /* 重置为一致的布局结构 - 调整网格比例 */
    .site-header, .url-item {
        display: grid;
        grid-template-columns: auto minmax(0, 2fr) auto; /* 增加中间列的比例 */
        align-items: center;
        gap: 0;
        height: 60px;
        padding: 0 10px 0 12px; /* 减少整体内边距，但保持左侧对齐 */
        box-sizing: border-box;
    }
    
    /* 统一状态指示器样式 */
    .status-indicator {
        width: 8px; /* 减小尺寸 */
        height: 8px;
        margin: 0 8px 0 0;
        grid-column: 1;
    }
    
    /* 统一左侧信息区域 */
    .site-info, .backup-url-info {
        grid-column: 2;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 6px; /* 减小间隔 */
        margin: 0;
        width: auto;
        overflow: hidden; /* 防止溢出 */
        min-width: 0; /* 允许Grid容器收缩 */
    }
    
    /* 统一站点名称样式 */
    .site-name, .backup-url-name {
        font-size: 0.95rem;
        font-weight: 600;
        margin: 0;
        padding: 0;
        white-space: nowrap;
        color: #1e293b;
        min-width: 40px; /* 略微减小最小宽度 */
        display: inline-block;
    }
    
    /* 统一URL文本样式 - 移除截断处理 */
    .best-url, .url-text {
        font-size: 0.75rem;
        margin: 0;
        padding: 0;
        font-family: 'Courier New', monospace;
        color: #64748b;
        /* 移除截断相关样式 */
        white-space: normal; /* 允许换行 */
        overflow: visible; /* 允许内容溢出 */
        text-overflow: clip; /* 不使用省略号 */
        min-width: 0;
        max-width: none; /* 移除最大宽度限制 */
    }
    
    /* 统一右侧状态区域 - 减小尺寸 */
    .monitor-stats, .backup-url-stats {
        grid-column: 3;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 4px; /* 减小间距 */
        margin: 0;
        justify-self: end;
    }
    
    /* 响应时间徽章样式 - 移动端统一尺寸 */
    .response-badge {
        font-size: 0.6rem; /* 更小的字体 */
        padding: 1px 4px; /* 减小内边距 */
        margin: 0;
        white-space: nowrap; /* 确保不换行 */
        border-radius: 3px; /* 减小圆角 */
        line-height: 1.4; /* 减小行高 */
        width: 70px; /* 固定宽度，统一所有标签 */
        min-width: unset; /* 移除最小宽度限制 */
        max-width: unset; /* 移除最大宽度限制，使用固定宽度 */
        text-align: center;
        overflow: hidden; /* 隐藏溢出部分 */
        text-overflow: ellipsis; /* 使用省略号表示溢出 */
        box-sizing: border-box; /* 确保边框和内边距包含在宽度内 */
    }
    
    /* 统一状态历史点区域 - 减小尺寸 */
    .status-history, .backup-status-history {
        display: flex;
        align-items: center;
        gap: 1px; /* 减小点之间的间距 */
        margin: 0 0 0 4px; /* 减小左边距 */
    }
    
    /* 统一状态点样式 - 减小尺寸 */
    .status-dot {
        width: 3px; /* 更窄的点 */
        height: 10px; /* 更短的点 */
        border-radius: 1px;
        margin: 0;
    }
    
    /* 删除所有其他冲突的规则 */
}
