/**
 * API开放平台页面样式
 */

.api-platform-main {
    min-height: calc(100vh - 80px);
    background: #f8f9fa;
    padding-top: 30px;
    padding-bottom: 40px;
}

.api-platform-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* 左侧导航栏 */
.api-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 12px;
    padding: 24px 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    height: fit-content;
    position: sticky;
    top: 100px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.sidebar-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    padding: 0 24px;
    margin-bottom: 20px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: #666;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav-item:hover {
    background: #f8f9fa;
    color: #667eea;
}

.sidebar-nav-item.active {
    background: #fff5f5;
    color: #667eea;
    border-left-color: #667eea;
    font-weight: 500;
}

.sidebar-nav-item i {
    width: 20px;
    text-align: center;
}

/* 右侧内容区 */
.api-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content-section {
    display: none;
    background: #fff;
    border-radius: 12px;
    padding: 32px 40px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-title {
    font-size: 28px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 24px 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header .section-title {
    margin-bottom: 0;
}

/* 我的账户区域 */
.account-info-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 24px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.info-item {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-label {
    font-size: 14px;
    color: #666;
    margin-right: 12px;
    min-width: 80px;
}

.info-value {
    font-size: 14px;
    color: #1a1a1a;
    font-weight: 500;
}

/* 剩余点数卡片 */
.points-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 40px 36px;
    color: #fff;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.25);
    position: relative;
    overflow: hidden;
}

.points-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.points-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    position: relative;
    z-index: 1;
}

.points-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.points-display {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.points-value {
    font-size: 56px;
    font-weight: 700;
    margin-bottom: 12px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    letter-spacing: -1px;
}

.points-label {
    font-size: 15px;
    opacity: 0.95;
    font-weight: 500;
}

.points-expiry {
    font-size: 13px;
    opacity: 0.85;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* API密钥管理 */
.api-key-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 32px 36px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.api-key-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.api-key-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.refresh-btn {
    background: #fff;
    border: 1px solid #e0e0e0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background: #f0f0f0;
    color: #667eea;
    border-color: #667eea;
}

.api-key-display {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.api-key-text {
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 14px;
    color: #1a1a1a;
    word-break: break-all;
    flex: 1;
    margin-right: 12px;
}

.copy-btn {
    background: #667eea;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.copy-btn:hover {
    background: #5568d3;
}

.api-key-info {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 4px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.api-key-info i {
    color: #ffc107;
    margin-top: 2px;
    flex-shrink: 0;
}

.api-key-info span {
    font-size: 14px;
    color: #856404;
    line-height: 1.6;
}

/* 按钮样式 */
.btn-primary {
    background: #667eea;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #fff;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #667eea;
    color: #fff;
}

/* 使用记录区域 */
.tabs-container {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    font-weight: 500;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #667eea;
}

.records-table-container {
    overflow-x: auto;
}

.records-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.records-table thead {
    background: #f8f9fa;
}

.records-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    border-bottom: 2px solid #e0e0e0;
}

.records-table td {
    padding: 12px 16px;
    font-size: 14px;
    color: #666;
    border-bottom: 1px solid #f0f0f0;
}

.records-table tbody tr:hover {
    background: #f8f9fa;
}

.loading-text {
    text-align: center;
    color: #999;
    padding: 40px !important;
}

.empty-text {
    text-align: center;
    color: #999;
    padding: 40px !important;
}

.type-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.type-badge.type-expense {
    background: #fee;
    color: #c33;
}

.type-badge.type-income {
    background: #efe;
    color: #3c3;
}

.pagination-ellipsis {
    padding: 8px 4px;
    color: #999;
}

/* 分页 */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 20px 0;
}

.pagination-btn {
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #667eea;
    color: #667eea;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* API文档区域 */
.docs-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.docs-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
}

.docs-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.docs-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.docs-card-title i {
    color: #667eea;
}

.docs-card-desc {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin: 0 0 20px 0;
}

.docs-card .btn-primary {
    width: 100%;
    justify-content: center;
}

/* 常见问题区域 */
.faq-content {
    max-width: 900px;
}

.faq-list {
    margin-bottom: 32px;
}

.faq-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.faq-item:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.faq-item:last-child {
    margin-bottom: 0;
}

.faq-question {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
}

.faq-question i {
    color: #667eea;
    font-size: 18px;
}

.faq-answer {
    padding-left: 30px;
}

.faq-answer p {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
    margin: 0;
}

.faq-actions {
    text-align: center;
    padding: 32px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.faq-tip {
    font-size: 16px;
    color: #666;
    margin-bottom: 16px;
}

.faq-actions .btn-primary {
    min-width: 200px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .api-platform-container {
        max-width: 100%;
        padding: 0 20px;
    }
    
    .content-section {
        padding: 28px 32px;
    }
}

@media (max-width: 1024px) {
    .api-platform-container {
        flex-direction: column;
        gap: 20px;
    }

    .api-sidebar {
        width: 100%;
        position: static;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
    }

    .sidebar-nav-item {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .sidebar-nav-item.active {
        border-left: none;
        border-bottom-color: #667eea;
    }
    
    .content-section {
        padding: 24px 28px;
    }
}

@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .points-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .points-value {
        font-size: 36px;
    }

    .docs-content {
        grid-template-columns: 1fr;
    }

    .records-table {
        font-size: 12px;
    }

    .records-table th,
    .records-table td {
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .api-platform-container {
        padding: 0 12px;
    }

    .content-section {
        padding: 20px;
    }

    .api-key-card {
        padding: 20px;
    }

    .api-key-display {
        flex-direction: column;
        gap: 12px;
    }

    .copy-btn {
        width: 100%;
        justify-content: center;
    }
}
