/* 首页的样式 */
/* 重置所有元素的默认样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 设置页面背景色和字体 */
body {
    background-color: #f5f5f5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    padding: 1.25rem;
    line-height: 1.6;
    color: #333;
}

/* 页面容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    border-radius: 0.5rem;
    padding: clamp(1rem, 5vw, 2rem);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 页面头部样式 */
.header {
    display: flex;
    align-items: center;
    margin-bottom: clamp(1.5rem, 5vw, 2rem);
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: clamp(1rem, 3vw, 1.5rem);
    flex-wrap: wrap;
    gap: 1rem;
}

/* 头部logo图片 */
.header-logo {
    width: clamp(3rem, 10vw, 4rem);
    height: clamp(3rem, 10vw, 4rem);
    border-radius: 0.5rem;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

/* logo图片样式 */
.header-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 头部标题和描述 */
.header-info h1 {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
    color: #333;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.header-info p {
    color: #999;
    font-size: clamp(0.875rem, 2vw, 1rem);
}

/* 搜索框样式 */
.search-box {
    margin-bottom: clamp(1.5rem, 5vw, 2rem);
}

.search-box input {
    width: 100%;
    padding: clamp(0.75rem, 2vw, 1rem);
    border: 1px solid #ddd;
    border-radius: 0.375rem;
    font-size: clamp(0.875rem, 2vw, 1rem);
    color: #333;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #ff9800;
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.1);
}

.search-box input::placeholder {
    color: #999;
}

/* API卡片网格布局 */
.api-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(clamp(250px, 80vw, 350px), 1fr));
    gap: clamp(1rem, 3vw, 1.5rem);
    align-items: stretch;
}

/* 单个API卡片样式 */
.api-card {
    background-color: white;
    border: 1px solid #000;
    border-radius: 1.25rem;
    padding: clamp(1rem, 3vw, 1.5rem);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    min-height: 100%;
    height: 100%;
}

/* 卡片悬停效果 */
.api-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* 卡片头部 */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
    gap: 0.5rem;
}

/* 卡片标题 */
.card-title {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    font-weight: 600;
    color: #333;
    flex: 1;
    word-break: break-word;
}

/* 卡片顶部状态指示器 */
.card-status {
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    background-color: #52c41a;
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 0 0 rgba(82, 196, 26, 0.7);
}

/* 状态灯悬停效果 */
.card-status:hover {
    transform: scale(1.2);
}

/* 在线状态脉冲动画 - 使用 ::before 伪元素 */
.card-status::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #52c41a;
    opacity: 0.204469;
    animation: radar-pulse 2s infinite;
}

/* 在线状态脉冲动画 - 使用 ::after 伪元素 */
.card-status::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #52c41a;
    opacity: 0;
    animation: radar-pulse 2s infinite;
    animation-delay: 1s;
}

/* 状态为离线时的样式 */
.card-status[data-status="offline"] {
    background-color: #ff4d4f;
    box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.7);
}

/* 离线状态脉冲动画 - 使用 ::before 伪元素 */
.card-status[data-status="offline"]::before {
    background-color: #ff4d4f;
    animation: radar-pulse-offline 2s infinite;
}

/* 离线状态脉冲动画 - 使用 ::after 伪元素 */
.card-status[data-status="offline"]::after {
    background-color: #ff4d4f;
    animation: radar-pulse-offline 2s infinite;
    animation-delay: 1s;
}

