/**
 * API查询工具箱 - 模块化样式表
 * 按功能模块组织，遵循BEM命名规范
 * Version: 2.0
 */

/* =========================================================================
   1. CSS变量和全局基础样式
   ========================================================================= */

@import url('libs/template.css');

:root {
    /* 色彩 */
    --primary-color: #2563eb;
    --secondary-color: #0891b2;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --dark-color: #1f2937;
    --light-color: #f8fafc;

    /* 卡片 */
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 20px 50px rgba(0, 0, 0, 0.15);

    /* 动画 */
    --transition-fast: all 0.2s ease;
    --transition-slow: all 0.5s ease;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    color: var(--dark-color);
    line-height: 1.6;
}

img {
    max-width: 100%;
    max-height: 60vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

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

.flex-gap-10 {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.grid-gap-10 {
    display: grid;
    gap: 8px;
}

/* =========================================================================
   2. 头部模块 (Header)
   ========================================================================= */

.header {
    position: relative;
    text-align: center;
    padding: 64px 0 40px;
}

.header-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    backdrop-filter: blur(10px);
    border-radius: 0 0 12px 12px;
}

.header-main {
    position: relative;
    z-index: 2;
}

.header .title {
    font-size: 3.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    margin-bottom: 24px;
    animation: fadeInUp 1s ease-out;
}

.header .title i {
    margin-right: 16px;
    color: var(--accent-color);
}

.header .subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 300;
    animation: fadeInUp 1s ease-out 0.2s both;
}

/* =========================================================================
   3. 搜索模块 (Search)
   ========================================================================= */

.search {
    padding: 40px 0;
    animation: fadeInUp 1s ease-out 0.4s both;
}

.search-main {
    max-width: 600px;
    margin: 0 auto;
}

.search-box {
    position: relative;
    display: flex;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.search-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.search-input {
    flex: 1;
    padding: 16px 24px;
    border: none;
    outline: none;
    font-size: 1.1rem;
    background: transparent;
    color: var(--dark-color);
    border-radius: 12px 0 0 12px;
}

.search-input::placeholder {
    color: rgba(0, 0, 0, 0.5);
}

.search-btn {
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 0 12px 12px 0;
}

.search-btn:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}

/* =========================================================================
   4. 主内容区域和工具网格 (Main Content & Tools Grid)
   ========================================================================= */

.tools {
    padding: 24px 0 64px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    animation: fadeInUp 1s ease-out 0.6s both;
}

/* =========================================================================
   5. 工具卡片模块 (Tool Cards)
   ========================================================================= */

.tool-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transform: scaleX(0);
    transition: var(--transition);
    border-radius: 12px 12px 0 0;
}

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

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow-hover);
}

.tool-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 24px;
    display: block;
}

.tool-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
}

.tool-description {
    color: rgba(0, 0, 0, 0.7);
    margin-bottom: 16px;
    line-height: 1.5;
}

.tool-endpoint {
    background: rgba(37, 99, 235, 0.1);
    padding: 12px 16px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--secondary-color);
    border-left: 3px solid var(--primary-color);
}

/* =========================================================================
   6. 模态框模块 (Modal)
   ========================================================================= */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.modal-main {
    display: flex;
    flex-direction: column;
    background: white;
    margin: 24px auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 1200px;
    max-height: calc(100vh - 48px);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.modal-header .close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: white;
    transition: var(--transition-fast);
    line-height: 1;
}

.modal-header .close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* =========================================================================
   7. 输入表单模块 (Input Forms)
   ========================================================================= */

.input-section {
    margin-bottom: 32px;
}

.input-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
}

.input-section input {
    width: 100%;
    padding: 16px 24px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transition);
    margin-bottom: 24px;
}

.input-section input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-section .execute-btn {
    background: linear-gradient(135deg, var(--success-color), #00b894);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-section .execute-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 212, 170, 0.3);
}

/* =========================================================================
   8. 结果显示模块 (Result Display)
   ========================================================================= */

.result-section {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: 32px;
}

.result-header {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    padding: 24px 16px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
    position: relative;
}

.result-header::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 145px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--error-color));
    transition: var(--transition);
}

.result-header>i {
    margin: 4px 8px 0 0;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.result-header h4 {
    flex: 1;
    color: var(--dark-color);
    font-size: 1.3rem;
    margin: 0;
}

.result-action {
    display: flex;
    gap: 16px;
}

.result-action .result-btn {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(240, 147, 251, 0.1));
    border: 1px solid rgba(102, 126, 234, 0.2);
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--primary-color);
}

.result-action .result-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.result-area {
    background: #f8f9fa;
    border-radius: 12px;
    min-height: 300px;
    position: relative;
    transition: var(--transition);
}

.result-area .result-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: rgba(0, 0, 0, 0.5);
}

.result-area .result-placeholder i {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
}

/* =========================================================================
   9. 状态反馈模块 (Loading, Toast, Error)
   ========================================================================= */

/* 加载动画 */
.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
}

.loading p {
    font-size: 1.1rem;
    font-weight: 300;
}

/* 提示消息 */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 3000;
    transform: translateX(400px);
    transition: var(--transition);
}

.toast.show {
    transform: translateX(0);
}

.toast-main {
    background: var(--dark-color);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    font-weight: 500;
}

.toast.success .toast-main {
    background: var(--success-color);
}

.toast.error .toast-main {
    background: var(--error-color);
}

/* 错误信息显示 */
.error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.2);
    border-radius: 8px;
    color: var(--error-color);
    font-weight: 600;
}

.error-message i {
    font-size: 1.2rem;
}

/* =========================================================================
   10. 动画定义 (Animations)
   ========================================================================= */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

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

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* =========================================================================
   11. 响应式设计 (Responsive Design)
   ========================================================================= */

@media (max-width: 768px) {
    .header .title {
        font-size: 2.5rem;
    }

    .modal-main {
        margin: 16px auto;
        width: 95%;
    }

    .modal-body {
        padding: 16px;
    }

}