/* 基础样式 */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --border-color: #e2e8f0;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


/* 图标样式 */
.bi {
    display: inline-block;
    vertical-align: -0.125em;
    margin-right: 0.25rem;
}

/* 区块标题 */
.section-title {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.section-title .bi {
    color: var(--primary-color);
    font-size: 1rem;
}

/* 容器布局 */
.app-container {
    min-height: 100vh;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.calculator-wrapper {
    width: 100%;
    max-width: 800px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

/* 头部样式 */
.app-header {
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    text-align: center;
}

.app-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-header .bi {
    font-size: 1.25rem;
}

/* 计算器主体 */
.calculator-section {
    padding: 1.25rem;
    padding-bottom: 0;
}

/* 输入组 */
.input-group {
    background: white;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.root-type {
    display: inline-flex;
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1rem;
    background: white;
}

.root-type button {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.root-type button .bi {
    font-size: 1rem;
}

.root-type button:not(:last-child) {
    border-right: 1px solid var(--primary-color);
}

.root-type button.active {
    background: var(--primary-color);
    color: white;
}

.input-area {
    margin-top: 0.75rem;
}

.n-root-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.n-root-input label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
}

.n-root-input input {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.n-root-input input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.number-input input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    background: white;
    transition: border-color 0.2s ease;
}

.number-input input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 精度控制 */
.precision-control {
    background: white;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.precision-buttons {
    display: flex;
    gap: 0.5rem;
}

.precision-buttons button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.precision-buttons button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 结果显示 */
.result-section {
    background: white;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.result-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.result-label, .expression-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.result-value {
    flex: 1;
    font-family: monospace;
    font-size: 1.125rem;
    color: var(--primary-color);
    font-weight: 500;
}

#copy {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

#copy:hover {
    background: var(--primary-hover);
}

#copy .bi {
    margin: 0;
}

.expression-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.expression-value {
    flex: 1;
    font-family: monospace;
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* 步骤显示 */
.steps-section {
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.steps-header {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.steps-header span {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
}

.toggle-steps {
    padding: 0.25rem 0.75rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.toggle-steps .bi {
    margin: 0;
    font-size: 0.875rem;
}

.toggle-steps:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.steps-content {
    padding: 1rem;
}

.step-item {
    margin-bottom: 0.75rem;
    padding-left: 1.25rem;
    position: relative;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.step-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5rem;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
}

/* 信息区域 */
.info-section {
    background: white;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin: 1.25rem;
    border: 1px solid var(--border-color);
}

.info-section ul {
    list-style: none;
    padding-left: 1.25rem;
}

.info-section li {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    position: relative;
    font-size: 0.875rem;
}

.info-section li::before {
    content: '•';
    position: absolute;
    left: -1rem;
    color: var(--primary-color);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .app-container {
        padding: 0.5rem;
    }

    .calculator-wrapper {
        border-radius: var(--radius-md);
    }

    .precision-buttons {
        flex-wrap: wrap;
    }

    .precision-buttons button {
        flex: 1;
        min-width: calc(50% - 0.25rem);
    }

    .result-display {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    #copy {
        width: 100%;
    }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --text-primary: #f8fafc;
        --text-secondary: #94a3b8;
        --border-color: #334155;
    }

    body {
        background-color: #0f172a;
    }

    .calculator-wrapper,
    .input-group,
    .precision-control,
    .result-section,
    .steps-section,
    .info-section {
        background: var(--bg-secondary);
        border-color: var(--border-color);
    }

    .number-input input,
    .n-root-input input,
    .precision-buttons button {
        background: var(--bg-secondary);
        color: var(--text-primary);
        border-color: var(--border-color);
    }

    .toggle-steps:hover {
        background: var(--primary-color);
    }

    .section-title .bi {
        color: var(--primary-color);
    }
} 