/* 全局重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 容器布局 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    font-size: 24px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.last-update {
    font-size: 14px;
    opacity: 0.9;
}

/* 按钮样式 */
.btn-trigger {
    background: white;
    color: #667eea;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-trigger:active {
    transform: translateY(0);
}

.btn-trigger:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 状态指示器 */
.status {
    padding: 15px 30px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    margin: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

.status.hidden {
    display: none;
}

.status-icon {
    font-size: 20px;
}

.status-text {
    color: #856404;
    font-weight: 500;
}

/* 主内容区域 */
main {
    padding: 30px;
    min-height: 400px;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 桌面端表格样式 */
.records-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.records-table thead {
    background: #f8f9fa;
}

.records-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    font-size: 14px;
    border-bottom: 2px solid #dee2e6;
}

.records-table td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    color: #555;
}

.records-table tbody tr {
    transition: background 0.2s ease;
}

.records-table tbody tr:hover {
    background: #f8f9fa;
}

/* IP单元格容器 */
.ip-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ip-cell {
    font-family: 'Courier New', 'Consolas', monospace;
    font-weight: 600;
    color: #667eea;
    cursor: pointer;
    user-select: none;
    font-size: 15px;
}

.ip-cell:hover {
    text-decoration: underline;
    color: #5568d3;
}

/* 复制按钮 */
.copy-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #999;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0;
}

.ip-wrapper:hover .copy-btn,
.ip-wrapper-card:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: #f0f0f0;
    color: #667eea;
    transform: scale(1.1);
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-btn svg {
    display: block;
}

.delay-good {
    color: #28a745;
    font-weight: 600;
}

.delay-medium {
    color: #ffc107;
    font-weight: 600;
}

.delay-bad {
    color: #dc3545;
    font-weight: 600;
}

.speed-cell {
    font-weight: 600;
    color: #667eea;
}

/* 移动端卡片样式 */
.records-cards {
    display: none;
}

.record-card {
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.record-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* 移动端IP容器 */
.ip-wrapper-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    gap: 10px;
}

.card-ip {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 18px;
    font-weight: 600;
    color: #667eea;
    cursor: pointer;
    user-select: none;
    flex: 1;
}

.card-ip:active {
    color: #5568d3;
}

.card-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.card-item {
    display: flex;
    flex-direction: column;
}

.card-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}

.card-value {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.card-timestamp {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    font-size: 13px;
    color: #999;
    text-align: center;
}

/* Toast提示 */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 15px 25px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

.toast.hidden {
    display: none;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 页脚 */
footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-size: 14px;
    border-top: 1px solid #dee2e6;
}

/* 响应式布局 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        flex-direction: column;
        padding: 20px;
        text-align: center;
    }

    .header-right {
        flex-direction: column;
        width: 100%;
    }

    .btn-trigger {
        width: 100%;
    }

    .records-table {
        display: none;
    }

    .records-cards {
        display: block;
    }

    main {
        padding: 15px;
    }

    .status {
        margin: 15px;
        padding: 12px 15px;
        font-size: 14px;
    }

    .toast {
        right: 15px;
        bottom: 15px;
        left: 15px;
        max-width: none;
    }

    /* 移动端复制按钮始终显示 */
    .copy-btn {
        opacity: 1;
    }
}

/* 工具类 */
.text-success {
    color: #28a745;
}

.text-warning {
    color: #ffc107;
}

.text-danger {
    color: #dc3545;
}

.text-muted {
    color: #6c757d;
}
