:root {
    --primary-color: #3B82F6;
    --primary-dark: #2563EB;
    --secondary-color: #64748B;
    --background-color: #F8FAFC;
    --card-background: #FFFFFF;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --border-color: #E2E8F0;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --success-color: #10B981;
    font-size: 90%;
    /* 将整体缩小到90% */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* 添加到你的CSS文件中 */
#clearBtn {
    padding: 0.55rem 1.8rem;
    font-size: 0.84rem;
    font-weight: 600;
    background: #e7186f;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.25);
    margin-left: 50px;
}

#clearBtn:hover {
    background-color: #f44336;
    color: white;
}

#clearBtn.success {
    background-color: #4caf50;
    color: white;
}

/* 确保success样式不被hover覆盖 */
#clearBtn.success:hover {
    background-color: #45a049;
}

.container {
    max-width: 1000px;
    margin: 1rem auto;
    padding: 0 1rem;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.header .subtitle {
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 400;
}

.main-content {
    background: var(--card-background);
    border-radius: 10px;
    box-shadow: 0 20px 40px var(--shadow-color);
    padding: 1.5rem;
    animation: fadeIn 0.6s ease-out;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab-btn {
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
}

.tab-btn.active {
    background: var(--success-color);
    color: white;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.18);
    border-color: transparent;
}

.pill {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(245, 245, 245, 0.9));
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* Make concat clear button match the clearBtn style */
#concatClearBtn {
    padding: 0.55rem 1.8rem;
    font-size: 0.84rem;
    font-weight: 600;
    background: #e7186f;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.25);
}

#concatClearBtn:hover {
    background-color: #f44336;
}

#concatClearBtn.success {
    background-color: #4caf50;
}

.format-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.format-card {
    flex: 1;
    background: var(--background-color);
    border-radius: 16px;
    padding: 1.4rem;
    transition: all 0.3s ease;
    animation: slideIn 0.6s ease-out;
    padding-bottom: 35px;
}

.format-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px var(--shadow-color);
}

.format-card:nth-child(2) {
    animation-delay: 0.2s;
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.01rem;
}

/* 使 format 卡片头部的计数器靠右对齐，与 .text-card .card-header 保持一致 */
.format-card .card-header {
    justify-content: flex-start;
    /* 保持图标和标题在左侧紧密排列，有 gap 控制间距 */
}

/* 将计数器推到头部最右侧 */
.card-header .counter {
    margin-left: auto;
}

.card-header i {
    font-size: 1rem;
    color: var(--primary-color);
    margin-right: 1rem;
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.input-wrapper {
    position: relative;
}

input[type="text"] {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.77rem;
    font-weight: 400;
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    outline: none;
}

.input-hint {
    position: absolute;
    bottom: -1.75rem;
    left: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.format-arrow {
    font-size: 1.75rem;
    color: var(--secondary-color);
}

.action-section {
    text-align: center;
    margin: 1.5rem 0;
}

.convert-btn {
    padding: 0.55rem 1.8rem;
    font-size: 0.84rem;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.25);
}

.convert-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

.text-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.text-card {
    background: var(--background-color);
    border-radius: 16px;
    padding: 1.4rem;
}

.text-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.01rem;
}

.counter {
    font-size: 0.7rem;
    color: #10b981;
    font-weight: 500;
}

.counter i {
    margin-right: 0.5rem;
}

textarea {
    width: 100%;
    height: 400px;
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    resize: vertical;
    font-size: 0.77rem;
    line-height: 1.7;
    font-family: 'Roboto Mono', monospace;
    transition: all 0.3s ease;
}

textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    outline: none;
}

.copy-btn {
    margin-top: 1.5rem;
    padding: 0.7rem 1.4rem;
    font-size: 0.77rem;
    font-weight: 500;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: #475569;
    transform: translateY(-2px);
}

.copy-btn.success {
    background: var(--success-color);
}

.footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 400;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}



