/* ===========================================================================
 * 圆周率生成器专用样式
 * ===========================================================================
 * ⚠️ 重要规范：
 * 1. 不要重复定义 tools-common.css 中的公共样式
 * 2. 特别注意：不要定义 .info-card 样式，完全依赖公共样式
 * 3. 所有样式必须限定在 .tool-page 作用域内
 * ===========================================================================
 */

/* ==================== 选项卡容器 ==================== */
.tool-page .tab-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-bottom: 30px;
}

/* 选项卡按钮 */
.tool-page .tab-buttons {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    background: #f8f9fa;
}

.tool-page .tab-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tool-page .tab-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.tool-page .tab-btn.active {
    background: #fff;
    color: #667eea;
    border-bottom: 3px solid #667eea;
    margin-bottom: -2px;
}

.tool-page .tab-btn i {
    font-size: 18px;
}

/* 选项卡内容 */
.tool-page .tab-contents {
    min-height: 400px;
}

.tool-page .tab-content {
    display: none;
    padding: 30px;
    animation: fadeIn 0.3s ease;
}

.tool-page .tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 控制区域 ==================== */
.tool-page .control-section,
.tool-page .options-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
}

.tool-page .control-section h3,
.tool-page .options-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    margin-top: 0;
    color: #333;
}

/* ==================== 滑块控制 ==================== */
.tool-page .slider-container {
    margin-bottom: 20px;
}

.tool-page .slider-container label {
    display: block;
    font-weight: 500;
    margin-bottom: 10px;
    color: #495057;
    font-size: 16px;
}

.tool-page .digits-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #dee2e6 0%, #667eea 100%);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.tool-page .digits-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102,126,234,0.4);
}

.tool-page .digits-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #5568d3;
}

.tool-page .digits-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102,126,234,0.4);
}

.tool-page .digits-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: #5568d3;
}

.tool-page .slider-marks {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 12px;
    color: #6c757d;
    padding: 0 5px;
}

/* ==================== 输入组 ==================== */
.tool-page .input-group {
    margin-bottom: 20px;
}

.tool-page .input-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #495057;
    font-size: 16px;
}

.tool-page .input-group input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.tool-page .input-group input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

/* ==================== 快捷按钮 ==================== */
.tool-page .quick-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.tool-page .quick-btn {
    padding: 12px 20px;
    border: 2px solid #667eea;
    background: #fff;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
}

.tool-page .quick-btn:hover {
    background: #667eea;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

.tool-page .quick-btn:active {
    transform: translateY(0);
}

/* ==================== 复选框组 ==================== */
.tool-page .checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.tool-page .checkbox-group:hover {
    background: #fff;
}

.tool-page .checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #667eea;
}

.tool-page .checkbox-group label {
    font-size: 16px;
    color: #495057;
    cursor: pointer;
    user-select: none;
    margin: 0;
}

/* ==================== 操作按钮 ==================== */
.tool-page .action-buttons {
    text-align: center;
    margin: 30px 0;
}

.tool-page .primary-btn {
    padding: 16px 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 16px rgba(102,126,234,0.3);
}

.tool-page .primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102,126,234,0.4);
}

.tool-page .primary-btn:active {
    transform: translateY(0);
}

/* ==================== 进度条 ==================== */
.tool-page .progress-container {
    margin: 30px 0;
    text-align: center;
}

.tool-page .progress-bar {
    width: 100%;
    height: 36px;
    background: #e9ecef;
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.tool-page .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 15px;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.tool-page .progress-text {
    font-size: 16px;
    color: #6c757d;
    font-weight: 500;
}

/* ==================== 结果区域 ==================== */
.tool-page .result-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 30px;
    margin-top: 30px;
    border: 1px solid #e9ecef;
}

.tool-page .result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tool-page .result-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.tool-page .result-actions {
    display: flex;
    gap: 10px;
}

