/* 全局基础样式 */
body {
    scroll-behavior: smooth;
}

/* 通用动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
    opacity: 0;
}

/* 延迟动画类 */
.delay-100 {
    animation-delay: 100ms;
}

.delay-200 {
    animation-delay: 200ms;
}

.delay-300 {
    animation-delay: 300ms;
}

.delay-400 {
    animation-delay: 400ms;
}

/* 通用组件悬停效果 */
.block,
.api-card,
.mac-code-box {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.block:hover,
.api-card:hover,
.mac-code-box:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

/* 按钮通用样式 */
.btn {
    transition: all 0.25s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

/* 表单元素样式 */
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #495057;
    font-size: 1rem;
}

.input-group {
    transition: box-shadow 0.2s ease;
}

.input-group:hover {
    box-shadow: 0 0 0 3px rgba(55, 110, 255, 0.08);
}

.form-control {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

/* 表格样式 */
.markdown-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    border: 1px solid #e0e0e0;
    background-color: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.markdown-table th,
.markdown-table td {
    padding: 0.75rem 0.875rem;
    text-align: left;
    border: 1px solid #e0e0e0;
    transition: all 0.25s ease;
    font-size: 0.8125rem;
}

.markdown-table thead th {
    text-transform: uppercase;
    letter-spacing: .0625em;
    font-size: .875rem;
    background-color: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
}

.markdown-table tr:hover td {
    background-color: #f0f7ff;
    box-shadow: inset 0 0 6px rgba(55, 110, 255, 0.1);
}

/* API卡片样式 */
.api-card {
    height: 100%;
    min-height: 150px;
    background: white;
    border: 1px solid #eaeaea;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0 auto;
    position: relative;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.api-card:hover {
    transform: translateY(-5px);
    border-color: #d0d7dc;
}

/* 卡片顶部装饰条动画 */
.api-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #4299e1, #38b2ac);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: left center;
}

.api-card:hover::before {
    transform: scaleX(1);
}

.api-card-content {
    flex: 1;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
}

.api-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.8rem;
}

.api-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
    transition: color 0.3s ease;
}

.api-card:hover .api-card-title {
    color: #2c5282;
}

.api-card-status {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: rgba(40, 167, 69, 0.1);
    transition: background-color 0.3s ease;
}

.api-card-status.online {
    color: #28a745;
}

.api-card-status.offline {
    color: #ffc107;
    background-color: rgba(255, 193, 7, 0.1);
}

.api-card-desc {
    flex: 1;
    font-size: 0.75rem;
    color: #666;
    margin: 0 0 0.5rem 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    height: 2.8em;
    transition: color 0.3s ease;
}

.api-card:hover .api-card-desc {
    color: #4a5568;
}

.api-card-meta {
    font-size: 0.7rem;
    color: #888;
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.5rem;
    border-top: 1px dashed #f0f0f0;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.api-card:hover .api-card-meta {
    color: #6b7280;
    border-top-color: #e5e7eb;
}

/* API方法类型标签 */
.api-card-method {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.method-get {
    background-color: rgba(46, 160, 67, 0.15);
    color: #2ea043;
}

.method-post {
    background-color: rgba(30, 136, 229, 0.15);
    color: #1e88e5;
}

.method-put {
    background-color: rgba(230, 126, 34, 0.15);
    color: #e67e22;
}

.method-delete {
    background-color: rgba(229, 57, 53, 0.15);
    color: #e53935;
}

/* 卡片点击反馈 */
.api-card:active {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
}

/* 维护状态卡片样式 */
.api-card.offline-card {
    border-color: #ffe0b2;
}

.api-card.offline-card:hover {
    box-shadow: 0 10px 20px rgba(255, 193, 7, 0.08);
}

.api-card.offline-card::before {
    background: linear-gradient(90deg, #ffc107, #f57c00);
}

/* 代码框样式 */
.mac-code-box {
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin: 1.5rem 0;
}

.mac-code-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.mac-code-header {
    background: #f5f5f5;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

.mac-code-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    transition: transform 0.2s ease;
}

.mac-code-header:hover .mac-code-dot {
    transform: scale(1.15);
}

.mac-code-dot.red {
    background-color: #ff5f58;
}

.mac-code-dot.yellow {
    background-color: #ffbd2e;
}

.mac-code-dot.green {
    background-color: #18c37d;
}

.mac-code-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.mac-code-btn {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    border: none;
    cursor: pointer;
    background: #e0e0e0;
    color: #333;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mac-code-btn i {
    font-size: 11px;
    opacity: 0.8;
}

.mac-code-btn:hover {
    background: #d0d0d0;
    transform: translateY(-1px);
}

.mac-code-btn.copy-btn {
    background: #4a90e2;
    color: white;
}

.mac-code-btn.copy-btn:hover {
    background: #3a80d2;
    box-shadow: 0 2px 5px rgba(58, 128, 210, 0.3);
}

.mac-code-language {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    background: #e0e0e0;
    color: #333;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mac-code-content {
    background: #f0f2f5;
    position: relative;
}

.mac-code-content pre {
    margin: 0;
    padding: 0;
    white-space: pre;
    overflow-x: auto;
}

pre code {
    color: #333;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    line-height: 1.6;
    font-size: 0.875rem;
    text-align: left;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 响应式布局 */
/* API卡片列布局 */
@media (min-width: 1200px) {
    .api-col {
        flex: 0 0 25%;
        max-width: 25%;
        padding: 0 10px;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .api-col {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
        padding: 0 10px;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .api-col {
        flex: 0 0 50%;
        max-width: 50%;
        padding: 0 10px;
    }
}

/* 通用响应式调整 */
@media (max-width: 767px) {
    .api-col {
        flex: 0 0 100%;
        max-width: 100%;
        padding: 0 10px;
    }

    .row {
        flex-direction: column;
    }

    .col-sm-6,
    .col-sm-3 {
        width: 100%;
        margin-bottom: 1rem;
    }

    .markdown-table th,
    .markdown-table td {
        padding: 0.65rem 0.5rem;
        font-size: 0.75rem;
    }
}