/* 转换按钮状态样式 */

/* 通用：让所有 convert-btn 支持 converting/converted 状态（用于 concatBtn 也启用同样的交互） */
.convert-btn.converting {
    background-color: #f0ad4e;
    /* 黄色背景 */
    color: white;
    cursor: wait;
    /* 等待光标 */
    opacity: 0.9;
}

.convert-btn.converted {
    background-color: #5cb85c;
    /* 绿色背景 */
    color: white;
    transition: background-color 0.3s ease-out;
    animation: pulse 0.8s ease-out;
}

/* 通用成功样式用于清空按钮，使两处清空交互视觉一致 */
.btn.success {
    background-color: #4caf50;
    color: white;
}

.btn.success:hover {
    background-color: #45a049;
}

/* 转换完成的脉冲动画 */
@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* 旋转图标的动画 */
.fa-spin {
    animation: fa-spin 1s linear infinite;
}

@keyframes fa-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}




@media (max-width: 768px) {
    .container {
        max-width: 100%;
        padding: 1rem;
        margin: 0.5rem;
    }

    .main-content {
        padding: 1rem;
    }

    .format-section {
        flex-direction: column;
        gap: 1rem;
    }

    .format-arrow {
        transform: rotate(90deg);
    }

    .text-section {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    textarea {
        height: 180px;
    }
}

/* make concat output slightly smaller on narrow screens */
@media (max-width: 768px) {
    #concatOutputText {
        height: 160px !important;
    }
}

/* 小幅调整：在拼接tab中让 input 和 textarea 风格一致 */
#concatTabContent textarea {
    height: 340px;
}

/* 拼接结果在宽屏下占满两列 */
.concat-output-card {
    grid-column: 1 / -1;
}

/* 使拼接结果默认高度较短，便于看到复制按钮 */
#concatOutputText {
    height: 220px !important;
}

#concatTabContent input[type="text"] {
    height: 36px;
}

/* @media (prefers-color-scheme: dark) {
    :root {
        --background-color: #0F172A;
        --card-background: #1E293B;
        --text-primary: #F1F5F9;
        --text-secondary: #94A3B8;
        --border-color: #334155;
    }
} */

@media (prefers-color-scheme: dark) {
    :root {
        /* 优化的深色背景色调 */
        --background-color: #111827;
        --card-background: #1F2937;

        /* 更柔和的文字颜色 */
        --text-primary: #F9FAFB;
        --text-secondary: #D1D5DB;

        /* 更细腻的边框颜色 */
        --border-color: #374151;

        /* 调整阴影以适应深色模式 */
        --shadow-color: rgba(0, 0, 0, 0.25);

        /* 调整主色调为更适合夜间的蓝色 */
        --primary-color: #60A5FA;
        --primary-dark: #3B82F6;

        /* 调整成功色为更柔和的绿色 */
        --success-color: #34D399;
    }

    /* 确保夜间模式下输入框和文本区域有足够的对比度 */
    input[type="text"],
    textarea {
        background-color: #374151;
        color: #F9FAFB;
    }

    /* 调整按钮在夜间模式下的样式 */
    .convert-btn {
        box-shadow: 0 8px 20px rgba(59, 130, 246, 0.15);
    }

    .copy-btn {
        background: #059669;
    }

    .copy-btn:hover {
        background: #047857;
    }

    /* 调整清空按钮颜色 */
    #clearBtn {
        background: #EF4444;
        box-shadow: 0 8px 20px rgba(239, 68, 68, 0.15);
    }

    #clearBtn:hover {
        background-color: #DC2626;
    }

    #clearBtn.success {
        background-color: #10B981;
    }

    /* 调整计数器颜色 */
    .counter {
        color: #34D399;
    }

    /* 文本框悬停和聚焦效果 */
    input[type="text"]:focus,
    textarea:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
    }

    /* 卡片悬停效果 */
    .format-card:hover {
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    }
}