/* 在线状态雷达脉冲动画 */
@keyframes radar-pulse {
    0% {
        opacity: 0.204469;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.85698);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* 离线状态雷达脉冲动画 */
@keyframes radar-pulse-offline {
    0% {
        opacity: 0.204469;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.85698);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* 卡片描述 */
.card-description {
    font-size: clamp(0.8125rem, 2vw, 0.875rem);
    color: #999;
    margin-bottom: 1rem;
    line-height: 1.5;
    flex-shrink: 0;
}

/* 详情内容区域 */
.card-details {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
    flex-grow: 1;
    overflow: hidden;
}

.details-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-label {
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
    color: #999;
    font-weight: 600;
    text-transform: uppercase;
}

.detail-value {
    font-size: clamp(0.875rem, 2vw, 1rem);
    color: #333;
    line-height: 1.5;
    word-break: break-word;
}

.detail-value a {
    color: #ff9800;
    text-decoration: none;
    transition: text-decoration 0.3s ease;
}

.detail-value a:hover {
    text-decoration: underline;
}

/* 参数表格 */
.params-table {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
    border: 1px solid #000;
    border-radius: 1.25rem;
    overflow: hidden;
}

.params-table thead {
    background-color: #f5f5f5;
}

.params-table th {
    padding: clamp(0.625rem, 1.5vw, 0.75rem);
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e8e8e8;
}

.params-table td {
    padding: clamp(0.625rem, 1.5vw, 0.75rem);
    border-bottom: 1px solid #f0f0f0;
    color: #666;
}

.params-table tbody tr:hover {
    background-color: #fafafa;
}

/* 查看详情链接 */
.view-details {
    color: #000;
    background-color: transparent;
    text-decoration: none;
    font-size: clamp(0.875rem, 2vw, 1rem);
    padding: clamp(0.5rem, 1.5vw, 0.75rem) clamp(1rem, 2vw, 1.25rem);
    border-radius: 0.625rem;
    border: 1px solid #000;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.view-details:hover {
    background-color: #f0f0f0;
    text-decoration: none;
}

/* 卡片操作区域 */
.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* 复制按钮 */
.copy-btn {
    background-color: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: clamp(1rem, 2vw, 1.25rem);
    padding: 0.25rem;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.3s ease, transform 0.3s ease;
}

.copy-btn:hover {
    color: #333;
    transform: scale(1.1);
}

.copy-btn:active {
    transform: scale(0.95);
}

/* 卡片统计信息 */
.card-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(0.75rem, 2vw, 1rem);
    border: 1px solid #000;
    background-color: transparent;
    border-radius: 1.25rem;
    margin: 0;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: left;
    flex: 1;
    min-width: 100px;
}

.stat-label {
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
    color: #999;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 600;
    color: #333;
}

/* 卡片底部 */
.card-footer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0;
    flex-shrink: 0;
}

/* ===== 响应式设计 ===== */

/* 超小屏幕 (320px - 480px) */
@media (max-width: 480px) {
    body {
        padding: 0.75rem;
    }

    .container {
        border-radius: 0.25rem;
        padding: clamp(0.75rem, 3vw, 1rem);
    }

    .api-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 1rem;
    }

    .header-logo {
        margin-bottom: 0.75rem;
    }

    .card-stats {
        flex-direction: column;
        align-items: flex-start;
    }

    .stat-item {
        width: 100%;
    }
}