.tool-page .icon-btn {
    padding: 10px 20px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.tool-page .icon-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

/* π 显示区域 */
.tool-page .pi-display {
    background: #fff;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 16px;
    line-height: 2;
    color: #333;
    max-height: 500px;
    overflow-y: auto;
    word-break: break-all;
    white-space: pre-wrap;
}

.tool-page .pi-display::-webkit-scrollbar {
    width: 8px;
}

.tool-page .pi-display::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.tool-page .pi-display::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.tool-page .pi-display::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.tool-page .pi-line {
    display: flex;
    margin-bottom: 5px;
}

.tool-page .line-num {
    min-width: 60px;
    color: #6c757d;
    margin-right: 20px;
    text-align: right;
    user-select: none;
    font-weight: 500;
}

.tool-page .pi-text {
    color: #2c3e50;
}

.tool-page .result-info {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #dee2e6;
    font-size: 15px;
    color: #6c757d;
    text-align: center;
}

.tool-page .result-info span {
    color: #667eea;
    font-weight: 600;
}

/* ==================== 搜索区域 ==================== */
.tool-page .search-section {
    padding: 20px 0;
}

.tool-page .search-section h3 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.tool-page .search-section > p {
    color: #6c757d;
    margin-bottom: 20px;
    line-height: 1.6;
}

.tool-page .search-input-group {
    display: flex;
    gap: 10px;
    margin: 25px 0;
}

.tool-page .search-input-group input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.tool-page .search-input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.tool-page .search-results {
    margin-top: 25px;
    min-height: 100px;
}

.tool-page .search-result {
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.tool-page .search-result.success {
    border-left-color: #28a745;
}

.tool-page .search-result h4 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.tool-page .search-positions {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.tool-page .search-positions li {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 14px;
}

.tool-page .search-positions li.more {
    color: #6c757d;
    font-style: italic;
}

.tool-page .search-error,
.tool-page .search-warning {
    color: #dc3545;
    padding: 15px;
    background: #f8d7da;
    border-radius: 6px;
}

.tool-page .search-warning {
    color: #856404;
    background: #fff3cd;
}

.tool-page .hint {
    font-size: 14px;
    color: #6c757d;
    margin-top: 10px;
}

/* ==================== 历史记录 ==================== */
.tool-page .history-section {
    padding: 20px 0;
}

.tool-page .history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.tool-page .history-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.tool-page .danger-btn {
    padding: 10px 20px;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.tool-page .danger-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220,53,69,0.3);
}

.tool-page .history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tool-page .history-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.tool-page .history-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.tool-page .history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.tool-page .history-digits {
    font-weight: 600;
    font-size: 18px;
    color: #667eea;
}

.tool-page .history-time {
    font-size: 13px;
    color: #6c757d;
}

.tool-page .history-info {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 10px;
}

.tool-page .link-btn {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    text-decoration: underline;
    font-size: 14px;
    padding: 0;
    margin-left: 5px;
}

.tool-page .link-btn:hover {
    color: #5568d3;
}

.tool-page .history-preview {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 13px;
    color: #495057;
    margin-top: 10px;
    padding: 10px;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tool-page .empty-history {
    text-align: center;
    color: #6c757d;
    padding: 40px 20px;
    font-size: 16px;
}

/* ==================== 关于 π 区域 ==================== */
.tool-page .about-section {
    padding: 20px 0;
}

.tool-page .about-section > h3 {
    font-size: 22px;
    font-weight: 600;
    color: #333;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tool-page .knowledge-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    border-left: 4px solid #17a2b8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
}

.tool-page .knowledge-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.tool-page .knowledge-card h4 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    margin-top: 0;
}

.tool-page .knowledge-card p {
    font-size: 16px;
    line-height: 1.8;
    color: #495057;
    margin: 0;
}

/* ==================== Toast 消息提示 ==================== */
.toast {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 16px 24px;
    background: #333;
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    z-index: 10000;
    font-size: 15px;
    font-weight: 500;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.toast-success {
    background: #28a745;
}

.toast.toast-error {
    background: #dc3545;
}

.toast.toast-warning {
    background: #ffc107;
    color: #333;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    /* 选项卡 */
    .tool-page .tab-btn {
        font-size: 14px;
        padding: 12px 10px;
        flex-direction: column;
        gap: 4px;
    }

    .tool-page .tab-btn span {
        font-size: 12px;
    }

    .tool-page .tab-content {
        padding: 20px 15px;
    }

    /* 快捷按钮 */
    .tool-page .quick-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    /* 结果区域 */
    .tool-page .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .tool-page .result-actions {
        width: 100%;
    }

    .tool-page .icon-btn {
        flex: 1;
        justify-content: center;
    }

    .tool-page .pi-display {
        font-size: 14px;
        padding: 15px;
        line-height: 1.8;
    }

    /* 搜索区域 */
    .tool-page .search-input-group {
        flex-direction: column;
    }

    .tool-page .search-input-group .primary-btn {
        width: 100%;
    }

    .tool-page .search-positions {
        grid-template-columns: 1fr;
    }

    /* 历史记录 */
    .tool-page .history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .tool-page .history-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* Toast */
    .toast {
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
    }
}

@media (max-width: 480px) {
    .tool-page .control-section,
    .tool-page .options-section {
        padding: 20px 15px;
    }

    .tool-page .primary-btn {
        padding: 14px 32px;
        font-size: 16px;
    }

    .tool-page .knowledge-card {
        padding: 20px;
    }
}