/* 小屏幕 (481px - 768px) */
@media (max-width: 768px) {
    .api-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-logo {
        margin-bottom: 1rem;
    }

    .card-stats {
        flex-direction: column;
        align-items: flex-start;
    }

    .stat-item {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .params-table {
        font-size: 0.75rem;
    }

    .params-table th,
    .params-table td {
        padding: 0.5rem;
    }
}

/* 中等屏幕 (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .api-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* 大屏幕 (1025px 及以上) */
@media (min-width: 1025px) {
    .api-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

/* 横屏模式 */
@media (orientation: landscape) and (max-height: 600px) {
    .container {
        padding: clamp(0.5rem, 2vw, 1rem);
    }

    .header {
        margin-bottom: 1rem;
    }

    .api-grid {
        gap: 0.75rem;
    }

    .api-card {
        padding: clamp(0.75rem, 2vw, 1rem);
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .api-card:hover {
        transform: none;
    }

    .copy-btn:hover {
        transform: none;
    }

    .api-card:active {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    .copy-btn:active {
        opacity: 0.7;
    }
}

/* 高分辨率屏幕 (Retina) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .api-card {
        border-width: 0.5px;
    }

    .params-table {
        border-width: 0.5px;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }

    .container {
        background-color: #2a2a2a;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    }

    .api-card {
        background-color: #333;
        border-color: #555;
    }

    .api-card:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .card-title,
    .detail-value {
        color: #e0e0e0;
    }

    .card-description,
    .detail-label,
    .stat-label {
        color: #999;
    }

    .search-box input {
        background-color: #3a3a3a;
        border-color: #555;
        color: #e0e0e0;
    }

    .search-box input::placeholder {
        color: #777;
    }

    .params-table {
        border-color: #555;
    }

    .params-table thead {
        background-color: #3a3a3a;
    }

    .params-table th {
        border-bottom-color: #555;
        color: #e0e0e0;
    }

    .params-table td {
        border-bottom-color: #444;
        color: #bbb;
    }

    .params-table tbody tr:hover {
        background-color: #3a3a3a;
    }
}

/* ===== 浮动菜单样式 ===== */

/* 浮动按钮容器 */
.floating-btn-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

/* 浮动菜单容器 */
.floating-menu-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

/* 浮动按钮 */
.floating-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #fff;
    border: 2px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 300;
    color: #333;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1001;
}

.floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.floating-btn:active {
    transform: scale(0.95);
}

.plus-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* 菜单面板 */
.menu-panel {
    position: fixed;
    bottom: 80px;
    right: 0;
    width: 100%;
    max-width: 320px;
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    z-index: 1000;
    max-height: 70vh;
    overflow-y: auto;
}

.menu-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* 菜单项 */
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f9f9f9;
    border: 2px solid #333;
}

.menu-item:hover {
    background-color: #fff5f5;
    border-color: #e06060;
    box-shadow: 0 2px 8px rgba(240, 128, 128, 0.2);
    transform: translateX(-4px);
}

.menu-item:active {
    transform: translateX(-2px);
}

/* 菜单图标 */
.menu-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 菜单内容 */
.menu-content {
    flex: 1;
    min-width: 0;
}

.menu-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.menu-subtitle {
    font-size: 12px;
    color: #999;
    line-height: 1.4;
}

/* 菜单操作按钮 */
.menu-action {
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: #f0f0f0;
    transition: all 0.3s ease;
}

.menu-item:hover .menu-action {
    color: #333;
    background-color: #e0e0e0;
}

/* 菜单关闭按钮 */
.menu-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #f0f0f0;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #999;
    transition: all 0.3s ease;
}

.menu-close-btn:hover {
    background-color: #e0e0e0;
    color: #333;
    transform: rotate(90deg);
}

/* 菜单背景遮罩 */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.menu-overlay.active {
    background-color: rgba(0, 0, 0, 0.3);
    opacity: 1;
    visibility: visible;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .floating-menu-container {
        bottom: 1rem;
        right: 1rem;
    }

    .floating-btn {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }

    .menu-panel {
        max-width: calc(100vw - 2rem);
        bottom: 70px;
    }
}

@media (max-width: 768px) {
    .menu-panel {
        max-width: 280px;
    }
}

/* 暗色模式下的浮动菜单 */
@media (prefers-color-scheme: dark) {
    .floating-btn {
        background-color: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }

    .floating-btn:hover {
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    }

    .menu-panel {
        background-color: #2a2a2a;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    }

    .menu-item {
        background-color: #333;
    }

    .menu-item:hover {
        background-color: #3a3a3a;
    }

    .menu-title {
        color: #e0e0e0;
    }

    .menu-subtitle {
        color: #999;
    }

    .menu-action {
        background-color: #3a3a3a;
        color: #999;
    }

    .menu-item:hover .menu-action {
        background-color: #444;
        color: #e0e0e0;
    }

    .menu-close-btn {
        background-color: #333;
        color: #999;
    }

    .menu-close-btn:hover {
        background-color: #3a3a3a;
        color: #e0e0e0;
    }
}

/* ===== 浮动菜单面板样式 ===== */

/* 浮动菜单面板 */
.floating-menu-panel {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 320px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    max-height: 60vh;
    overflow-y: auto;
}

.floating-menu-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* 菜单头部 */
.menu-header {
    display: flex;
    justify-content: flex-end;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
}

/* 菜单关闭按钮 */
.menu-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.menu-close-btn:hover {
    color: #333;
}

/* 菜单项容器 */
.menu-items {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}

/* 单个菜单项 */
.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin: 4px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 12px;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.menu-item:hover {
    background-color: #f0f0f0;
    transform: translateX(-4px);
}

.menu-item:active {
    transform: translateX(-2px);
}

/* 菜单项图标 */
.menu-icon {
    font-size: 20px;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 菜单项内容 */
.menu-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.menu-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.menu-subtitle {
    font-size: 12px;
    color: #999;
}

/* 菜单项箭头 */
.menu-arrow {
    font-size: 14px;
    color: #999;
    flex-shrink: 0;
}

/* 菜单遮罩层 */
.floating-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 998;
}

.floating-menu-overlay.active {
    background-color: rgba(0, 0, 0, 0.3);
    opacity: 1;
    visibility: visible;
}

/* 响应式设计 - 菜单面板 */
@media (max-width: 480px) {
    .floating-menu-panel {
        width: calc(100vw - 40px);
        right: 20px;
        bottom: 70px;
    }
}

@media (max-width: 768px) {
    .floating-menu-panel {
        width: 280px;
        margin-bottom: 25px;
    }
}
